From c1f2e6b6e372d0f62945aa26835780039ead7907 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Wed, 21 Aug 2002 02:27:32 +0000 Subject: [PATCH] Initial revision git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@39 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/AUTHORS | 73 + glabels2/COPYING | 340 + glabels2/ChangeLog | 0 glabels2/INSTALL | 182 + glabels2/Makefile.am | 58 + glabels2/Makefile.in | 452 ++ glabels2/NEWS | 0 glabels2/README | 83 + glabels2/TODO | 189 + glabels2/acconfig.h | 13 + glabels2/aclocal.m4 | 847 +++ glabels2/barcode-0.98/COPYING | 339 + glabels2/barcode-0.98/ChangeLog | 460 ++ glabels2/barcode-0.98/INSTALL | 31 + glabels2/barcode-0.98/Makefile.in | 141 + glabels2/barcode-0.98/README | 93 + glabels2/barcode-0.98/TODO | 23 + glabels2/barcode-0.98/barcode.h | 119 + glabels2/barcode-0.98/barcode.spec | 84 + glabels2/barcode-0.98/bookland/bookland.py | 884 +++ glabels2/barcode-0.98/cmdline.c | 177 + glabels2/barcode-0.98/cmdline.h | 58 + glabels2/barcode-0.98/codabar.c | 182 + glabels2/barcode-0.98/code128.c | 607 ++ glabels2/barcode-0.98/code39.c | 173 + glabels2/barcode-0.98/code93.c | 213 + glabels2/barcode-0.98/compat/getopt.c | 831 +++ glabels2/barcode-0.98/compat/getopt.h | 129 + glabels2/barcode-0.98/configure | 3556 ++++++++++ glabels2/barcode-0.98/configure.in | 65 + .../barcode-0.98/contrib/barcode-SVG.tar.gz | Bin 0 -> 2880 bytes .../contrib/barcode-SVG.tar.gz.README | 24 + .../contrib/barcode-for-delphi.tar.gz | Bin 0 -> 19010 bytes .../contrib/barcode-for-delphi.tar.gz.README | 10 + .../barcode-0.98/contrib/barcodeps-0.1.tgz | Bin 0 -> 2036 bytes .../contrib/barcodeps-0.1.tgz.README | 25 + .../barcode-0.98/contrib/grab-0.0.4.tar.gz | Bin 0 -> 28320 bytes .../contrib/grab-0.0.4.tar.gz.README | 13 + glabels2/barcode-0.98/debian/README.debian | 9 + glabels2/barcode-0.98/debian/changelog | 27 + glabels2/barcode-0.98/debian/control | 14 + glabels2/barcode-0.98/debian/copyright | 8 + glabels2/barcode-0.98/debian/dirs | 3 + glabels2/barcode-0.98/debian/info | 15 + glabels2/barcode-0.98/debian/rules | 50 + glabels2/barcode-0.98/doc/Makefile.in | 135 + glabels2/barcode-0.98/doc/README | 5 + glabels2/barcode-0.98/doc/barcode.info | 747 ++ glabels2/barcode-0.98/doc/barcode.pdf | Bin 0 -> 160731 bytes glabels2/barcode-0.98/doc/barcode.ps | 2378 +++++++ glabels2/barcode-0.98/doc/barcodedoc.txt | 734 ++ glabels2/barcode-0.98/doc/doc.barcode | 939 +++ glabels2/barcode-0.98/doc/infofilter | 16 + glabels2/barcode-0.98/doc/manpager | 120 + glabels2/barcode-0.98/doc/mktxt | 38 + glabels2/barcode-0.98/doc/texi2html | 2021 ++++++ glabels2/barcode-0.98/ean.c | 774 ++ glabels2/barcode-0.98/i25.c | 164 + glabels2/barcode-0.98/install-sh | 238 + glabels2/barcode-0.98/library.c | 244 + glabels2/barcode-0.98/main.c | 604 ++ glabels2/barcode-0.98/missing | 198 + glabels2/barcode-0.98/mkinstalldirs | 40 + glabels2/barcode-0.98/msi.c | 155 + glabels2/barcode-0.98/pcl.c | 200 + glabels2/barcode-0.98/plessey.c | 164 + glabels2/barcode-0.98/ps.c | 272 + glabels2/barcode-0.98/sample.c | 98 + glabels2/config.h.in | 154 + glabels2/configure | 6303 +++++++++++++++++ glabels2/configure.in | 97 + glabels2/cvswrappers | 1 + glabels2/data/predefined-labels.template | 495 ++ glabels2/glabels.desktop | 9 + glabels2/glabels.spec.in | 57 + glabels2/install-sh | 251 + glabels2/missing | 190 + glabels2/mkinstalldirs | 40 + glabels2/pixmaps/glabels-about-logo.png | Bin 0 -> 12949 bytes glabels2/pixmaps/glabels-icon.png | Bin 0 -> 660 bytes glabels2/pixmaps/glabels-logo.png | Bin 0 -> 110598 bytes glabels2/po/ChangeLog | 0 glabels2/po/Makefile.in.in | 243 + glabels2/po/POTFILES.in | 135 + glabels2/po/de.po | 907 +++ glabels2/po/fr.po | 2497 +++++++ glabels2/po/glabels.pot | 709 ++ glabels2/po/ja.po | 854 +++ glabels2/po/pt_BR.po | 861 +++ glabels2/src/Makefile.am | 260 + glabels2/src/Makefile.in | 478 ++ glabels2/src/bc-gnubarcode.c | 239 + glabels2/src/bc-gnubarcode.h | 32 + glabels2/src/bc-postnet.c | 150 + glabels2/src/bc-postnet.h | 29 + glabels2/src/bc.c | 201 + glabels2/src/bc.h | 73 + glabels2/src/bonobo-mdi-child.c | 316 + glabels2/src/bonobo-mdi-child.h | 101 + glabels2/src/bonobo-mdi.c | 2197 ++++++ glabels2/src/bonobo-mdi.h | 204 + glabels2/src/canvas-hacktext.c | 587 ++ glabels2/src/canvas-hacktext.h | 71 + glabels2/src/commands.c | 419 ++ glabels2/src/commands.h | 111 + glabels2/src/debug.c | 93 + glabels2/src/debug.h | 94 + glabels2/src/file.c | 715 ++ glabels2/src/file.h | 45 + glabels2/src/glabels-batch.c | 152 + glabels2/src/glabels-ui.xml | 328 + glabels2/src/glabels.c | 230 + glabels2/src/glabels.h | 54 + glabels2/src/gnome-recent-marshal.list | 1 + glabels2/src/gnome-recent-model.c | 771 ++ glabels2/src/gnome-recent-model.h | 40 + glabels2/src/gnome-recent-util.c | 43 + glabels2/src/gnome-recent-util.h | 9 + glabels2/src/gnome-recent-view-bonobo.c | 500 ++ glabels2/src/gnome-recent-view-bonobo.h | 34 + glabels2/src/gnome-recent-view.c | 51 + glabels2/src/gnome-recent-view.h | 49 + glabels2/src/label-barcode.c | 280 + glabels2/src/label-barcode.h | 80 + glabels2/src/label-box.c | 233 + glabels2/src/label-box.h | 76 + glabels2/src/label-ellipse.c | 232 + glabels2/src/label-ellipse.h | 76 + glabels2/src/label-image.c | 239 + glabels2/src/label-image.h | 69 + glabels2/src/label-line.c | 210 + glabels2/src/label-line.h | 72 + glabels2/src/label-object.c | 426 ++ glabels2/src/label-object.h | 106 + glabels2/src/label-text.c | 345 + glabels2/src/label-text.h | 83 + glabels2/src/label.c | 614 ++ glabels2/src/label.h | 107 + glabels2/src/marshal.list | 6 + glabels2/src/mdi-child.c | 363 + glabels2/src/mdi-child.h | 79 + glabels2/src/mdi.c | 857 +++ glabels2/src/mdi.h | 73 + glabels2/src/menus.c | 260 + glabels2/src/menus.h | 80 + glabels2/src/merge-properties.c | 270 + glabels2/src/merge-properties.h | 29 + glabels2/src/merge-text.c | 272 + glabels2/src/merge-text.h | 35 + glabels2/src/merge-ui-text.c | 448 ++ glabels2/src/merge-ui-text.h | 101 + glabels2/src/merge-ui.c | 557 ++ glabels2/src/merge-ui.h | 106 + glabels2/src/merge.c | 605 ++ glabels2/src/merge.h | 105 + glabels2/src/pixmaps/Makefile.am | 18 + glabels2/src/pixmaps/Makefile.in | 191 + glabels2/src/pixmaps/checkerboard.xpm | 29 + glabels2/src/pixmaps/collate.xpm | 34 + glabels2/src/pixmaps/cursor_barcode.xbm | 16 + glabels2/src/pixmaps/cursor_barcode_mask.xbm | 16 + glabels2/src/pixmaps/cursor_box.xbm | 16 + glabels2/src/pixmaps/cursor_box_mask.xbm | 16 + glabels2/src/pixmaps/cursor_ellipse.xbm | 16 + glabels2/src/pixmaps/cursor_ellipse_mask.xbm | 16 + glabels2/src/pixmaps/cursor_image.xbm | 16 + glabels2/src/pixmaps/cursor_image_mask.xbm | 16 + glabels2/src/pixmaps/cursor_line.xbm | 16 + glabels2/src/pixmaps/cursor_line_mask.xbm | 16 + glabels2/src/pixmaps/cursor_text.xbm | 16 + glabels2/src/pixmaps/cursor_text_mask.xbm | 16 + glabels2/src/pixmaps/nocollate.xpm | 34 + glabels2/src/prefs-dialog.c | 568 ++ glabels2/src/prefs-dialog.h | 58 + glabels2/src/prefs.c | 635 ++ glabels2/src/prefs.h | 91 + glabels2/src/print-dialog.c | 392 + glabels2/src/print-dialog.h | 31 + glabels2/src/print.c | 1070 +++ glabels2/src/print.h | 53 + glabels2/src/recent.c | 45 + glabels2/src/recent.h | 32 + glabels2/src/splash.c | 115 + glabels2/src/splash.h | 28 + glabels2/src/stock-pixmaps/Makefile.am | 30 + glabels2/src/stock-pixmaps/Makefile.in | 207 + glabels2/src/stock-pixmaps/stock_arrow_24.png | Bin 0 -> 328 bytes .../src/stock-pixmaps/stock_barcode_24.png | Bin 0 -> 302 bytes glabels2/src/stock-pixmaps/stock_box_24.png | Bin 0 -> 281 bytes .../src/stock-pixmaps/stock_ellipse_24.png | Bin 0 -> 741 bytes glabels2/src/stock-pixmaps/stock_image_24.png | Bin 0 -> 544 bytes glabels2/src/stock-pixmaps/stock_line_24.png | Bin 0 -> 394 bytes glabels2/src/stock-pixmaps/stock_merge_24.png | Bin 0 -> 537 bytes glabels2/src/stock-pixmaps/stock_text_24.png | Bin 0 -> 355 bytes glabels2/src/stock.c | 137 + glabels2/src/stock.h | 39 + glabels2/src/template.c | 804 +++ glabels2/src/template.h | 74 + glabels2/src/text-node.c | 268 + glabels2/src/text-node.h | 48 + glabels2/src/tools.c | 230 + glabels2/src/tools.h | 71 + glabels2/src/util.c | 252 + glabels2/src/util.h | 49 + glabels2/src/view-barcode.c | 835 +++ glabels2/src/view-barcode.h | 70 + glabels2/src/view-box.c | 707 ++ glabels2/src/view-box.h | 70 + glabels2/src/view-ellipse.c | 706 ++ glabels2/src/view-ellipse.h | 70 + glabels2/src/view-highlight.c | 1637 +++++ glabels2/src/view-highlight.h | 41 + glabels2/src/view-image.c | 685 ++ glabels2/src/view-image.h | 70 + glabels2/src/view-line.c | 652 ++ glabels2/src/view-line.h | 70 + glabels2/src/view-object.c | 524 ++ glabels2/src/view-object.h | 85 + glabels2/src/view-text.c | 759 ++ glabels2/src/view-text.h | 70 + glabels2/src/view.c | 1885 +++++ glabels2/src/view.h | 101 + glabels2/src/wdgt-bc-data.c | 338 + glabels2/src/wdgt-bc-data.h | 68 + glabels2/src/wdgt-bc-props.c | 250 + glabels2/src/wdgt-bc-props.h | 67 + glabels2/src/wdgt-bc-style.c | 463 ++ glabels2/src/wdgt-bc-style.h | 79 + glabels2/src/wdgt-fill.c | 218 + glabels2/src/wdgt-fill.h | 62 + glabels2/src/wdgt-line.c | 247 + glabels2/src/wdgt-line.h | 68 + glabels2/src/wdgt-media-select.c | 517 ++ glabels2/src/wdgt-media-select.h | 76 + glabels2/src/wdgt-mini-preview.c | 562 ++ glabels2/src/wdgt-mini-preview.h | 80 + glabels2/src/wdgt-position.c | 322 + glabels2/src/wdgt-position.h | 70 + glabels2/src/wdgt-print-copies.c | 397 ++ glabels2/src/wdgt-print-copies.h | 75 + glabels2/src/wdgt-print-merge.c | 337 + glabels2/src/wdgt-print-merge.h | 75 + glabels2/src/wdgt-rotate-label.c | 359 + glabels2/src/wdgt-rotate-label.h | 71 + glabels2/src/wdgt-size.c | 493 ++ glabels2/src/wdgt-size.h | 78 + glabels2/src/wdgt-text-entry.c | 321 + glabels2/src/wdgt-text-entry.h | 69 + glabels2/src/wdgt-text-props.c | 428 ++ glabels2/src/wdgt-text-props.h | 82 + glabels2/src/wdgt-vector.c | 306 + glabels2/src/wdgt-vector.h | 68 + glabels2/src/xml-label.c | 1116 +++ glabels2/src/xml-label.h | 53 + glabels2/stamp-h.in | 1 + 255 files changed, 73536 insertions(+) create mode 100644 glabels2/AUTHORS create mode 100644 glabels2/COPYING create mode 100644 glabels2/ChangeLog create mode 100644 glabels2/INSTALL create mode 100644 glabels2/Makefile.am create mode 100644 glabels2/Makefile.in create mode 100644 glabels2/NEWS create mode 100644 glabels2/README create mode 100644 glabels2/TODO create mode 100644 glabels2/acconfig.h create mode 100644 glabels2/aclocal.m4 create mode 100644 glabels2/barcode-0.98/COPYING create mode 100644 glabels2/barcode-0.98/ChangeLog create mode 100644 glabels2/barcode-0.98/INSTALL create mode 100644 glabels2/barcode-0.98/Makefile.in create mode 100644 glabels2/barcode-0.98/README create mode 100644 glabels2/barcode-0.98/TODO create mode 100644 glabels2/barcode-0.98/barcode.h create mode 100644 glabels2/barcode-0.98/barcode.spec create mode 100644 glabels2/barcode-0.98/bookland/bookland.py create mode 100644 glabels2/barcode-0.98/cmdline.c create mode 100644 glabels2/barcode-0.98/cmdline.h create mode 100644 glabels2/barcode-0.98/codabar.c create mode 100644 glabels2/barcode-0.98/code128.c create mode 100644 glabels2/barcode-0.98/code39.c create mode 100644 glabels2/barcode-0.98/code93.c create mode 100644 glabels2/barcode-0.98/compat/getopt.c create mode 100644 glabels2/barcode-0.98/compat/getopt.h create mode 100755 glabels2/barcode-0.98/configure create mode 100644 glabels2/barcode-0.98/configure.in create mode 100644 glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz create mode 100644 glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README create mode 100644 glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz create mode 100644 glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README create mode 100644 glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz create mode 100644 glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz.README create mode 100644 glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz create mode 100644 glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz.README create mode 100644 glabels2/barcode-0.98/debian/README.debian create mode 100644 glabels2/barcode-0.98/debian/changelog create mode 100644 glabels2/barcode-0.98/debian/control create mode 100644 glabels2/barcode-0.98/debian/copyright create mode 100644 glabels2/barcode-0.98/debian/dirs create mode 100644 glabels2/barcode-0.98/debian/info create mode 100755 glabels2/barcode-0.98/debian/rules create mode 100644 glabels2/barcode-0.98/doc/Makefile.in create mode 100644 glabels2/barcode-0.98/doc/README create mode 100644 glabels2/barcode-0.98/doc/barcode.info create mode 100644 glabels2/barcode-0.98/doc/barcode.pdf create mode 100644 glabels2/barcode-0.98/doc/barcode.ps create mode 100644 glabels2/barcode-0.98/doc/barcodedoc.txt create mode 100644 glabels2/barcode-0.98/doc/doc.barcode create mode 100755 glabels2/barcode-0.98/doc/infofilter create mode 100755 glabels2/barcode-0.98/doc/manpager create mode 100755 glabels2/barcode-0.98/doc/mktxt create mode 100755 glabels2/barcode-0.98/doc/texi2html create mode 100644 glabels2/barcode-0.98/ean.c create mode 100644 glabels2/barcode-0.98/i25.c create mode 100644 glabels2/barcode-0.98/install-sh create mode 100644 glabels2/barcode-0.98/library.c create mode 100644 glabels2/barcode-0.98/main.c create mode 100755 glabels2/barcode-0.98/missing create mode 100755 glabels2/barcode-0.98/mkinstalldirs create mode 100644 glabels2/barcode-0.98/msi.c create mode 100644 glabels2/barcode-0.98/pcl.c create mode 100644 glabels2/barcode-0.98/plessey.c create mode 100644 glabels2/barcode-0.98/ps.c create mode 100644 glabels2/barcode-0.98/sample.c create mode 100644 glabels2/config.h.in create mode 100755 glabels2/configure create mode 100644 glabels2/configure.in create mode 100644 glabels2/cvswrappers create mode 100644 glabels2/data/predefined-labels.template create mode 100644 glabels2/glabels.desktop create mode 100644 glabels2/glabels.spec.in create mode 100755 glabels2/install-sh create mode 100755 glabels2/missing create mode 100755 glabels2/mkinstalldirs create mode 100644 glabels2/pixmaps/glabels-about-logo.png create mode 100644 glabels2/pixmaps/glabels-icon.png create mode 100644 glabels2/pixmaps/glabels-logo.png create mode 100644 glabels2/po/ChangeLog create mode 100644 glabels2/po/Makefile.in.in create mode 100644 glabels2/po/POTFILES.in create mode 100644 glabels2/po/de.po create mode 100644 glabels2/po/fr.po create mode 100644 glabels2/po/glabels.pot create mode 100644 glabels2/po/ja.po create mode 100644 glabels2/po/pt_BR.po create mode 100644 glabels2/src/Makefile.am create mode 100644 glabels2/src/Makefile.in create mode 100644 glabels2/src/bc-gnubarcode.c create mode 100644 glabels2/src/bc-gnubarcode.h create mode 100644 glabels2/src/bc-postnet.c create mode 100644 glabels2/src/bc-postnet.h create mode 100644 glabels2/src/bc.c create mode 100644 glabels2/src/bc.h create mode 100644 glabels2/src/bonobo-mdi-child.c create mode 100644 glabels2/src/bonobo-mdi-child.h create mode 100644 glabels2/src/bonobo-mdi.c create mode 100644 glabels2/src/bonobo-mdi.h create mode 100644 glabels2/src/canvas-hacktext.c create mode 100644 glabels2/src/canvas-hacktext.h create mode 100644 glabels2/src/commands.c create mode 100644 glabels2/src/commands.h create mode 100644 glabels2/src/debug.c create mode 100644 glabels2/src/debug.h create mode 100644 glabels2/src/file.c create mode 100644 glabels2/src/file.h create mode 100644 glabels2/src/glabels-batch.c create mode 100644 glabels2/src/glabels-ui.xml create mode 100644 glabels2/src/glabels.c create mode 100644 glabels2/src/glabels.h create mode 100644 glabels2/src/gnome-recent-marshal.list create mode 100644 glabels2/src/gnome-recent-model.c create mode 100644 glabels2/src/gnome-recent-model.h create mode 100644 glabels2/src/gnome-recent-util.c create mode 100644 glabels2/src/gnome-recent-util.h create mode 100644 glabels2/src/gnome-recent-view-bonobo.c create mode 100644 glabels2/src/gnome-recent-view-bonobo.h create mode 100644 glabels2/src/gnome-recent-view.c create mode 100644 glabels2/src/gnome-recent-view.h create mode 100644 glabels2/src/label-barcode.c create mode 100644 glabels2/src/label-barcode.h create mode 100644 glabels2/src/label-box.c create mode 100644 glabels2/src/label-box.h create mode 100644 glabels2/src/label-ellipse.c create mode 100644 glabels2/src/label-ellipse.h create mode 100644 glabels2/src/label-image.c create mode 100644 glabels2/src/label-image.h create mode 100644 glabels2/src/label-line.c create mode 100644 glabels2/src/label-line.h create mode 100644 glabels2/src/label-object.c create mode 100644 glabels2/src/label-object.h create mode 100644 glabels2/src/label-text.c create mode 100644 glabels2/src/label-text.h create mode 100644 glabels2/src/label.c create mode 100644 glabels2/src/label.h create mode 100644 glabels2/src/marshal.list create mode 100644 glabels2/src/mdi-child.c create mode 100644 glabels2/src/mdi-child.h create mode 100644 glabels2/src/mdi.c create mode 100644 glabels2/src/mdi.h create mode 100644 glabels2/src/menus.c create mode 100644 glabels2/src/menus.h create mode 100644 glabels2/src/merge-properties.c create mode 100644 glabels2/src/merge-properties.h create mode 100644 glabels2/src/merge-text.c create mode 100644 glabels2/src/merge-text.h create mode 100644 glabels2/src/merge-ui-text.c create mode 100644 glabels2/src/merge-ui-text.h create mode 100644 glabels2/src/merge-ui.c create mode 100644 glabels2/src/merge-ui.h create mode 100644 glabels2/src/merge.c create mode 100644 glabels2/src/merge.h create mode 100644 glabels2/src/pixmaps/Makefile.am create mode 100644 glabels2/src/pixmaps/Makefile.in create mode 100644 glabels2/src/pixmaps/checkerboard.xpm create mode 100644 glabels2/src/pixmaps/collate.xpm create mode 100644 glabels2/src/pixmaps/cursor_barcode.xbm create mode 100644 glabels2/src/pixmaps/cursor_barcode_mask.xbm create mode 100644 glabels2/src/pixmaps/cursor_box.xbm create mode 100644 glabels2/src/pixmaps/cursor_box_mask.xbm create mode 100644 glabels2/src/pixmaps/cursor_ellipse.xbm create mode 100644 glabels2/src/pixmaps/cursor_ellipse_mask.xbm create mode 100644 glabels2/src/pixmaps/cursor_image.xbm create mode 100644 glabels2/src/pixmaps/cursor_image_mask.xbm create mode 100644 glabels2/src/pixmaps/cursor_line.xbm create mode 100644 glabels2/src/pixmaps/cursor_line_mask.xbm create mode 100644 glabels2/src/pixmaps/cursor_text.xbm create mode 100644 glabels2/src/pixmaps/cursor_text_mask.xbm create mode 100644 glabels2/src/pixmaps/nocollate.xpm create mode 100644 glabels2/src/prefs-dialog.c create mode 100644 glabels2/src/prefs-dialog.h create mode 100644 glabels2/src/prefs.c create mode 100644 glabels2/src/prefs.h create mode 100644 glabels2/src/print-dialog.c create mode 100644 glabels2/src/print-dialog.h create mode 100644 glabels2/src/print.c create mode 100644 glabels2/src/print.h create mode 100644 glabels2/src/recent.c create mode 100644 glabels2/src/recent.h create mode 100644 glabels2/src/splash.c create mode 100644 glabels2/src/splash.h create mode 100644 glabels2/src/stock-pixmaps/Makefile.am create mode 100644 glabels2/src/stock-pixmaps/Makefile.in create mode 100644 glabels2/src/stock-pixmaps/stock_arrow_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_barcode_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_box_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_ellipse_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_image_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_line_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_merge_24.png create mode 100644 glabels2/src/stock-pixmaps/stock_text_24.png create mode 100644 glabels2/src/stock.c create mode 100644 glabels2/src/stock.h create mode 100644 glabels2/src/template.c create mode 100644 glabels2/src/template.h create mode 100644 glabels2/src/text-node.c create mode 100644 glabels2/src/text-node.h create mode 100644 glabels2/src/tools.c create mode 100644 glabels2/src/tools.h create mode 100644 glabels2/src/util.c create mode 100644 glabels2/src/util.h create mode 100644 glabels2/src/view-barcode.c create mode 100644 glabels2/src/view-barcode.h create mode 100644 glabels2/src/view-box.c create mode 100644 glabels2/src/view-box.h create mode 100644 glabels2/src/view-ellipse.c create mode 100644 glabels2/src/view-ellipse.h create mode 100644 glabels2/src/view-highlight.c create mode 100644 glabels2/src/view-highlight.h create mode 100644 glabels2/src/view-image.c create mode 100644 glabels2/src/view-image.h create mode 100644 glabels2/src/view-line.c create mode 100644 glabels2/src/view-line.h create mode 100644 glabels2/src/view-object.c create mode 100644 glabels2/src/view-object.h create mode 100644 glabels2/src/view-text.c create mode 100644 glabels2/src/view-text.h create mode 100644 glabels2/src/view.c create mode 100644 glabels2/src/view.h create mode 100644 glabels2/src/wdgt-bc-data.c create mode 100644 glabels2/src/wdgt-bc-data.h create mode 100644 glabels2/src/wdgt-bc-props.c create mode 100644 glabels2/src/wdgt-bc-props.h create mode 100644 glabels2/src/wdgt-bc-style.c create mode 100644 glabels2/src/wdgt-bc-style.h create mode 100644 glabels2/src/wdgt-fill.c create mode 100644 glabels2/src/wdgt-fill.h create mode 100644 glabels2/src/wdgt-line.c create mode 100644 glabels2/src/wdgt-line.h create mode 100644 glabels2/src/wdgt-media-select.c create mode 100644 glabels2/src/wdgt-media-select.h create mode 100644 glabels2/src/wdgt-mini-preview.c create mode 100644 glabels2/src/wdgt-mini-preview.h create mode 100644 glabels2/src/wdgt-position.c create mode 100644 glabels2/src/wdgt-position.h create mode 100644 glabels2/src/wdgt-print-copies.c create mode 100644 glabels2/src/wdgt-print-copies.h create mode 100644 glabels2/src/wdgt-print-merge.c create mode 100644 glabels2/src/wdgt-print-merge.h create mode 100644 glabels2/src/wdgt-rotate-label.c create mode 100644 glabels2/src/wdgt-rotate-label.h create mode 100644 glabels2/src/wdgt-size.c create mode 100644 glabels2/src/wdgt-size.h create mode 100644 glabels2/src/wdgt-text-entry.c create mode 100644 glabels2/src/wdgt-text-entry.h create mode 100644 glabels2/src/wdgt-text-props.c create mode 100644 glabels2/src/wdgt-text-props.h create mode 100644 glabels2/src/wdgt-vector.c create mode 100644 glabels2/src/wdgt-vector.h create mode 100644 glabels2/src/xml-label.c create mode 100644 glabels2/src/xml-label.h create mode 100644 glabels2/stamp-h.in diff --git a/glabels2/AUTHORS b/glabels2/AUTHORS new file mode 100644 index 00000000..9eb13bb9 --- /dev/null +++ b/glabels2/AUTHORS @@ -0,0 +1,73 @@ +gLabels Author +============== + +Jim Evins + +Acknowledgments +=============== + +Contributors: + Akkana + nestor di -- excellent splash screen + that first appeared in + 0.4.3: + + +The GNU Barcode Library provides a large chunk of the barcode functionality +and is distributed with glabels. See ./barcode-0.98/README for more +information. The author: + + Alessandro Rubini + + +I borrowed the hacktext canvas item from libgnomeprint to render text that +is faithful to the final printed product. Original authors of the hacktext +canvas item: + + Federico Mena , + Raph Levien , + Lauris Kaplinski + + +I borrowed quite a bit of code from gedit2 to create the bonobo-mdi shell for +gLabels. The authors of gedit2: + + Paolo Maggi + Chema Celorio + James Willcox + Federico Mena Quintero + + +Translations: + + Olivier Berger -- French + Marcus Bauer -- German + Takeshi AIHANA -- Japanese + Paulo Rogério Ormenese -- Brazilian Portuguese + + +The following people have submitted label templates or information about +particular products: + + Hap + Olivier Berger + Marcus Bauer + Jochen Hein + Jonathan Buzzard + Jeff Davis + Ludger Solbach + Darren Ross + George Mitchell + Douglas Bollinger + Tim Jackson + John Stoffel + Dany De Bontridder + Andy Longton + Bostjan Muller + John Helms + no-exit + Mozilla from marela + Holger + + +And many others for their many helpful suggestions and bug reports -- thanks. diff --git a/glabels2/COPYING b/glabels2/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/glabels2/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/glabels2/INSTALL b/glabels2/INSTALL new file mode 100644 index 00000000..b42a17ac --- /dev/null +++ b/glabels2/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, 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 +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/glabels2/Makefile.am b/glabels2/Makefile.am new file mode 100644 index 00000000..74f2a8d1 --- /dev/null +++ b/glabels2/Makefile.am @@ -0,0 +1,58 @@ +## Process this file with automake to produce Makefile.in + +LIB_BARCODE_DIR = barcode-0.98 + +SUBDIRS = po src doc + +EXTRA_DIST = \ + glabels.desktop glabels.spec.in glabels.spec + +Applicationsdir = $(datadir)/gnome/apps/Applications +Applications_DATA = glabels.desktop + +pixmapdir=$(datadir)/pixmaps/glabels +configdir=$(datadir)/glabels + +install-data-local: + @$(NORMAL_INSTALL) + if test -d $(srcdir)/pixmaps; then \ + $(mkinstalldirs) $(pixmapdir); \ + for pixmap in $(srcdir)/pixmaps/*; do \ + if test -f $$pixmap; then \ + $(INSTALL_DATA) $$pixmap $(pixmapdir); \ + fi \ + done \ + fi + if test -d $(srcdir)/data; then \ + $(mkinstalldirs) $(configdir); \ + for file in $(srcdir)/data/*.template; do \ + if test -f $$file; then \ + $(INSTALL_DATA) $$file $(configdir); \ + fi \ + done \ + fi + +dist-hook: + if test -d pixmaps; then \ + mkdir $(distdir)/pixmaps; \ + for pixmap in pixmaps/*; do \ + if test -f $$pixmap; then \ + cp -p $$pixmap $(distdir)/pixmaps; \ + fi \ + done \ + fi + if test -d data; then \ + mkdir $(distdir)/data; \ + for file in data/*.template; do \ + if test -f $$file; then \ + cp -p $$file $(distdir)/data; \ + fi \ + done \ + fi + if test -d $(LIB_BARCODE_DIR); then \ + if test -f $(LIB_BARCODE_DIR)/Makefile; then \ + (cd $(LIB_BARCODE_DIR); $(MAKE) distclean); \ + fi; \ + mkdir $(distdir)/$(LIB_BARCODE_DIR); \ + cp -rp $(LIB_BARCODE_DIR)/* $(distdir)/$(LIB_BARCODE_DIR); \ + fi diff --git a/glabels2/Makefile.in b/glabels2/Makefile.in new file mode 100644 index 00000000..ccf25915 --- /dev/null +++ b/glabels2/Makefile.in @@ -0,0 +1,452 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +LIB_BARCODE_DIR = barcode-0.98 + +SUBDIRS = po src doc + +EXTRA_DIST = glabels.desktop glabels.spec.in glabels.spec + + +Applicationsdir = $(datadir)/gnome/apps/Applications +Applications_DATA = glabels.desktop + +pixmapdir = $(datadir)/pixmaps/glabels +configdir = $(datadir)/glabels +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = glabels.spec +DATA = $(Applications_DATA) + +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in \ +configure configure.in glabels.spec.in install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: +glabels.spec: $(top_builddir)/config.status glabels.spec.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +install-ApplicationsDATA: $(Applications_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(Applicationsdir) + @list='$(Applications_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(Applicationsdir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(Applicationsdir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(Applicationsdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(Applicationsdir)/$$p; \ + fi; fi; \ + done + +uninstall-ApplicationsDATA: + @$(NORMAL_UNINSTALL) + list='$(Applications_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(Applicationsdir)/$$p; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" != "." || dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: install-ApplicationsDATA install-data-local +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-ApplicationsDATA +uninstall: uninstall-recursive +all-am: Makefile $(DATA) config.h +all-redirect: all-recursive-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(Applicationsdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +uninstall-ApplicationsDATA install-ApplicationsDATA \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-local install-data-am \ +install-data install-am install uninstall-am uninstall all-redirect \ +all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +install-data-local: + @$(NORMAL_INSTALL) + if test -d $(srcdir)/pixmaps; then \ + $(mkinstalldirs) $(pixmapdir); \ + for pixmap in $(srcdir)/pixmaps/*; do \ + if test -f $$pixmap; then \ + $(INSTALL_DATA) $$pixmap $(pixmapdir); \ + fi \ + done \ + fi + if test -d $(srcdir)/data; then \ + $(mkinstalldirs) $(configdir); \ + for file in $(srcdir)/data/*.template; do \ + if test -f $$file; then \ + $(INSTALL_DATA) $$file $(configdir); \ + fi \ + done \ + fi + +dist-hook: + if test -d pixmaps; then \ + mkdir $(distdir)/pixmaps; \ + for pixmap in pixmaps/*; do \ + if test -f $$pixmap; then \ + cp -p $$pixmap $(distdir)/pixmaps; \ + fi \ + done \ + fi + if test -d data; then \ + mkdir $(distdir)/data; \ + for file in data/*.template; do \ + if test -f $$file; then \ + cp -p $$file $(distdir)/data; \ + fi \ + done \ + fi + if test -d $(LIB_BARCODE_DIR); then \ + if test -f $(LIB_BARCODE_DIR)/Makefile; then \ + (cd $(LIB_BARCODE_DIR); $(MAKE) distclean); \ + fi; \ + mkdir $(distdir)/$(LIB_BARCODE_DIR); \ + cp -rp $(LIB_BARCODE_DIR)/* $(distdir)/$(LIB_BARCODE_DIR); \ + fi + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/NEWS b/glabels2/NEWS new file mode 100644 index 00000000..e69de29b diff --git a/glabels2/README b/glabels2/README new file mode 100644 index 00000000..b7e17155 --- /dev/null +++ b/glabels2/README @@ -0,0 +1,83 @@ +Copyright +========= + + gLabels - a GNOME-based label and business card creation program + + Copyright (C) 2001-2002 Jim Evins + + 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more details see the file COPYING. + + + +What is gLabels +=============== + +gLabels is a small stand-alone program for creating labels and business +cards using a laser or ink-jet printer. + +System Requirements +=================== + +GTK+-2.0.x +LIBGNOMEUI-2.0.x +LIBXML-2.4.x +LIBGNOMEPRINT-1.115 +LIBGNOMEPRINTUI-1.115 +LIBGNOMECANVAS-2.0.x +GDK-PIXBUF-2.0.x + +All of these libraries are available as part of Gnome 2.0.1 + +Usage notes: +============ +gLabels is still in its early stages of development and thus lacks any +"real" documentation. Most folks have found it fairly easy to use, at +least for its simple composition features. Beginning with version 0.4.x, +gLabels has a document-merge capability that might not be as intuitive +as these other features. + +The first step to performing a document merge is to prepare a source +document that contains your merge data. This data could be mailing +addresses or any other data that you wish to create unique labels or +cards for. Currently only a simple back-end for text files exists -- +others are planned. The currently supported text-file format is very +simple: each line is a record; fields are delimited by tabs, +commas, or colons; and newlines can be embedded into fields by using +the "\n" entity. This file could be created using any text editor or +could be created by another program or script. + +A label must then be configured to "point at" this data file. This is +accomplished with the "merge properties" dialog. This dialog is used +to select the exact data file format and file name (location). Customized +field keys can also be defined (the default keys are the column numbers). + +Finally, once the label has been configured for a data file, field keys +can be inserted into text and barcode objects in their property dialogs. + +Now that your label is configured, gLabels will print a unique label for +each record in your source document -- substituting fields from each +record for field keys in the all text and barcode objects. + +Beginning with 0.4.3, a simple CLI front-end called "glabels-batch" is +provided to print previously created glabels files from a shell, +other programs or scripts. Do a "glabels-batch --help" for usage +information. + +Author and Acknowledgments: +=========================== + +See the AUTHORS file. diff --git a/glabels2/TODO b/glabels2/TODO new file mode 100644 index 00000000..22520259 --- /dev/null +++ b/glabels2/TODO @@ -0,0 +1,189 @@ + +Development plan +---------------- +This development plan sets a specific set of milestones for future +versions of glabels. Although subject to change, milestones leading +to version 2.0 are fairly well defined. + +Basically the goal of version 1.90 is to port all current +features/capabilities to the GNOME 2.0 platform, clean up the architecture, +and create a bonobo-mdi shell. + +The goal for version 1.92 is to improve several user interface capabilities +and add drawing capabilities. + +The goal for version 2.0 is to realize the fully developed template feature +set, add tools for creating and downloading new templates, and add inline +images to glabels files. + +The goals for version 2.2 and beyond is to add sophisticated text effects +and support vector images. + + +Detailed Outline: +----------------- + +VERSION 1.89: Development testbed for VERSION 1.90 + +VERSION 1.90: + + Architecture Design + + - Port to Gnome 2.0 Platform + + - Create a new MDI shell based on bonoboMDI (see gedit2). + + - Migrate to a more faithful MVC architecture: + - Migrate models (labels, label objects, and templates) + to real objects + - Views should track models + + Label File format changes: + - rather than + + - a label should include a template or "Sheet" tag instead + of just the name of the media type, so that obsolete names + don't render the label file useless. this should be created + and parsed by functions from the template module. + + - compatibility with old file formats + + - make sure that the format does not preclude the additions + planned in future releases and that these additions do + not break labels created with this version. Namely, image + filenames from merge data, inline images, object rotation, + object flipping, text effects, and rounded rectangles. + + Other: + - Add preferences options: + - MDI style [*] + - object defaults (colors, line widths, fonts) + + [*] These only need to be supported through gconf. + + + - Support all paper sizes that gnome-print knows about + + - Recent documents + + +VERSION 1.91: Development testbed for VERSION 1.92 + +VERSION 1.92: + + Template File format: + - Allow multiple layouts per label type. This will support + odd labels that are not layed out in a grid. For instance + one oddball label, or label laid out in a running-bond: + + +------+ +------+ + | | | | + +------+ +------+ + +------+ +------+ + | | | | + +------+ +------+ + ... + + This is not multiple label types per sheet. (see below) + + - Add invisible markup to templates, e.g. folds or other + helpful lines. + + Other: + - Status bar showing: + - % Zoom + - X, Y position + - mode and parameters (size and origin during creation) + + - Undo, Redo capability + + - Image filenames from merge fields. When adding inline + image date in the next version, this capability must + remain valid. + + - Drawing features: + - object rotation and flipping functions. + - configurable grid. Also add a "snap-to" capability. + - object alignment capabilities. + - resizing of barcodes on canvas. (Must keep barcodes + within "legal" limits) + + - Add rounding option to rectangles + + - Place property dialogs in a single dockable window (1 per + MDI/app window). Move dialogs associated with view, + when a new MDI/app window is created. + + - Change label types on-the-fly. This should probably be + some form of property of the label. Perhaps, a right-click + away from any selection. + + + +VERSION 1.93: Development testbed for VERSION 2.0 + +VERSION 2.0: + + Label File format changes: + - external images should be put inline somehow so that the + label file will not be rendered useless if on a different + machine or the original image file is renamed, moved or + deleted. + + Features: + - Create a druid for creating new label templates. + As part of the druid allow test sheets to be printed + and the new labels e-mailed to me (at the user's request). + Include a mini-preview, as the label is constructed. + + - Along those same lines, create a druid to download new + templates from a central repository, much like in GBonds. + +VERSION 2.1: Development testbed for VERSION 2.2 + +VERSION 2.2: + + Template File format: + - Allow multiple label styles per template. For instance + a sheet may contain a CD label, and cover label. This + may cause problems for document merges -- labels could be + considered grouped for document merges when their numbers + match or they could have document merge applied to them + independently but in parallel. Arrange in a tabbed + notebook, or as multiple canvases arranged in view? + + - support for the import of vector graphics formats such as EPS or SVG. + + - Text effects. (follow contour, shadows, ...) + + + +Odds and ends WISHLIST for future versions: + + - Ability to select/unselect individual records during a merge-print. + + - Add additional "merge" backends. Candidates include: + vCard + generic XML + freedb (CDDB) for CD labels + + - Capability to edit text in-place. + + - Add facility for tweaking output (origin). This should really be + part of the underlying print system but is currently difficult to + accomplish, so I may want to add the hack. + + - Make text items rich. I.e. allow multiple characteristics to + exist within a single object. + + - Add a mini style preview for barcode properties (possibly text too?). + + - Eye candy: Create a custom widget to replace spin buttons for + positioning and sizing that have arrows in the proper direction. + Really bad ASCII art: + + <- X -> + + ->||<- W |<-->| + + diff --git a/glabels2/acconfig.h b/glabels2/acconfig.h new file mode 100644 index 00000000..7e958876 --- /dev/null +++ b/glabels2/acconfig.h @@ -0,0 +1,13 @@ +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef PACKAGE +#undef VERSION +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR +#undef GETTEXT_PACKAGE +#undef HACKTEXT diff --git a/glabels2/aclocal.m4 b/glabels2/aclocal.m4 new file mode 100644 index 00000000..d406fd9d --- /dev/null +++ b/glabels2/aclocal.m4 @@ -0,0 +1,847 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN([AM_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +dnl +dnl GNOME_PLATFORM_GNOME_2(default, [force]) +dnl +dnl If the first parameter is `yes', then the default is +dnl the GNOME 2.x platform, otherwise the GNOME 1.x one. +dnl +dnl If the optional second parameter is `force', then use +dnl the default value without command line argument. +dnl + +AC_DEFUN([GNOME_PLATFORM_GNOME_2],[ + AC_REQUIRE([GNOME_REQUIRE_PKGCONFIG]) + + if test x$1 = xyes ; then + platform_gnome_2_default=yes + else + platform_gnome_2_default=no + fi + if test x$2 = xforce ; then + platform_gnome_2="$platform_gnome_2_default"; + else + AC_ARG_ENABLE(platform-gnome-2, [ --enable-platform-gnome-2 enable GNOME 2.x platform [default=no]],[platform_gnome_2="$enableval"],[platform_gnome_2="$platform_gnome_2_default"]) + fi + + AM_CONDITIONAL(PLATFORM_GNOME_2, test $platform_gnome_2 = yes) + + AC_MSG_CHECKING(for GNOME Platform) + if test $platform_gnome_2 = yes; then + AC_MSG_RESULT(GNOME 2.x) + GNOME_INTERFACE_VERSION=2 + GNOME_REQUIRE_PKGCONFIG + else + AC_MSG_RESULT(GNOME 1.x) + GNOME_INTERFACE_VERSION=1 + fi + AC_SUBST(GNOME_INTERFACE_VERSION) +]) + +dnl +dnl GNOME_CHECK_PKGCONFIG (script-if-enabled, [failflag]) +dnl +AC_DEFUN([GNOME_CHECK_PKGCONFIG],[ + AC_PATH_PROG(PKG_CONFIG, pkg-config) + have_pkgconfig=no + if test -x "$PKG_CONFIG" ; then + have_pkgconfig=yes + else + PKG_CONFIG= + fi + AC_MSG_CHECKING(for pkg-config) + pkgconfig_required_version=0.8.0 + if test x$have_pkgconfig = xyes ; then + $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version + if test $? -ne 0; then + echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + have_pkgconfig=no + fi + fi + if test x$have_pkgconfig = xyes ; then + AC_MSG_RESULT(yes) + else + PKG_CONFIG= + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR([ +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig.]) + fi + fi + AC_SUBST(PKG_CONFIG) + + AC_PROVIDE([GNOME_REQUIRE_PKGCONFIG]) +]) + +dnl +dnl GNOME_REQUIRE_PKGCONFIG +dnl +AC_DEFUN([GNOME_REQUIRE_PKGCONFIG],[ + GNOME_CHECK_PKGCONFIG([], fail) +]) + +#serial 1 +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN([AM_PROG_CC_STDC], +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + dnl ****************************** + dnl More compiler warnings + dnl ****************************** + + if test -z "$1" ; then + default_compile_warnings=no + else + default_compile_warnings="$1" + fi + + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes/maximum/error] Turn on compiler warnings.], [enable_compile_warnings="$enableval"],[enable_compile_warnings="$default_compile_warnings"]) + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall -Wunused" + ;; + yes) + warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" + ;; + maximum|error) + warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wsign-promo -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_RESULT($has_option) + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) + ;; + esac + CFLAGS="$realsave_CFLAGS" + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + AC_MSG_RESULT($warning_flags) + + AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + + WARN_CFLAGS="$warning_flags $complCFLAGS" + AC_SUBST(WARN_CFLAGS) +]) + +dnl For C++, do basically the same thing. + +AC_DEFUN([GNOME_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# Modified to never use included libintl. +# Owen Taylor , 12/15/1998 +# +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. +# +# +# If you make changes to this file, you MUST update the copy in +# acinclude.m4. [ aclocal dies on duplicate macros, so if +# we run 'aclocal -I macros/' then we'll run into problems +# once we've installed glib-gettext.m4 :-( ] +# + +# serial 5 + +AC_DEFUN(AM_GLIB_WITH_NLS, + dnl NLS is obligatory + [USE_NLS=yes + AC_SUBST(USE_NLS) + + dnl Figure out what method + nls_cv_force_use_gnu_gettext="no" + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If gettext or catgets are available (in this order) we + dnl use this. Else we have to fall back to GNU NLS library. + dnl catgets is only used if permitted by option --with-catgets. + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, + [AC_TRY_LINK([#include ], [return (int) dgettext ("","")], + gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)]) + + if test "$gt_cv_func_dgettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for dgettext in libintl], + gt_cv_func_dgettext_libintl, + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes, + gt_cv_func_dgettext_libintl=no)], + gt_cv_func_dgettext_libintl=no)]) + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + LIBS="$LIBS -lintl"; + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT,1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_CHECK_FUNCS(dcgettext) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + INSTOBJEXT=.mo + fi + fi + + # Added by Martin Baulig 12/15/98 for libc5 systems + if test "$gt_cv_func_dgettext_libc" != "yes" \ + && test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS=-lintl + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + dnl Neither gettext nor catgets in included in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" != "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [always defined to indicate that i18n is enabled]) + else + dnl Unset this variable since we use the non-zero value as a flag. + CATOBJEXT= + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLDEPS) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +AC_DEFUN(AM_GLIB_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h sys/param.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +strdup __argz_count __argz_stringify __argz_next]) + + AM_LC_MESSAGES + AM_GLIB_WITH_NLS + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl Determine which catalog format we have (if any is needed) + dnl For now we know about two different formats: + dnl Linux libc-5 and the normal X/Open format + test -d po || mkdir po + if test "$CATOBJEXT" = ".cat"; then + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) + + dnl Transform the SED scripts while copying because some dumb SEDs + dnl cannot handle comments. + sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed + fi + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 2 + +AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi + fi]) + diff --git a/glabels2/barcode-0.98/COPYING b/glabels2/barcode-0.98/COPYING new file mode 100644 index 00000000..a43ea212 --- /dev/null +++ b/glabels2/barcode-0.98/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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 of the License, 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/glabels2/barcode-0.98/ChangeLog b/glabels2/barcode-0.98/ChangeLog new file mode 100644 index 00000000..024706de --- /dev/null +++ b/glabels2/barcode-0.98/ChangeLog @@ -0,0 +1,460 @@ +2002-03-01 Alessandro Rubini + + * library.c (Barcode_Encode): handle bitsets separately, like + in Barcode_Print (otherwise, you might loose NO_CHECKSUM). + + * debian/changelog: moved to 0.98 (but should fix all debian/ stuff) + + * contrib/barcode-for-delphi.tar.gz: new, contributed by Michael Geddes + + * contrib/barcode-for-delphi.tar.gz.README: short info for file above + + * main.c (main): allow "-g" to set size of code in a table as well + -- suggested and initiallt implemented by Joachim Reichelt. + (main): fixed missing "Page: 1 1" in postscript for tables + (main): for tables don't use Encode_and_Print, use a local + unrolled version, so the default margin can be removed and + we avoid problems with negative xoff in the output phase + (first column may be offset, as noted by Karl Magnus Kolstoe) + + * doc/doc.barcode: documented change above. + + * README: removed refernces to systemy.it, I'm no more there + Added link to FreeBSD ports tree and GLabels + Organized as sections with titles + + * contrib/barcode-SVG.tar.gz: new contribution, by David J. Humphreys + + * contrib/barcode-SVG.tar.gz.README: short description of file above + + * contrib/grab-0.0.4.tar.gz: new program, by Tuukka Toivonen. + + * contrib/grab-0.0.4.tar.gz.README: short description of file above + +2002-03-01 Boszormenyi Zoltan + + * barcode.spec: new file + +2002-02-27 Alessandro Rubini + + * bookland/bookland.py: updated to version 0.92 by Judah Milgram + +2001-11-13 Alessandro Rubini + + * README: Added a pointer to the Windows port. + +2001-11-09 Cloyce D. Spradling + + * code128.c (Barcode_128b_verify): prototype fix (unsigned char). + + * ps.c (Barcode_ps_print): the comment for ascii codes must only + be printed if ascii is being printed (benign bug). + +2001-11-06 Christoph Pross + + * pcl.c (Barcode_pcl_print): bugfix: bars were misplaced + +2001-10-16 Nathan D. Holmes + + ====> Version 0.97 released to ftp.systemy.it and ftp.gnu.org + + * code93.c: new file (I modified something as well - Alessandro) + + * doc/doc.barcode (Supported Encodings): added docs for code93 + + * main.c: added code93 names + + * Makefile.in (LIBOBJECTS): added code93.o + + * library.c: added code93 entry points + +2001-10-16 Alessandro Rubini + + * doc/manpager: added (trivial) support for @itemize, added copyright + + * sample.c (main): accept -P to create PCL output + + * doc/doc.barcode (PCL Output): added the section, using text + provided by Andrea Scopece and turning it into texinfo. + Removed also a few extra newlines that made bad man pages + +2001-10-16 Andrea Scopece + + * barcode.h: added BARCODE_OUT_PCL and BARCODE_OUT_PCL_III + + * library.c (Barcode_Print): use BARCODE_OUT_PCL to select pcl_print() + + * Makefile.in (LIBOBJECTS): added pcl.o + + * pcl.c: new file, with PCL output support + +2001-10-16 Alessandro Rubini + + * doc/doc.barcode (Supported Encodings): added documentation for + EAN and UPC with checksum, as coded by mr. Böszörményi (below) + +2001-10-16 Boszormenyi Zoltan + + * ean.c: + + I found that barcode-0.96 does not correctly encodes UPC-E. + This was mainly because in upc_e_to_a() the switch() branches + all ended without "break;". + + Printing UPC-E did not print the leading encoding number and + the trailing UPC-A checksum. Now it does. + + Accept EAN-13 and EAN-8 with and without the checksum. + So always treat 7 and 12 digit sequences as valid EAN codes + and accept 8 and 13 digit sequences as valid EAN codes when + the last digit is the same as the calculated one. + + Accept UPC-A as above (11 or 12 digit sequences.) + + Accepts UPC-E as: + 6 digit sequence: the middle part of the code (leading '0' assumed) + 7 digit sequence: the middle part and either a leading '0' or '1', + or a trailing UPC-A checksum. In that case, leading '0' assumed. + 8 digit sequence: a leading '0' or '1', middle part, checksum + + UPC-A, UPC-E, EAN-13, and EAN-8 may all include + an additional barcode to the right of the main barcode. + + As a 7 or a 12 digit sequence may be ambiguous, please remember + that EAN is checked before UPC if you specified BARCODE_ANY. + +2001-08-20 Alessandro Rubini + + * sample.c (main): added upc-e and ean-8 samples + +2001-08-11 Boszormenyi Zoltan + + * ps.c (Barcode_ps_print): don't output "showpage" in EPS mode + +2001-08-11 Alessandro Rubini + + * README: Changed host names, added barcode-commit list. + +2000-11-29 Alessandro Rubini + + * doc/doc.barcode (The Field List): 1pt == 0.352mm, not 0.0352 + (thanks to Stephen Irven for reporting) + +2000-11-09 Alessandro Rubini + + ====> Version 0.96 released to ftp.systemy.it and ftp.gnu.org + + * doc/Makefile.in ($(TARGET).html): fixed bug introduced on Sep 08 + + * doc/doc.barcode (top): correctly deal with "makeinfo --html" + +2000-11-08 Alessandro Rubini + + * README: new network pointers added + + * codabar.c (Barcode_cbr_encode): don't print ascii text for the + checksum. + + * doc/doc.barcode (The Intermediate Representaion): new section + Documented the new encodings by Leonid. + Promoted two sections to chapters + Added Leonid in the AUTHORS section of the manpage. + + * Makefile.in: don't remove docs in distclean, as the distribution + now includes the docs + +2000-11-07 Alessandro Rubini + + * Makefile.in (clean): don't remove docs, do that only in distclean + + * doc/Makefile.in: a new life for the former Makefile (to build + with both gmake and pmake with features added on 2000-09-08) + + * configure.in: use $MAKE in checking for gmake if set + (to allow testing with BSD make) + Check if makeinfo can manage html, used for doc/Makefile.in + +2000-11-07 Leonid A. Broukhis + + * code128.c (Barcode_encode_as): fixed a bug that prevented F + symbols to be correctly encoded. + + * plessey.c: new file, for Plessey encoding. + + * msi.c: new file, for MSI encoding. + + * codabar.c: new file, for CodaBar encoding. + + * code128.c (Barcode_128raw_encode): new encoding + (Barcode_128raw_verify): checker for new encoding + + * barcode.h, library.c, main.c: added code128raw, codabar, + MSI and Plessey + +2000-11-07 Hans Schou + + * contrib/barcodeps-0.1.tgz: new file, sent to Alessandro on Oct 7 + +2000-10-10 Alessandro Rubini + + * doc/manpager: use gsub instead of gensub, even though it may + leas to problems with some input. This achieves compatibility + with the original awk, so gawk is not needed any more + +2000-10-02 Alessandro Rubini + + * ps.c (Barcode_ps_print): add a backslash in front of '(' too. + Suggested by H Y . + (Barcode_ps_print): use ps arrays to get compact (and prettier) + PostScript output. Suggested by Hans Schou . + + * main.c (get_geometry): accept "+offset+offset" to keep default size. + Suggested by Godmar Back . + +2000-09-16 Alessandro Rubini + + * ps.c (Barcode_ps_print): use "half text height" instead of + "two text heights" as minimum bar height. Suggested by + Oliver Vecernik . + +2000-09-14 Alessandro Rubini + + * barcode.h: added the standard ``extern "C"'' stuff for C++ + (bug reported by Dany Pardo ) + +2000-09-08 Andrea Ferraris + + * doc/Makefile: added support for pdf and html via makeinfo + + * doc/doc.barcode: added a missing trailing dot in an xref + +2000-08-28 Alessandro Rubini + + * i25.c (Barcode_i25_encode): fixed checksum calculation + (thanks to Hans Schou for reporting) + +2000-05-19 Alessandro Rubini + + ====> Version 0.95.1 released to ftp.prosa.it + + * code128.c (Barcode_128_make_array): use code C if encoding 2 digits + +2000-05-08 Alessandro Rubini + + * cmdline.c (commandline_errormsg): removed "?:" gcc extension + + * configure.in: added checks for unistd.h and strcasecmp, as + windows doesn't have them (thanks Marten Karl) + +2000-04-21 Alessandro Rubini + + * doc/Makefile: modified to build with both gmake and pmake + + * Makefile: modified to build with both gmake and pmake + +2000-04-20 Alessandro Rubini + + * Makefile.in (.depend): removed gmake-specific features. + Thanks to Jukka A. Ukkonen for reporting. + + * configure.in: detect gmake and avoid its features if not there + + * ps.c (Barcode_ps_print): fix: codes with (relatively) short bars + were enlarged in height instead of reduced in width (also + the enlarging was wrong). Thanks to Rob Seace for reporting. + +2000-04-09 Alessandro Rubini + + * code128.c (Barcode_128_encode): removed extra messages to stderr, + forgot in the code when I finished code128 support + + * doc/doc.barcode: bugfix: in the description of geometry, the unit + of measure is configurable + +2000-02-03 Alessandro Rubini + +====> Version 0.95 released to ftp.prosa.it and ftp.gnu.org + +2000-01-26 Alessandro Rubini + + * code128.c (Barcode_128_encode): new encoding: full-featured code128 + + * README: added reference to original ftp site + +2000-01-05 Alessandro Rubini + + * main.c (get_page_geometry): avoid using snprintf(), missing in HP/UX + + * code39.c (Barcode_39_verify): added missing parens (a syntax error, + but only apparent where islower() is not a macro). Thanks to + Alexandre Oliva for finding it out. + +2000-01-04 Alessandro Rubini + + * doc/doc.barcode (The API): removed spurious "flags" argument + from description of Barcode_Encode_and_Print(). + Thanks to Willy Wittesaele for noting the error. + +1999-12-24 Alessandro Rubini + + * main.c (get_geometry): fixed the y margin (thanks to Steve Kunath) + +====> Version 0.94 released to ftp.prosa.it and ftp.gnu.org + +1999-10-24 Alessandro Rubini + + * INSTALL: added instructions to install on a Debian GNU/Linux system + + * debian/*: edited information for proper Debian support + + * debian/rules (binary-arch): new file, from "deb-make" + + * Makefile.in (install): added "-m 0644" to install non-executables + + * code128.c (Barcode_128b_encode): fixed checksum calculation. + +====> Version 0.93 released to ftp.prosa.it and ftp.gnu.org + +1999-09-26 Alessandro Rubini + + * doc/doc.barcode: fixed the rendering of complex options (-g and -t) + Removed extra "table of contents" heading in the ps output + Changed attribution on cover page + + * main.c (get_table and others): be more specific in error msgs + (get_page_geometry): numeric specification is according to "-u" + (get_table): accept unsymmetric margin specification + (option_table): added "-u" to accept "cm", "mm", "in", "pt" + (get_page_geometry): bugfix: numeric spec was always consideder mm + + * cmdline.c (commandline): don't always print help + + * Makefile.in ($(INFO)): added missing dependency: distributed docs + formats were out of date with distributed doc source. + +1999-09-13 Alessandro Rubini + + * main.c (main): print tables: y used xmargin (Tim Withers,Jon Bakken) + +1999-09-06 Alessandro Rubini + + * Makefile.in: prevent -Wall when compiling getopt. + + * i25.c, ean.c, ps.c: switched to unsigned char, to prevent warnings + on newer gcc's (thanks Al Piszcz) + +====> Version 0.92 released to ftp.prosa.it and ftp.gnu.org + +1999-08-31 Alessandro Rubini + + * i25.c: the right guard was thinner than other bars + + * doc/doc.barcode: spelling and manpage fixes (thanks Joachim Schaaf) + +====> Version 0.91.4 released to ftp.prosa.it + +1999-08-23 Thad Floryan + + * main.c (strerror): replacement strerror selected by autoconf + +1999-08-06 Alessandro Rubini + + * changed all "ENODATA" in "EINVAL", as some system miss ENODATA + + * Makefile.in (all): removed ".depend" from all, as it needs gcc + + * i25.c (Barcode_i25_encode): fixed wrong free() in an unlinely path + + * ean.c (Barcode_ean_encode): don't use sprintf's result, as some + systems return a char pointer instead of the number of chars. + + * configure.in: new file, as autoconf support is being added + +====> Version 0.91.3 released to ftp.prosa.it + +1999-08-05 Alessandro Rubini + + * code128.c (Barcode_128c_encode): fixed malloc of textinfo (was short) + + * i25.c (Barcode_i25_encode): new encoding: interleaved 2 of 5 + + * ean.c (Barcode_ean_encode): enlarged static "text", to fit add-5 + + * code128.c (Barcode_128b_encode): new encoding: 128-B + +====> Version 0.91.2 released to ftp.prosa.it + +1999-08-04 Alessandro Rubini + + * bookland/bookland.py: upgraded to version 0.06 (Judas Milgram) + + * ean.c (Barcode_ean_encode): fixed layout of 1st/last digit in UPC-A + + * code128.c (Barcode_128c_encode): fixed checksum calculation + +====> Version 0.91.1 released to ftp.prosa.it + +1999-07-09 Alessandro Rubini + + * sample.c (main): due changes to show code128-C + + * code128.c (Barcode_128c_encode): implemented code 128-C + + * ps.c (Barcode_ps_print): Accept float position and font size + + * code39.c (Barcode_39_encode): reduced font (looked too big) + +====> Version 0.91 released to both ftp.prosa.it and ftp.gnu.org + +1999-07-08 Alessandro Rubini + + * ps.c (Barcode_ps_print): shrink all the bars by 0.15 points + (Barcode_ps_print): Use Helvetica as font, not Courier-Bold + (Barcode_ps_print): remember previous font to make shorter ps output + +1999-07-07 Alessandro Rubini + + * bookland/bookland.py: new enntry, by Judah Milgram. + + * ean.c (Barcode_isbn_verify): fixed bug with "-X" codes (thanks Judah) + +====> Version 0.90.3 released to ftp.prosa.it/pub/software + +1999-07-07 Alessandro Rubini + + * doc/doc.barcode: fixed the "BUGS" section (remove fixed stuff) + + * ean.c (Barcode_ean_encode): added '+' markers in partial and textinfo + + * ps.c (Barcode_ps_print): added support for text over bars ('+' mode) + +====> Version 0.90.2, internal checkpoint + +1999-07-06 Alessandro Rubini + + * Makefile: dirty autodetect of libpaper + + * main.c (get_page_geometry): parse a cmdline argument (mcm@glisco.it) + (main): added "--version" + (main): added diagnostic message for unencodable strings + +====> Version 0.90.1 released to ftp.prosa.it/pub/software + +1999-07-03 Alessandro Rubini + + * barcode.h: removed BARCODE_OUT_PG_* as only the library doesn't + need to hack with the page size. + + * ean.c (Barcode_ean_encode): supplemental 2 and 5 encodings (no text) + + * library.c: use unsigned char all over the place, to prevent warnings + +1999-07-01 Alessandro Rubini + + * ean.c: added EAN-8 and UPC-E support + + * Updated the address of the FSF in any source file + + * README: new file. + +====> Version 0.90 is the first public release. No Changelog up to now. diff --git a/glabels2/barcode-0.98/INSTALL b/glabels2/barcode-0.98/INSTALL new file mode 100644 index 00000000..5a6cb878 --- /dev/null +++ b/glabels2/barcode-0.98/INSTALL @@ -0,0 +1,31 @@ + +Installing on generic Unix systems +---------------------------------- + +The package includes both a library and a standalone program. +To install everything try + + ./configure && make && make install + +To uninstall, try + + make uninstall + +You may have problems compiling the package on non-GNUish systems, +because the tool currently uses both gmake and gawk features, and I have +no access to non-gnu systems. If your operating system isn't able to +compile barcode and you are willing to help porting, feel free to call me. + + +Installing on Debian/GNU systems +-------------------------------- + +The suggested installation here includes creation of a Debian package: + + debian/rules binary + +Then, just install using dpkg: + + dpkg -i ../barcode-0.98_*.deb + +(the "*" here will represent your architecture: "i386", "alpha", "sparc", ...) diff --git a/glabels2/barcode-0.98/Makefile.in b/glabels2/barcode-0.98/Makefile.in new file mode 100644 index 00000000..848aa265 --- /dev/null +++ b/glabels2/barcode-0.98/Makefile.in @@ -0,0 +1,141 @@ +# +# This Makefile should run fine with both pmake and gmake +# + +CC = @CC@ +CFLAGS = @CFLAGS@ @DEFS@ @NO_GETOPT@ @NO_LIBPAPER@ @NO_STRERROR@ +RANLIB = @RANLIB@ + +INSTALL = @INSTALL@ + +LDFLAGS = -L. -l$(TARGET) @LIBPAPER@ + +prefix = @prefix@ +BINDIR = $(prefix)/bin +LIBDIR = $(prefix)/lib +INCDIR = $(prefix)/include +MAN1DIR = $(prefix)/man/man1 +MAN3DIR = $(prefix)/man/man3 +INFODIR = $(prefix)/info + +# getopt may be installed or not, if not take our copy +GETOPT_O = @GETOPT_O@ + +TARGET = barcode +LIBRARY = lib$(TARGET).a +MAN1 = $(TARGET).1 +MAN3 = $(TARGET).3 +INFO = doc/$(TARGET).info +HEADER = $(TARGET).h + +LIBOBJECTS = library.o ean.o code128.o code39.o code93.o i25.o \ + msi.o plessey.o codabar.o \ + ps.o pcl.o +EXEOBJECTS = main.o cmdline.o $(GETOPT_O) +ALLSOURCES = $(LIBOBJECTS:.o=.c) $(EXEOBJECT:.o=.c) + + +#Hmm... "RM" is undefined in pmake +RM = rm + +all: $(TARGET) $(LIBRARY) $(MAN1) $(MAN3) $(INFO) sample + +$(TARGET): $(LIBRARY) $(EXEOBJECTS) + $(CC) $(CFLAGS) $(EXEOBJECTS) $(LDFLAGS) -o $(TARGET) + +sample: sample.o $(LIBRARY) + $(CC) $(CFLAGS) sample.o $(LDFLAGS) -o $@ + +# Avoid the standard CFLAGS, to avoid -Wall and -DNO_GETOPT +compat/getopt.o: compat/getopt.c + $(CC) -O -c compat/getopt.c -o $@ + +$(LIBRARY): $(LIBOBJECTS) + $(AR) r $(LIBRARY) $(LIBOBJECTS) + $(RANLIB) $(LIBRARY) + +$(MAN1) $(MAN3): doc/doc.$(TARGET) + awk -f doc/manpager doc/doc.$(TARGET) + + +# Unfortunately, pmake has no "-C". Also, "pmake -n" doesn't follow the cd. +$(INFO): doc/doc.$(TARGET) + cd doc && $(MAKE) + +install: + $(INSTALL) -d $(BINDIR) $(INCDIR) $(LIBDIR) $(MAN1DIR) \ + $(MAN3DIR) $(INFODIR) + $(INSTALL) -c $(TARGET) $(BINDIR) + $(INSTALL) -c -m 0644 $(HEADER) $(INCDIR) + $(INSTALL) -c -m 0644 $(LIBRARY) $(LIBDIR) + $(INSTALL) -c -m 0644 $(MAN1) $(MAN1DIR) + $(INSTALL) -c -m 0644 $(MAN3) $(MAN3DIR) + $(INSTALL) -c -m 0644 $(INFO) $(INFODIR) + +uninstall: + $(RM) -f $(BINDIR)/$(TARGET) + $(RM) -f $(INCDIR)/$(HEADER) + $(RM) -f $(LIBDIR)/$(LIBRARY) + $(RM) -f $(MAN1DIR)/$(MAN1) + $(RM) -f $(MAN3DIR)/$(MAN3) + $(RM) -f $(INDODIR)/$(INFO) + +#Make clean keeps the compiled documents +clean: + $(RM) -f *.o */*.o *~ */*~ $(TARGET) $(LIBRARY) + $(RM) -f $(MAN1) $(MAN3) core sample + cd doc && $(MAKE) terse + $(RM) -f .depend + +distclean: clean + if [ -f build ]; then debian/rules clean; fi + # remove the configure stuff as well + $(RM) -f Makefile config.h config.log config.status config.cache \ + doc/Makefile + +cleanest: clean + cd doc && $(MAKE) clean + +Makefile: Makefile.in configure + ./configure + +configure: configure.in + autoconf + +.depend: $(ALLSOURCES) + $(CC) $(CFLAGS) -MM $(ALLSOURCES) > $@ + +depend: .depend + +tar: + @if [ "x" = "x$(RELEASE)" ]; then \ + n=`basename \`pwd\``; cd ..; tar cvf - $$n | gzip > $$n.tar.gz; \ + echo 'you can set a numeric $$(RELEASE) to make a named tar'; \ + else \ + if [ -d ../$(TARGET)-$(RELEASE) ]; then \ + rm -rf ../$(TARGET)-$(RELEASE); \ + fi; \ + mkdir ../$(TARGET)-$(RELEASE) || exit 1; \ + cp -a . ../$(TARGET)-$(RELEASE) && cd .. && \ + tar --exclude '*/CVS*' \ + -cvzf $(TARGET)-$(RELEASE).tar.gz $(TARGET)-$(RELEASE); \ + fi + +# print the version, as I usually forget to update it when distributing +printv: + @grep -n VERSION $(HEADER) /dev/null + @grep -n set.version doc/doc.$(TARGET) /dev/null + @grep -n dpkg.-i INSTALL /dev/null + +# and this is how I make the distribution +distrib: $(INFO) distclean tar printv + + +.PHONY: all install uninstall mostlyclean clean disclean depend \ + tar printv distrib + +# Only if make is gmake, have a rule to conditionally include .depend +@GMAKEDEPEND0@ +@GMAKEDEPEND1@ +@GMAKEDEPEND2@ + diff --git a/glabels2/barcode-0.98/README b/glabels2/barcode-0.98/README new file mode 100644 index 00000000..d3ae2a7f --- /dev/null +++ b/glabels2/barcode-0.98/README @@ -0,0 +1,93 @@ + +NETWORK LINKS +============= + +This is GNU-barcode. The latest release can be downloaded from ftp.gnu.org +and mirrors: + ftp://ftp.gnu.org/pub/gnu/barcode/ + +It is also available from my own ftp/http server + ftp://ar.linux.it/pub/barcode/ + http://ar.linux.it/pub/barcode/ (same as above). + +The current source tree is available by anonymous CVS. See + http://ar.linux.it/software/#cvs + +Plesae note that ar.linux.it/pub/barcode also includes CVS snapshots, +semi-atumatically taken when I commit stuff to CVS. Note that CVS +snapshots include "CVS/" directories, so you can then "cvs update" for +further updates. + +The documentation is online at: + http://ar.linux.it/software/barcode + +The MS-Windows port is maintained at: + http://gnuwin32.sourceforge.net/packages/barcode.htm + +It as also been included in the FreeBSD ports tree in the "graphics" section. +This means /usr/ports/graphics/barcode. It's thus available from: + http://www.freebsd.org/ports/graphics.html + +GLabels, at http://snaught.com/glabels/, uses barcode internally, too. + +DESCRIPTION +=========== + +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +The package is released as both a library and a command-line frontend, +so that you can include barcode-generation into your application. The +program is released in the hope that is proves useful but without any +warranty, according to the GPL Licence (see ./COPYING). + +If you're specifically interested in making an ISBN (Bookland EAN) +symbol, you might try to get "bookland.py" by Judah Milgram +(http://www.cgpp.com/bookland/, whose version 0.92 is also included in +the directory "bookland" within this package, for your convenience). +While my main target is flexibility his main target is strict +adherence to the standards. Bookland is free software like the barcode +library and will probabily have its role in the GNU project. +Bookland.py is a self-documenting program, you'll enjoy browsing its +source code. + +Other contributed patches and/or software are available in the +contrib/ directory. + +Please take the "no-warranty" disclaimer seriously: even though I +spent reasonable efforts to make sure the output is useable in +production you should verify it suits your needs as a faulty bar can +cost you a bundle, and you'll be on your own. It's up to you to verify +that the symbol is valid (and, obviously, I'd like to know about any +problem you encounter). [This paragraph copied verbatim from bookland.py] + + +ACKNOWLEDGMENTS +=============== + +I would like to thank both Judah Milgram and Michele Comitini +(mcm@glisco.it) for their help with this tool, as well as Jim Westveer +for introducing me to Debian packaging. Several encodings have been +implemented by Leonid A. Broukhis (leob@mailcom.com). + + +MAILING LISTS +============= + +There is a mailing list where development is coordinated, called +barcode@lists.linux.it . To get subscribed you should + echo subscribe | mail barcode-request@lists.linux.it +or anything equivalent. + +To receive notification of CVS commit messages, please subscribe to +barcode-commit@ar.linux.it, by issuing: + echo subscribe | mail barcode-commit-request@ar.linux.it + +(if you guess, "ar" or "arcana" is my own server, while lists.linux.it +is the mail server of the italian association of gnu/linux users). + +/alessandro (rubini@gnu.org) + diff --git a/glabels2/barcode-0.98/TODO b/glabels2/barcode-0.98/TODO new file mode 100644 index 00000000..c91c79cf --- /dev/null +++ b/glabels2/barcode-0.98/TODO @@ -0,0 +1,23 @@ + + Possible enhancements that I'd like to add + +* verbose mode, printing position information to stderr + +* document how a new encoding standard can be added + +* add Barcode_String, which has been contributed + +* EAN128 (as agreed with Dani Pardo) + +* Postnet and associated encoding-specific bar definitions + +* Use texinfo 4 with images + +* shrink the bars to account for ink spreading + + Currently, small barcodes don't get rendered well. While + version 0.91 and later subtracts 0.15 points from the size of + the bars (I found that this makes good results for small + bars), a smart alghorithm to shrink the bars is needed to get + lighter prints at small sizes without loosing readability. + diff --git a/glabels2/barcode-0.98/barcode.h b/glabels2/barcode-0.98/barcode.h new file mode 100644 index 00000000..6b9bdf4e --- /dev/null +++ b/glabels2/barcode-0.98/barcode.h @@ -0,0 +1,119 @@ +/* + * barcode.h -- definitions for libbarcode + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _BARCODE_H_ +#define _BARCODE_H_ + +#include + +#define BARCODE_VERSION "0.98" +#define BARCODE_VERSION_INT 9800 + +/* + * The object + */ +struct Barcode_Item { + int flags; /* type of encoding and decoding */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text positioning */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ +}; + +/* + * The flags field + */ +#define BARCODE_DEFAULT_FLAGS 0x00000000 + +#define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ +#define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ +#define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ + +#define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ +#define BARCODE_OUT_EPS 0x00001000 +#define BARCODE_OUT_PS 0x00002000 +#define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ +/* PCL_III 0x00008000 */ +#define BARCODE_OUT_PCL_III 0x0000C000 +#define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ + +enum { + BARCODE_ANY = 0, /* choose best-fit */ + BARCODE_EAN, + BARCODE_UPC, /* upc == 12-digit ean */ + BARCODE_ISBN, /* isbn numbers (still EAN13) */ + BARCODE_39, /* code 39 */ + BARCODE_128, /* code 128 (a,b,c: autoselection) */ + BARCODE_128C, /* code 128 (compact form for digits) */ + BARCODE_128B, /* code 128, full printable ascii */ + BARCODE_I25, /* interleaved 2 of 5 (only digits) */ + BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ + BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ + BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ + BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ + BARCODE_93 /* code 93 (by Nathan D. Holmes) */ +}; + +#define BARCODE_DEFAULT_MARGIN 10 + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Create and destroy barcode structures + */ +extern struct Barcode_Item *Barcode_Create(char *text); +extern int Barcode_Delete(struct Barcode_Item *bc); + +/* + * Encode and print + */ +extern int Barcode_Encode(struct Barcode_Item *bc, int flags); +extern int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); + +/* + * Choose the position + */ +extern int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef); + +/* + * Do it all in one step + */ +extern int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags); + + +/* + * Return current version (integer and string) + */ +extern int Barcode_Version(char *versionname); + +#ifdef __cplusplus +} +#endif + +#endif /* _BARCODE_H_ */ diff --git a/glabels2/barcode-0.98/barcode.spec b/glabels2/barcode-0.98/barcode.spec new file mode 100644 index 00000000..eccb6026 --- /dev/null +++ b/glabels2/barcode-0.98/barcode.spec @@ -0,0 +1,84 @@ +%define name barcode +%define ver 0.98 +%define rel 1 +%define prefix /usr +%define sysconfdir /etc + +Summary: GNU barcode +Name: %name +Version: %ver +Release: %rel +Copyright: GPL +Group: Applications/Productivity +Source: ftp://ar.linux.it/pub/barcode/%name-%{ver}.tar.gz +BuildRoot: /var/tmp/%name-%{ver}-root +URL: http://gnu.systemy.it/software/barcode +Prefix: %prefix + +%description +This is GNU-barcode. +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +%package devel +Summary: GNU barcode files for development +Group: Development/Libraries + +%description devel +This is GNU-barcode. +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +This package contain the C header, the static library and man page +for development. + +%prep +%setup + +%ifarch alpha + ARCH_FLAGS="--host=alpha-redhat-linux" +%endif + +export -n LANG LINGUAS LC_ALL +if [ ! -f configure ]; then + CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh $ARCH_FLAGS --prefix=%{prefix} --sysconfdir=%{sysconfdir} +else + CFLAGS="$RPM_OPT_FLAGS" ./configure $ARCH_FLAGS --prefix=%{prefix} --sysconfdir=%{sysconfdir} +fi + +%build +export -n LANG LINGUAS LC_ALL + +if [ "$SMP" != "" ]; then + (make "MAKE=make -k -j $SMP"; exit 0) + make +else + make +fi + +%install +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{prefix} sysconfdir=$RPM_BUILD_ROOT%{sysconfdir} install + +%clean +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc COPYING ChangeLog INSTALL README TODO doc/*.html doc/*.pdf doc/*.ps + +%attr(0755,root,root) %{prefix}/bin/barcode +%attr(0644,root,root) %{prefix}/info/barcode.info* +%attr(0644,root,root) %{prefix}/man/man1/barcode.1* + +%files devel +%attr(0644,root,root) %{prefix}/include/barcode.h +%attr(0644,root,root) %{prefix}/lib/libbarcode.a +%attr(0644,root,root) %{prefix}/man/man3/barcode.3* diff --git a/glabels2/barcode-0.98/bookland/bookland.py b/glabels2/barcode-0.98/bookland/bookland.py new file mode 100644 index 00000000..373587cb --- /dev/null +++ b/glabels2/barcode-0.98/bookland/bookland.py @@ -0,0 +1,884 @@ +#!/usr/local/bin/python + +MYNAME="bookland.py" +MYVERSION="0.92" +COPYRIGHT="(C) 1999-2001 J. Milgram" +DATE = "Jan. 2002" +MAINTAINER = "bookland-bugs@cgpp.com" + +# Copyright (C) 1999,2000 Judah Milgram +# +# bookland.py - generate Bookland EAN symbol for ISBN encoding +# +# 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 +# of the License, 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., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +# +# ============================================================================== +# +# usage: bookland.py [ISBN] [price-code] > output.eps +# +# ISBN - the ISBN, with or without check digit, with or without hyphens. +# default: 1-56592-197-6 ("Programming Python"). If the check digit +# is provided on the command line, it is verified. If not, it is +# calculated. It's up to you to get the hyphenation right - it's +# important, and something the program can't calculate for you. +# +# price - the five digit add-on code. Usually used to indicate the price, +# in which case the first digit indicates the currency (4=$CAN, +# 5=$US, etc.). The remaining digits indicate the price, with +# decimal point assumed to be between the digit 3 and 4. +# For example: $US 6.95 = 50695, $CAN 35.00 = 43500. Instead of a +# price code, a 5 digit add-on ranging from 90000-98999 can be +# used for internal purposes. BISG recommends just using 90000 if +# you don't want to specify a price. Add-ons ranging from 99000 to +# 99999 have been reserved for special use. +# +# An Encapsulated Postscript file (eps) is sent to standard out. This may in turn +# be converted to other formats using the pbmplus package. You may have trouble +# getting the OCRB to map correctly. If you already have the font, you can look in +# the Fontmap file to see what your system calls it, and edit the fontnames accordingly +# (see below). If you don't have it, you might find it on your DOS system. You +# need a .pfa/.pfb (Type 1) or .ttf (TrueType). Your Postscript interpreter might +# or might not be able to deal with TrueType. In any event, in an emergency, you +# might get away with Helvetica. Note that as of 1990 BISG no longer requires the +# ISBN to be printed in OCR-A. +# +# Take the "no-warranty" disclaimer seriously. Going to print with a faulty bar +# can cost you a bundle, and you'll be on your own. It's up to you to verify that +# the symbol is valid. If you need "corporate accountability", try the Book +# Industry Study Group at (212) 929-1393 or the US ISBN Agency at (908) 665-6770 +# and ask for a list of commercial vendors. Outside the US, don't know. +# +# Feedback welcome. If you discover a case where the program generates a faulty +# symbol, I definitely want to hear about it - write me at milgram@cgpp.com or +# P.O. Box 8376, Langley Park, MD 20787, USA +# +# INSTALLATION: +# +# If you have a Python interpreter on your system, you're done. Just put this file +# somewhere in your path and give it execute permission. If you haven't installed +# Python, see http://www.python.org. It has been ported to Macs, DOS, and MS-Windows. +# +# ABOUT THE BOOKLAND EAN +# +# The most difficult part of this project was finding the documents that define +# the Bookland EAN. There appears to be no single, authoritative source that +# provides all the information required. Some good sources: +# +# [1] "Machine-Readable Coding Guidelines for the U.S. Book Industry", Book +# Industry Study Group, New York, Jan., 1992. (212) 929-1393 +# [2] "UPC Symbol Specification Manual", Uniform Code Council Inc., +# Dayton, Ohio, January 1986 (May 1995 Reprint). (937) 435-3870; I found it +# at http://www.uc-council.org/d36-t.htm +# [3] "EAN Identification for Retail/Trade Items", EAN International. I found it +# in Feb. 1999 at http://www.ean.be/html/Numbering.html +# [4] "Hyphenation Instructions", web page at: +# http://www.isbn.org/standards/home/isbn/international/hyphenation-instructions.asp +# +# The starting point of the exercise is the ISBN, assigned by the national ISBN +# Agency. This is a 10 digit number, the last being a check digit. The ISBN is +# converted to a 13 digit EAN number. The first three digits of the EAN-13 indicate +# the country or region. A prefix of 978 has been assigned to books, regardless +# of country of origin (hence, "Bookland") [3]. The remaining ten digits are the +# first 9 digits of the ISBN followed by the EAN-13 check digit. +# +# It seems the EAN-13 check digit can be calculated using the same algorithm as the +# UPC Version A number. Note that the EAN-13 check digit is always between 0 and 9, +# compare with ISBN check digit which can range to 10 ("X"). See Reference [2], +# Section 2 and Appendix G for details of creation of the EAN-13 symbol. Table 2 of +# Appendix G provides a good comparison of the UPC-A and EAN-13 symbols. +# +# The 5 digit add-on (here called, "UPC5") is defined in Ref. [2] Appendix D. +# The ">" to the right of the five digit code serves to enforce the "quiet zone" to +# the right of the bar pattern. Can't remember where I read that. It's probably +# optional. According to [1], in the UK, three horizontal bars appear over price +# add-ons. Haven't implemented that here. The UPC5 encoding is based on UPC-A and +# UPC-E. +# +# According to [2], Section 3, the EAN-13 numbers and 5-digit add-ons are supposed +# to be printed in OCR-B. The ISBN itself is printed above the EAN-13 symbol. At +# one time it was to be printed in OCR-A, but as of 1990 this requirement has been +# dropped [1], and I assume this means you can use any font you like. +# +# SEE ALSO: +# +# "TinyHelp 5 - Making ISBN Barcodes", D. Byram-Wigfield. Another approach to making +# the ISBN barcode symbol. I saw it at +# http://www.cappella.demon.co.uk/index.html/ +# but haven't tried it. +# +# "XBarcode" - nice open-source X-Windows program for generating all sorts of bar codes. +# It does much more than this program, but didn't seem to do the UPC +# 5-digit add-on or do the ISBN->EAN13 calculation (as of v. 2.11). Might +# have made more sense to add this capability, but I needed a Python project. +# In any event, their license forbids distribution in modified form! +# +# HYPHENATION +# +# bookland.py includes automatic hyphenation for ISBN's in group 0 and 1 +# (English-language). This is based on my reading of Ref [4]. If in doubt, +# users can use the "-y" option to force the program to accept the hyphenation +# as input. For other ISBN groups and for ISMN's, no hyphenation is performed +# other than to ensure a hyphen is placed after the group identifier and before +# the check digit. +# +# ABOUT THE ISMN: +# +# See the ISMN Users' Manual, 3rd Edition, 1998, ISBN 3-88053-070-X, published by +# the International ISMN Agency, Staatsbibliothek Preussischer Kulturbesitz, Berlin. +# I found my copy at http://www.ismn.spk-berlin.de/download/ISMNmanual.pdf +# +# An ISMN is just like an ISBN, except: +# - first character is an "M" +# - the "M" counts as a "3" for computing the ISMN check digit (last digit) +# - the checksum weights are 3,1,3,1,3,1,3,1,3, sum to be divisible by "10". This +# means the last character is always a numerical digit, never an "X". +# - the EAN number is "979" plus the *entire* ten character ISMN, except the +# "M" is replaced by "0". Note this means the ISMN checksum is identical to the +# corresponding EAN-13 checksum (excercise left to the reader). +# +# When bookland.py detects an "M" in the first position of the ISBN, it interprets +# it as an ISMN and proceeds accordingly. The 5-digit price code symbol is suppressed. +# +# BAR WIDTH REDUCTIONS +# +# Starting Version 0.92, the widths of the individual bars can be reduced using the +# "-r" option (units are inches). This is to compensate for bleed during printing. +# I don't know when it's a good idea to actually use this; in any event consult with +# your printer first. If not input, it defaults to zero (no reduction). +# +# ABOUT PYTHON +# +# See http://www.python.org +# +# TO DO: +# +# - Generalize to more bar codes, starting with UPC-A and UPC-E. "Plain" EAN13 is +# already built in, could add command line argument to generate that instead of +# Bookland. +# - Make font sizes and placement easier to configure - not sure I have it right. +# Does human-readable 5-digit code take wider font spacing? +# - Clean up bounding box stuff. +# - Bells and whistles. +# - GUI? +# +# HISTORY: +# +# 1/2002 - v 0.92 add ISMN support (thanks to Lars-Henrik Nysten for this suggestion) +# re-wrote bar generation to preclude possibility of white hairlines +# between adjacent black modules. Thanks to Tero Lindfors for +# reporting this bug. +# new -o option to write eps to file rather than stdout +# new -x option for "check only" (verifies check digit) +# new -r option for bar width reduction (compensate for print bleed) +# new -s option to scale module (bar) height (Lars-Henrik Nysten again) +# can suppress UPC-5 price code by entering empty string. (thanks to +# Jacques Du Pasquier for this suggestion) +# re-wrote ISBN/ISMN sanity checks +# lowercase alphas ("x" for ISBN and "m" for ISMN) now ok on input +# fix "long" command line options. +# 10/2001 - v 0.91 add -z option for quiet zone ">" +# add -f option for fonts +# re-write command line parsing to use getopt +# 1/2000 - v 0.09 eliminate use of eval +# 9/99 - v 0.08 accomodate different versions of OCRB by fitting +# all strings to prescribed width. Thanks to Toby Gadd +# for reporting this problem and Peter Deutsch for +# help finding the fix. +# 7/99 -v0.05-0.07 improve error handling. +# 3/27/99 - v0.04 add "--help" and "--version". +# 3/13/99 - v0.03, do a showpage at end (it's allowed) +# fixed checksum calculations for certain cases +# 2/7/99 - v0.02, fixed LH parity pattern for EAN13. It's not the check digit! +# 2/7/99 - initial release +# ================================================================================ + +# +# barCodeSymbol - the whole printed symbol, including bar code(s) and product code(s). +# UPC, UPCA, UPC5, EAN13 - the number itself, with check digit, string representation, +# and barcode bits +# + +import re # we should get rid of regsub and regex in favor of re + # hope there's no conflict. +import string +import sys +import regsub +from regex_syntax import * +import regex +regex.set_syntax(RE_SYNTAX_AWK) +from types import * + +BooklandError = "Something wrong" + + +A="A";B="B";C="C";O="O";E="E" +UPCABITS = [{O:"0001101",E:"1110010"}, + {O:"0011001",E:"1100110"}, + {O:"0010011",E:"1101100"}, + {O:"0111101",E:"1000010"}, + {O:"0100011",E:"1011100"}, + {O:"0110001",E:"1001110"}, + {O:"0101111",E:"1010000"}, + {O:"0111011",E:"1000100"}, + {O:"0110111",E:"1001000"}, + {O:"0001011",E:"1110100"}] +UPCAPARITY = [ "OOOOOOEEEEEE" ] * 10 +UPCEBITS = [{O:"0001101",E:"0100111"}, + {O:"0011001",E:"0110011"}, + {O:"0010011",E:"0011011"}, + {O:"0111101",E:"0100001"}, + {O:"0100011",E:"0011101"}, + {O:"0110001",E:"0111001"}, + {O:"0101111",E:"0000101"}, + {O:"0111011",E:"0010001"}, + {O:"0110111",E:"0001001"}, + {O:"0001011",E:"0010111"}] +# what about UPCEPARITY? Don't need for isbn. +UPC5BITS = UPCEBITS +UPC5PARITY = ["EEOOO","EOEOO","EOOEO","EOOOE","OEEOO", + "OOEEO","OOOEE","OEOEO","OEOOE","OOEOE"] +EAN13BITS = [{A:"0001101", B:"0100111", C:"1110010"}, + {A:"0011001", B:"0110011", C:"1100110"}, + {A:"0010011", B:"0011011", C:"1101100"}, + {A:"0111101", B:"0100001", C:"1000010"}, + {A:"0100011", B:"0011101", C:"1011100"}, + {A:"0110001", B:"0111001", C:"1001110"}, + {A:"0101111", B:"0000101", C:"1010000"}, + {A:"0111011", B:"0010001", C:"1000100"}, + {A:"0110111", B:"0001001", C:"1001000"}, + {A:"0001011", B:"0010111", C:"1110100"}] +EAN13PARITY = map(lambda x: x+"CCCCCC", + ["AAAAAA","AABABB","AABBAB","AABBBA","ABAABB", + "ABBAAB","ABBBAA","ABABAB","ABABBA","ABBABA"]) + +PSFORMAT = "%.6f" +# Default fonts. +# Fonts might have a different name on your system. +# Edit if required. +ISBNFONT = "OCRB" # Doesn't have to be OCR-B +EAN13FONT = "OCRB" +UPC5FONT = "OCRB" + +class psfile: + + def __init__(self): + self.x0 = 100; self.y0 = 100 + self.lines=[] + self.bb=[self.x0,self.y0,self.x0,self.y0] + + def orbb(self,arg): + self.bb[0] = min(self.bb[0],self.x0+arg[0]) + self.bb[1] = min(self.bb[1],self.y0+arg[1]) + self.bb[2] = max(self.bb[2],self.x0+arg[2]) + self.bb[3] = max(self.bb[3],self.y0+arg[3]) + + def translate(self,dx,dy): + self.x0 = self.x0 + dx + self.y0 = self.y0 + dy + return "%d %d translate 0 0 moveto" % (dx,dy) + + def out(self,file=None): + if file: + outfid=open(file,"w") + else: + outfid=sys.stdout + for line in self.lines: + outfid.write("%s\n"%line) + outfid.close() + + def do(self,arg): + self.lines = self.lines + arg + + def setbb(self): + for i in range(len(self.lines)): + if self.lines[i]=="%%BoundingBox: TBD": + self.lines[i]= "%%BoundingBox:" + \ + " %d"%self.bb[0] + \ + " %d"%self.bb[1] + \ + " %d"%self.bb[2] + \ + " %d"%self.bb[3] + return + + def header(self,title,comments,ean13font,isbnfont,upc5font): + for i in range(len(comments)): + comments[i] = regsub.gsub("^","% ",comments[i]) + # There's a more elegant way to do the bounding box line: + return [ "%!PS-Adobe-2.0 EPSF-1.2", + "%%Creator: " + MYNAME + " " + MYVERSION + " " + DATE, + "%%Title: " + title, + "%%BoundingBox: TBD", + "%%EndComments" ] +\ + comments + \ + [ "\n% These font names might be different on your system:", + "/ean13font { /" + ean13font + " findfont 10 scalefont setfont } def", + "/isbnfont { /" + isbnfont + " findfont 8 scalefont setfont } def", + "/upc5font { /" + upc5font +" findfont 14 scalefont setfont } def\n", + "/nextModule { moduleWidth 0 rmoveto } def", + "% The following shenanigans is to deal with different implementations", + "% of same font having different char sizes and spacing.", + "% function fitstring:", + "% usage: width string font fitstring", + "% set font, scaled so that string exactly fits desired width", + "% leave string on stack", + "/fitstring { dup findfont 1 scalefont setfont % w s f", + "3 1 roll % f w s", + "dup stringwidth pop % f w s sw", + "3 2 roll exch div % f s x", + "3 2 roll findfont exch scalefont setfont", + "} def", + "/barHeight { 72 } def", + "/nextModule { moduleWidth 0 rmoveto } def", + "/topcentershow {dup stringwidth pop neg 2 div -9 rmoveto show} def", + "/toprightshow {dup stringwidth pop neg -9 rmoveto show} def", + "/bottomcentershow {dup stringwidth pop neg 2 div 0 rmoveto show} def", + "/bottomrightshow {dup stringwidth pop neg 0 rmoveto show} def", + "/W { moduleWidth mul 0 rmoveto } def", + "/B { dup moduleWidth mul 2 div 0 rmoveto", + "dup moduleWidth mul barWidthReduction sub setlinewidth", + "0 barHeight rlineto 0 barHeight neg rmoveto", + "currentpoint stroke moveto", + "moduleWidth mul 2 div 0 rmoveto } def", + "/L { dup moduleWidth mul 2 div 0 rmoveto", + "dup moduleWidth mul barWidthReduction sub setlinewidth", + "0 -5 rmoveto 0 5 rlineto", + "0 barHeight rlineto 0 barHeight neg rmoveto", + "currentpoint stroke moveto", + "moduleWidth mul 2 div 0 rmoveto } def", + self.x0,self.y0,"translate", + "0 0 moveto" ] + + def trailer(self): + return ["stroke","% showpage supposedly OK in EPS", + "showpage","\n% Good luck!"] + + +class UPC: + + # Includes UPC-A, UPC-E, EAN-13 (sorry), UPC-5 et al. + + def __init__(self,arg): + # arg is a string, either: + # - product code including checksum + # - same, with hyphens (hyphens not verified) + # - same, but with last digit (checksum) dropped, possibly leaving a + # trailing hyphen. + # If checksum is included, it will be verified. + # N.B. "integer" representation is still a string! Just has no hyphens. + + self.s=arg + self.verifyChars(self.s) + self.n = regsub.gsub("-","",self.s) # create "integer" representation + self.x = self.checkDigit(self.n) # always calculate check digit + if len(self.n) == self.ndigits: + self.verifyCheckDigit() # if check digit given, verify it + elif len(self.n) == self.ndigits-1: + self.tackonCheckDigit() # tack on check digit + else: + raise BooklandError, "UPC: wrong number of digits in \"" + self.s + "\"" + + def setbits(self,arg): # UPC (all) + self.bits="" + parityPattern=self.parityPattern() + bitchar=self.bitchar() + for p in range(len(arg)): + digit=int(arg[p]) + # maybe better to define parityPattern with a leading blank? + parity=parityPattern[p] + bit=bitchar[digit][parity] + self.bits=self.bits + bit + + def verifyChars(self,s): # UPC (all) + # Trailing hyphen allowed. + nevergood = "--|^-|[^0-9-]" + ierr=regex.search(nevergood,s) + if ierr != -1: + raise BooklandError, \ + "UPCA: in %s: illegal characters beginning with: %s" % (s,s[ierr]) + + def verifyCheckDigit(self): # UPC (all) + # first verify correct number of digits. + soll=self.checkDigit(self.n) + ist=self.s[-1:] + if ist != soll: + raise BooklandError, "For %s checksum %s is wrong, should be %s" % \ + (self.s,ist,soll) + + def xstring(self,p): # UPC (all) + return "%d" % p + + def tackonCheckDigit(self): + self.n = self.n + self.x # UPC (all) + self.s = self.s + self.x + +class UPCA(UPC): + + def __init__(self,arg): + UPC.__init__(self,arg) + self.setbits(self.n[1:]) # skip first digit + + def parityPattern(self): + return UPCAPARITY[int(self.x)] + def bitchar(self): + return UPCABITS + + def checkDigit(self,arg): # UPCA/EAN13 + weight=[1,3]*6; magic=10; sum = 0 + for i in range(12): # checksum based on first 12 digits. + sum = sum + int(arg[i]) * weight[i] + z = ( magic - (sum % magic) ) % magic + if z < 0 or z >= magic: + raise BooklandError, "UPC checkDigit: something wrong." + return self.xstring(z) + + +class ISBN: + # Includes ISMN, if the plan falls together. + def __init__(self,arg): + self.ndigits=10 # Includes check digit! + self.s=string.upper(arg) + self.n=re.sub("[ -]","",self.s) # "integer" representation + # In ISMN, I allow spaces in place of hyphens. See ISMN User's manual. + if re.match("^M( |-)?\d(( |-)?\d){7,7}(-| )?\d?$",self.s): + # ISMN + self.name="ISMN" + self.n=re.sub("^M","3",self.n) + self.weight=[3,1,3,1,3,1,3,1,3] + self.magic=10 + elif re.match("^\d-?\d(-?\d){7,7}-?(\d|X)?$",self.s): + # ISBN + self.name="ISBN" + self.weight=[10,9,8,7,6,5,4,3,2] + self.magic=11 + else: + raise BooklandError, "%s invalid (hyphenation, characters, or length)" % self.s + self.x = self.checkDigit() + if len(self.n) == self.ndigits: + self.verifyCheckDigit() # if check digit given, verify it + elif len(self.n) == self.ndigits-1: + self.tackonCheckDigit() # tack on check digit + else: + raise BooklandError, "%s failed. Please report as bug" % self.s + + + def checkDigit(self): # ISBN and ISMN; UPCA/EAN13 similar but for weights etc. + # now that we're checking regex's in init, we don't have to check the + # argument at all. (used to check length and bad characters) + sum = 0 + for i in range(9): # checksum based on first nine digits. + sum = sum + int(self.n[i]) * self.weight[i] + z = ( self.magic - (sum % self.magic) ) % self.magic + if z < 0 or z >= self.magic: + raise BooklandError, \ + "%s: checksum %d is wrong - please report as bug" % (self.s,z) + return self.xstring(z) + + def xstring(self,p): + if p == 10: + return "X" + else: + return "%d" % p + + def tackonCheckDigit(self): + if self.s[-1:] == "-": + # Already have a trailing hyphen + self.s = self.s + self.x + else: + self.s = self.s + "-" + self.x + + def verifyCheckDigit(self): # UPC A; EAN13 + # first verify correct number of digits. + soll=self.x + ist=self.s[-1:] + if ist != soll: raise BooklandError, \ + "For %s checksum %s is wrong, should be %s\n" % (self.s,ist,soll) + +class Bar: + # a run of adjacent modules of identical value. + def __init__(self,val): + self.val=val + if not self.val in "L01": + raise BooklandError, "bar bit: %s, pls report as a bug" % self.val + self.width=1 + if self.val=="1": + self.color="Black" + elif self.val=="0": + self.color="White" + elif self.val=="L": + self.color="Long Black" + def __cmp__(self,other): + if self.val==other or (self.val=="L" and other=="1"): + return 0 + else: + return 1 + def inc(self): + self.width=self.width+1 + def pslines(self): + if self.val=="L": + rval = [ "%d L " % self.width ] + elif self.val=="1": + rval = [ "%d B " % self.width ] + else: + rval = [ "%d W " % self.width ] + return rval + def __repr__(self): + return "%s bar of width %d" % (self.color,self.width) + +class barCodeSymbol: + + def __init__(self): + self.patternWidth = len(self.bits)*self.moduleWidth + # Anything else? + + def bitsComment(self): + return [ "%% Bits:\n%% %s" % self.bits ] + + def psbars(self): + # new version, try to prevent all hairlines between adjacent modules. + bars = [] + bar=Bar(self.bits[0]) + for bit in self.bits[1:]: + if bit==bar: + bar.inc() + else: + bars.append(bar) + bar=Bar(bit) + bars.append(bar) + rval = ["0 0 moveto"] + for bar in bars: + rval = rval + bar.pslines() + rval = rval + [ "stroke" ] + return rval + + def psbarsold(self): + psbits=regsub.gsub("1","I ",self.bits) + psbits=regsub.gsub("0","O ",psbits) + psbits=regsub.gsub("L","L ",psbits) + linewidth=50 + p=0; j=linewidth; m=len(psbits); psbarlines=[]; blanks="^ | $" + while p <= m: + j = min(linewidth,m-p) + psbarlines = psbarlines + [ regsub.gsub(blanks,"",psbits[p:p+j]) ] + p=p+linewidth + return [ "0 0 moveto" ] + psbarlines + [ "stroke" ] + + def psSetBarHeight(self): + return [ "/barHeight { " + PSFORMAT % self.moduleHeight + " 72 mul } def" ] + + def psSetBarWidthReduction(self): + return [ "/barWidthReduction { " + \ + PSFORMAT % self.barWidthReduction + " 72 mul } def" ] + + def psSetModuleWidth(self): + rval = [ "/moduleWidth { " + PSFORMAT % self.moduleWidth + " 72 mul } def" ] + return rval + + def psBottomRightText(self,text,font): + # this is specifically for the upc5 price code. + # this is all starting to get messy. + return [ PSFORMAT % self.patternWidth + " 72 mul dup 2 div", + PSFORMAT % self.moduleHeight + " 72 mul 2 add moveto", + "(" + text + ") /" + font + " fitstring bottomcentershow" ] + + def psTopCenterText(self,text,font): + # the text at the top center of the bar pattern (i.e. the ISBN) + return [ PSFORMAT % self.patternWidth + " 72 mul dup 2 div", + PSFORMAT % self.moduleHeight + " 72 mul 3 add moveto", + " (" + text + ") /" + font + " fitstring bottomcentershow" ] + + def psFittedText(self,width,text,font): + return [ PSFORMAT % width + " (" + text + ") " + font + " fitstring" ] + + # This is optional; serves to enforce quiet zone to right of UPC 5 add-on + def psGreaterThan(self,font): + return [ PSFORMAT % self.patternWidth + " 72 mul", + PSFORMAT % self.moduleHeight + " 72 mul 2 add moveto", + "/%s (>) show" % font ] + +class EAN13Symbol(barCodeSymbol): + + def __init__(self,arg,font=EAN13FONT,heightMultiplier=1,barWidthReduction=0): + # arg is a string with the EAN product code + self.barWidthReduction=barWidthReduction + self.ean13 = EAN13(arg) + self.moduleWidth = 0.0130 + specModuleHeight = 1.00 + self.moduleHeight = 1.00 * heightMultiplier + self.bits = self.ean13.bits + barCodeSymbol.__init__(self) + self.font=font + + def bb(self): + return [ -12, -10, self.patternWidth*72+10, self.moduleHeight*72+12 ] + + def pslines(self): + return self.bitsComment() + \ + self.psSetModuleWidth() + \ + self.psSetBarWidthReduction() + \ + self.psSetBarHeight() + \ + self.psbars() + \ + self.psLRDigitLines() + + def psLRDigitLines(self): + # 24 = 3+6*7/2 + # 70 = 3+6*7+4+6*7/2 "4" so we center on the "L" bars (the rightmost of + # the center guard bars is an "O". + # "5" in check digit is the five-module spacing recommended by [2], section 3. + return [ "% We do the left digits first and leave the font scaled", + "% as is for the 9-digit and the right-digits.", + "% EAN13 Left Digits:", + "moduleWidth 24 mul 0 moveto", + "moduleWidth 40 mul (" + self.ean13.leftDigits + ") ", + "/" + self.font + " fitstring topcentershow", + "\n% EAN13 human-readable number", + "% The \"9\" digit (only when encoding ISBN's and ISMN's, I think):", + "-5 0 moveto (" + self.ean13.n[0] + ") toprightshow", + "% EAN13 Right Digits:", + "moduleWidth 70 mul 0 moveto", + "moduleWidth 40 mul (" + self.ean13.rightDigits + ") topcentershow" ] + +class EAN13(UPCA): + + def __init__(self,arg): + self.ndigits=13 # Includes check digit! + UPCA.__init__(self,arg) + leftBits = self.bits[0:42] + rightBits = self.bits[42:] + leftGuard="L0L" + rightGuard="L0L" + center="0L0L0" + self.bits = leftGuard + leftBits + center + rightBits + rightGuard + self.leftDigits = self.n[1:7] + self.rightDigits = self.n[7:13] + + def parityPattern(self): + # N.B. parity pattern based on leftmost digit, the UCC Spec calls this + # the "13th" digit. It's not the check digit! + return EAN13PARITY[int(self.n[0])] + def bitchar(self): + return EAN13BITS + +class UPC5Symbol(barCodeSymbol): + + def __init__(self,arg,heightMultiplier=1,barWidthReduction=0): + # arg is a string with the 5 digit add-on. + self.barWidthReduction=barWidthReduction + self.upc5 = UPC5(arg) + self.moduleWidth = 0.0130 + specModuleHeight = 0.852 + self.moduleHeight = 0.852 * heightMultiplier + self.bits = self.upc5.bits + barCodeSymbol.__init__(self) + + def pslines(self): + return self.bitsComment() + \ + self.psSetModuleWidth() + \ + self.psSetBarHeight() + \ + self.psbars() + + def bb(self): + # Note quiet zone is there even if we don't print the ">". + return [ 0, 0, self.patternWidth*72+10, self.moduleHeight*72+10 ] + +UPC5Error = "Something wrong with 5-digit price code add-on." +class UPC5(UPC): + + def __init__(self,arg): + self.ndigits=5 # Includes check digit! + p=re.search("[^0-9]",arg) + if p: + badchar=arg[p.start()] + raise UPC5Error, "\"%s\" is wrong. The character \"%s\" is not allowed. Price code add-on should contain %d digits and nothing else. Or leave blank to suppress the UPC-5 code." % (arg,badchar,self.ndigits) + elif len(arg) != self.ndigits: + raise UPC5Error, \ + "\"%s\" is wrong. Price code add-on should have exactly %d digits." % (arg,self.ndigits) + UPC.__init__(self,arg) + self.setbits(self.n) + leftGuard="1011" + # no right guard for UPC 5-digit add-on + # Have to insert pesky delineators: + delineator = "01" + self.bits = leftGuard + \ + self.bits[0:7] + delineator + \ + self.bits[7:14] + delineator + \ + self.bits[14:21] + delineator + \ + self.bits[21:28] + delineator + \ + self.bits[28:35] + + def checkDigit(self,arg): # UPC5 + weight=[3,9,3,9,3]; sum = 0 + for i in range(5): + sum = sum + int(arg[i]) * weight[i] + return self.xstring(sum % 10) + + def verifyCheckDigit(self): # UPC2/5 checksum not in number + return + + def parityPattern(self): + return UPC5PARITY[int(self.x)] + def bitchar(self): + return UPC5BITS + +class bookland(barCodeSymbol): + + def __init__(self,isbn,price="",*rest): + + + # Some defaults: + ean13font=EAN13FONT + isbnfont=ISBNFONT + upc5font = UPC5FONT + zone=None + heightMultiplier=1.0 + commandLine="" + barWidthReduction=0 + + # Maybe different fonts: + if len(rest)>0: + font=rest[0] + if font: + ean13font=font + isbnfont=font + upc5font=font + if len(rest)>1: + zone=rest[1] + if len(rest)>2: + heightMultiplier=float(rest[2]) + if len(rest) > 3: + commandLine=rest[3] + if len(rest) > 4: + barWidthReduction=float(rest[4]) + + # Initial setup: + + self.ps = psfile() + self.isbn = ISBN(isbn) + + # Header, EAN13 bars, EAN13 number, and ISBN: + + if self.isbn.name=="ISMN": + self.ean13Symbol = EAN13Symbol("9790"+self.isbn.n[1:9],ean13font,heightMultiplier,barWidthReduction) + elif self.isbn.name=="ISBN": + self.ean13Symbol = EAN13Symbol("978"+self.isbn.n[:9],ean13font,heightMultiplier,barWidthReduction) + else: + raise BooklandError, "Internal error doing %s, please report as bug" % isbn + + self.ps.orbb(self.ean13Symbol.bb()) + comments = ["", + " This is free software and comes with NO WARRANTY WHATSOVER", + " Think twice before going to press with this bar code!", + "", + "Command line: %s" % commandLine, + "" ] + self.ps.lines = self.ps.header(self.isbn.s,comments,ean13font,isbnfont,upc5font) + \ + [ "ean13font" ] + \ + self.ean13Symbol.pslines() +\ + [ "isbnfont" ] + \ + self.ean13Symbol.psTopCenterText("%s %s" % (self.isbn.name,self.isbn.s),isbnfont) + + # 5-digit add-on: (optional for ISBN only) + BLANK=re.compile("^ *$") + if self.isbn.name=="ISBN" and not BLANK.match(price): + # 105 = 95 + 10; 10 = separation (min is 9) + translate=[ self.ps.translate( self.ean13Symbol.moduleWidth * 72 * 105, 0 ) ] + self.upc5Symbol = UPC5Symbol(price,heightMultiplier,barWidthReduction) + self.ps.orbb(self.upc5Symbol.bb()) + self.ps.lines = self.ps.lines + \ + translate + \ + self.upc5Symbol.pslines() + \ + [ "upc5font" ] +\ + self.upc5Symbol.psBottomRightText(price,upc5font) + if zone: self.ps.lines=self.ps.lines + self.upc5Symbol.psGreaterThan(upc5font) + else: + self.ps.lines.append("%% Skipping UPC-5 price code symbol per request") + + self.ps.lines=self.ps.lines + self.ps.trailer() + + # Can now set bounding box. + + self.ps.setbb() + +# Here we go ... + +if __name__ == '__main__': + + def printUsage(): + print "Usage: bookland [-h|--help] [-v|--version] [-x|--check] [-f|--font=] [-s|--height=] [-r|--reduction=] [-o|outfile=] [-z|--quietzone] [| ]" + print "Report bugs to " + MAINTAINER + + def printVersion(): + sys.stderr.write("%s version %s %s.\n" % (MYNAME,MYVERSION,COPYRIGHT)) + sys.stderr.write("Bugs to %s\n" % MAINTAINER) + sys.stderr.write("This is free software and comes with NO WARRANTY\n") + + import getopt + try: + opts,args = getopt.getopt(sys.argv[1:], + "xr:s:uvf:hzo:", + ["reduction=","outfile=","height=","noupc", + "check","version","help","font=","quietzone"]) + except: + printUsage() + sys.exit(0) + + # some initial defaults: + isbn = "1-56592-197-6" # Mark Lutz, "Programming Python", + # O'Reilly, Sebastopol CA, 1996 + price = "90000" + font=None + zone=None + checkonly=None + outfile=None + heightMultiplier=1 + commandLine = string.join(sys.argv) + barWidthReduction = 0 + + # parse command line: + for opt,val in opts: + if opt in ("-v","--version"): + printVersion() + sys.exit(0) + elif opt in ("-h","--help"): + printUsage() + sys.exit(0) + elif opt in ("-f","--font"): + font=val + elif opt in ("-z","--quietzone"): + zone=1 + elif opt in ("-x","--check"): + checkonly=1 + elif opt in ("-s","--height"): + heightMultiplier = float(val) + elif opt in ("-r","--reduction"): + barWidthReduction = val + elif opt in ("-o","--outfile"): + outfile=val + if len(args)==1: + isbn=args[0] + elif len(args)==2: + isbn=args[0] + price=args[1] + + # Do stuff. + + printVersion() + try: + b = bookland(isbn,price,font,zone,heightMultiplier, + commandLine,barWidthReduction) + if not checkonly: b.ps.out(outfile) + if outfile: + sys.stderr.write("Output written to %s\n" % outfile) + except BooklandError, message: + sys.stderr.write(BooklandError + ": " + message + "\n") + sys.exit(1) diff --git a/glabels2/barcode-0.98/cmdline.c b/glabels2/barcode-0.98/cmdline.c new file mode 100644 index 00000000..a69a825b --- /dev/null +++ b/glabels2/barcode-0.98/cmdline.c @@ -0,0 +1,177 @@ +/* + * cmdline.c -- parse a command line using getopt, environment and defaults + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Changes: + * Michele Comitini (mcm@glisco.it): better handling of numeric type args. + */ + +#include +#include +#include + +#ifdef NO_GETOPT + /* use replacement */ + #include "compat/getopt.h" +#else + #include +#endif + +#include "cmdline.h" + +/* In case of error, print help string and return error (-1) */ +int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead) +{ + char *buffer; + char *buffer2; + int len; + struct commandline *ptr; + + if (!messagehead) { + fprintf(f,"%s: Error in cmdline\nPossible options:\n",prgname); + } else { + fprintf(f,"%s: %s",prgname,messagehead); + } + + for (ptr = args; ptr->option; ptr++) { + if (ptr->descrip) { + len = strlen(ptr->descrip); + len += ptr->default_v ? strlen(ptr->default_v) : 6; + len += ptr->env ? strlen(ptr->env) : 6; + buffer2 = malloc(len+3); /* 3 to be safe :) */ + len += 32; + if (buffer2) { + buffer = malloc(len); + if (buffer) { + sprintf(buffer2, ptr->descrip, + ptr->default_v ? ptr->default_v : "(none)", + ptr->env ? ptr->env : "(none)"); + sprintf(buffer, " -%c %s %s", ptr->option, + ptr->type ? "" : " ", buffer2); + fprintf(f, "%s\n",buffer); + free(buffer); + } + free(buffer2); + } + } + } + return -1; +} + +/* + * Associate formats to type. + */ +struct type_fmt { + enum option_type type; + char *fmt; +}; +static struct type_fmt formats[] = { + {CMDLINE_I, "%i%s"}, /* the trailing "%s" is used for error check */ + {CMDLINE_D, "%d%s"}, + {CMDLINE_X, "%x%s"}, + {CMDLINE_O, "%o%s"}, + {CMDLINE_F, "%lf%s"}, + {CMDLINE_P, "%p%s"}, + {0, NULL} /* If we get here, it's CMDLINE_S: no sscanf buf strcpy() */ +}; + + +/* Parse one argument (default or provided) */ +static int commandline_oneopt(struct commandline *ptr, char *value) +{ + struct type_fmt *tptr; + char *trash = value ? strdup(value) : NULL; + + /* convert it, if needed */ + if ((ptr->type != CMDLINE_NONE) && ptr->result) { + for (tptr = formats; tptr->type; tptr++) + if (tptr->type == ptr->type) + break; + if (!tptr->type) /* not found: it is a string */ + *(char **)(ptr->result) = value; + else + if (sscanf(value, tptr->fmt, ptr->result, trash)!=1) { + free(trash); + return -1; + } + } + if (trash) + free(trash); + + if ((ptr->type == CMDLINE_NONE) && ptr->result) /* no type, just count */ + (*(int *)(ptr->result))++; + + /* call the function, if needed */ + if (ptr->fun) { + if (ptr->type) { + if (ptr->result) return ptr->fun(ptr->result); /* converted */ + return ptr->fun(value); /* type, but not converted */ + } + return ptr->fun(NULL); /* no type: just call it */ + } + return 0; +} + +/* The main function */ +int commandline(struct commandline *args, int argc, char **argv, + char *errorhead) +{ + struct commandline *ptr; + char *getopt_desc = (char *)calloc(512, 1); + int desc_offset = 0; + int opt, retval; + char *value; + + /* Build getopt string and process defaults values */ + for (ptr = args; ptr->option; ptr++) { + getopt_desc[desc_offset++] = ptr->option; + if (ptr->type) getopt_desc[desc_offset++] = ':'; + + value = NULL; + if (ptr->env) + value = getenv(ptr->env); + if (!value) + value = ptr->default_v; + if (value && (retval = commandline_oneopt(ptr, value))) { + /* + * if the function returns a specific (not -1) value, it already + * printed its message, so avoid the generic help + */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + + /* Run getopt and process material */ + while ((opt = getopt(argc, argv, getopt_desc)) != -1) { + for (ptr = args; ptr->option; ptr++) + if (opt == ptr->option) + break; + if (!ptr->option) /* unknown option */ + return commandline_errormsg(stderr, args, argv[0], errorhead); + if ( (retval = commandline_oneopt(ptr, optarg)) ) { /* wrong arg */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + return 0; +} diff --git a/glabels2/barcode-0.98/cmdline.h b/glabels2/barcode-0.98/cmdline.h new file mode 100644 index 00000000..69319915 --- /dev/null +++ b/glabels2/barcode-0.98/cmdline.h @@ -0,0 +1,58 @@ +/* + * cmdline.h -- generic commandline editing (uses getopt, only short) + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* + * The options may have different arguments of different type + */ +enum option_type { + CMDLINE_NONE=0, /* no argument after option */ + CMDLINE_I, /* integer (any base) */ + CMDLINE_D, /* decimal integer */ + CMDLINE_X, /* hex integer */ + CMDLINE_O, /* octal integer */ + CMDLINE_S, /* string */ + CMDLINE_F, /* double float */ + CMDLINE_P, /* pointer */ +}; + + +struct commandline { + int option; /* Single byte: option id */ + int type; /* Type of argument, used in sscanf */ + void *result; /* Store data here, if non null */ + int (*fun)(void *); /* Call if defined: arg is "result" or input string */ + char *env; /* Where to get runtime defaults, may be NULL */ + char *default_v; /* The compile-time default, may be NULL */ + char *descrip; /* For err msg. May have %s's for default and env */ +}; + +/* returns: 0 or -1. "optarg" is global (see getopt) */ +extern int commandline(struct commandline *args, + int argc, char **argv, char *errorhead); + +/* prints an error message based on "args" */ +extern int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead); + + + + diff --git a/glabels2/barcode-0.98/codabar.c b/glabels2/barcode-0.98/codabar.c new file mode 100644 index 00000000..7065b9ea --- /dev/null +++ b/glabels2/barcode-0.98/codabar.c @@ -0,0 +1,182 @@ +/* + * codabar.c -- encoding for Codabar + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "-$:/.+ABCD"; + +#define CODE_A 16 +#define CODE_B 17 + +#define NARROW 12 +#define WIDE 14 + +/* Patterns */ +static char *patterns[] = { +"1111133","1111331","1113113","3311111","1131131", +"3111131","1311113","1311311","1331111","3113111", +"1113311","1133111","3111313","3131113","3131311", +"1131313","1133131","1313113","1113133","1113331" }; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it. + * If the first character is a letter (A to D), the last one must be too; + * no other character should be a letter. + */ +int Barcode_cbr_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + int startpresent = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + char * pos; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + pos = strchr(alphabet,toupper(text[i])); + if (!pos) + return -1; + if (i == 0 && pos - alphabet >= CODE_A) + startpresent = 1; + else if (pos - alphabet >= CODE_A && + (!startpresent || i != strlen(text) - 1)) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr,"1%s", /* separator */ patterns[code]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_cbr_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0, startpresent; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("codabar"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 8 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen + check) +term */ + textinfo = malloc(10*(strlen(text) + 1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + ptr = partial; + textptr = textinfo; + textpos = 0; + usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1; + /* if no start character specified, A is used as a start character */ + if (!isalpha(text[0])) { + add_one(ptr, CODE_A); + ptr += strlen(ptr); + textpos = WIDE; + checksum = CODE_A; + startpresent = 0; + } else { + startpresent = 1; + } + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + textpos += code < 12 ? NARROW : WIDE; + textptr += strlen(textptr); + ptr += strlen(ptr); + checksum += code; + if (startpresent && usesum && i == strlen(text) - 2) { + /* stuff a check symbol before the stop */ + c = strchr(alphabet, toupper(text[i+1])); + if (!c) /* impossible */ + continue; + code = c - alphabet; + checksum += code; + + /* Complement to a multiple of 16 */ + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + } + if (!startpresent) { + if (usesum) { + /* if no start character specified, B is used as a stop char */ + checksum += CODE_B; + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + add_one(ptr, CODE_B); + } + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/code128.c b/glabels2/barcode-0.98/code128.c new file mode 100644 index 00000000..cebba54c --- /dev/null +++ b/glabels2/barcode-0.98/code128.c @@ -0,0 +1,607 @@ +/* + * code128.c -- encoding for code128 (A, B, C) + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char *codeset[] = { + "212222", "222122", "222221", "121223", "121322", /* 0 - 4 */ + "131222", "122213", "122312", "132212", "221213", + "221312", "231212", "112232", "122132", "122231", /* 10 - 14 */ + "113222", "123122", "123221", "223211", "221132", + "221231", "213212", "223112", "312131", "311222", /* 20 - 24 */ + "321122", "321221", "312212", "322112", "322211", + "212123", "212321", "232121", "111323", "131123", /* 30 - 34 */ + "131321", "112313", "132113", "132311", "211313", + "231113", "231311", "112133", "112331", "132131", /* 40 - 44 */ + "113123", "113321", "133121", "313121", "211331", + "231131", "213113", "213311", "213131", "311123", /* 50 - 54 */ + "311321", "331121", "312113", "312311", "332111", + "314111", "221411", "431111", "111224", "111422", /* 60 - 64 */ + "121124", "121421", "141122", "141221", "112214", + "112412", "122114", "122411", "142112", "142211", /* 70 - 74 */ + "241211", "221114", "413111", "241112", "134111", + "111242", "121142", "121241", "114212", "124112", /* 80 - 84 */ + "124211", "411212", "421112", "421211", "212141", + "214121", "412121", "111143", "111341", "131141", /* 90 - 94 */ + "114113", "114311", "411113", "411311", "113141", + "114131", "311141", "411131", "b1a4a2", "b1a2a4", /* 100 - 104 */ + "b1a2c2", "b3c1a1b" +}; + +#define START_A 103 +#define START_B 104 +#define START_C 105 +#define STOP 106 +#define SHIFT 98 /* only A and B */ +#define CODE_A 101 /* only B and C */ +#define CODE_B 100 /* only A and C */ +#define CODE_C 99 /* only A and B */ +#define FUNC_1 102 /* all of them */ +#define FUNC_2 97 /* only A and B */ +#define FUNC_3 96 /* only A and B */ +/* FUNC_4 is CODE_A when in A and CODE_B when in B */ + +#define SYMBOL_WID 11 /* all of them are 11-bar wide */ + +/* + * code 128-b includes all printable ascii chars + */ + +int Barcode_128b_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && *text>=32 && !(*text&0x80)) + text++; + if (*text) + return -1; /* a non-ascii char */ + return 0; /* ok */ +} + +int Barcode_128b_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128-B"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + /* up to now, it was the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_B]); + checksum += START_B; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = text[i]-32; + strcat(partial, codeset[code]); + checksum += code * (i+1); /* first * 1 + second * 2 + third * 3... */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + +/* + * code 128-c is only digits, but two per symbol + */ + +int Barcode_128c_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + /* must be an even number of digits */ + if (strlen(text)%2) + return -1; + /* and must be all digits */ + for (; *text; text++) + if (!isdigit(*text)) + return -1; + return 0; +} + +int Barcode_128c_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128-C"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 3) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * strlen +term */ + textinfo = malloc(12*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_C]); + checksum += START_C; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; text[i]; i+=2) { + if (!isdigit(text[i]) || !isdigit(text[i+1])) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = (text[i]-'0') * 10 + text[i+1]-'0'; + strcat(partial, codeset[code]); + checksum += code * (i/2+1); /* first * 1 + second * 2 + third * 3... */ + + /* print as "%s", because we have ".5" positions */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, text[i], + textpos + (double)SYMBOL_WID/2, text[i+1]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + +/* + * generic (full-featured) code128 implementation: it selects between + * A, B, C according to the data being encoded. F1, F2, F3, F4 are expressed + * using ascii chars 0xc1, 0xc2, 0xc3, 0xc4 (0301, 0302, 0303, 0304). + * Char '\0' is expressed by 0x80 (0200). + */ + +int Barcode_128_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && (*text<=0x80 || (*text >= 0xc1 && *text <= 0xc4))) + text++; + if (*text) + return -1; /* unencodable character */ + return 0; /* ok */ +} + + +/* + * These functions are extracted from Barcode_128_encode for clarity. + * It deals with choosing the symbols used to represent the text + * and returns a dynamic array of integers, terminated by -1. + * + * The algorithm used in choosing the codes comes from App 2 of + * "El Codigo Estandar EAN/UCC 128", courtesy of AECOC, Spain. + * Thanks to Dani Pardo for getting permission and giving me a copy + * of the document + */ + +#define NEED_CODE_A(c) ((c)<32 || (c)==0x80) +#define NEED_CODE_B(c) ((c)>=96 && (c)<128) + +static int Barcode_a_or_b(unsigned char *text) +{ + for ( ; *text; text++) { + if (NEED_CODE_A(*text)) + return 'A'; + if (NEED_CODE_B(*text)) + return 'B'; + } + return 0; /* any */ +} + +/* code is either 'A' or 'B', and value must be valid */ +static int Barcode_encode_as(int code, int value) +{ + + /* first check the special chars */ + if (value == 0xC1) return FUNC_1; + if (value == 0xC2) return FUNC_2; + if (value == 0xC3) return FUNC_3; + if (value == 0xC4) { /* F4 */ + if (code == 'A') return CODE_A; + return CODE_B; + } + + /* then check ascii values */ + if (value >= 0x20 && value <= 0x5F) + return value - 0x20; /* both codes */ + if (value == 0x80) return 64; /* code A */ + if (value < 0x20) return value+64; /* code A */ + if (value >= 0x60) return value - 0x20; /* code B */ + /* can't happen */ + return -1; +} + +static int *Barcode_128_make_array(struct Barcode_Item *bc, int *lptr) +{ + int len, *codes; + unsigned char *s; + int i=0, j, code, checksum; + + /* allocate twice the text length + 5, as this is the worst case */ + len = 2 * strlen(bc->ascii) + 5; + codes = malloc(len * sizeof(int)); + s = bc->ascii; + + /* choose the starting code */ + if (s[2]=='\0' && isdigit(s[0]) && isdigit(s[1])) { + code = 'C'; + } else if (isdigit(s[0])&&isdigit(s[1]) && isdigit(s[2])&&isdigit(s[3])) { + code = 'C'; + } else { + code = Barcode_a_or_b(s); + if (!code) code = 'B'; /* default */ + } + codes[i++] = START_A + code - 'A'; + + for (s = bc->ascii; *s; /* increments are in the loop */) { + switch(code) { + + case 'C': + if (s[0] == 0xC1) { /* F1 is valid */ + codes[i++] = FUNC_1; + s++; + } else if (isdigit(s[0]) && isdigit(s[1])) { + /* encode two digits */ + codes[i++] = (s[0]-'0') * 10 + s[1]-'0'; + s += 2; + } else { + /* change code */ + code = Barcode_a_or_b(s); + if (!code) code = 'B'; + codes[i++] = (code == 'A') ? CODE_A : CODE_B; + } + break; + + case 'B': + case 'A': + for (j=0; isdigit(s[j]); j++) + ; + if (j>=4) { /* if there are 4 or more digits, turn to C */ + if (j&1) { + /* odd number: encode one first */ + codes[i++] = *(s++) - ' '; + } + codes[i++] = CODE_C; + code = 'C'; + } else if (code == 'A' && NEED_CODE_B(*s)) { + /* check whether we should use SHIFT or change code */ + j = Barcode_a_or_b(s+1); + if (j == 'B') { + codes[i++] = CODE_B; + code = 'B'; + } else { + codes[i++] = SHIFT; + codes[i++] = Barcode_encode_as('B', *s); + s++; + } + } else if (code == 'B' && NEED_CODE_A(*s)) { + /* check whether we should use SHIFT or change code */ + j = Barcode_a_or_b(s+1); + if (j == 'A') { + codes[i++] = CODE_A; + code = 'A'; + } else { + codes[i++] = SHIFT; + codes[i++] = Barcode_encode_as('A', *s); + s++; + } + } else { + codes[i++] = Barcode_encode_as(code, *s); + s++; + } + break; + } + } + /* add the checksum */ + checksum = codes[0]; + for (j=1; j len) { + fprintf(stderr, "impossible: length is > allocated len\n"); + } + *lptr = i; + return codes; +} + +/* + * Encoding is tricky, in that we cannot print the ascii + * representation in an easy way. Therefore, just skip non-printable + * chars and try to fit the rest somehow. + */ +int Barcode_128_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int *codes; /* dynamic */ + int i, c, len; + double textpos, size, step; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + codes = Barcode_128_make_array(bc, &len); + if (!codes) return -1; + + /* the partial code is 6*codelen + ini + term (+margin) */ + partial = malloc( 6 * len + 4); + if (!partial) { + bc->error = errno; + free(codes); + return -1; + } + + /* the text information is at most "nnn.n:ff.f:c " * strlen +term */ + textptr = textinfo = malloc(13*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(codes); + return -1; + } + + /* up to now, it was almost the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + for (i=0; i 12.0) size = 12.0; + + /* align the text to the left, using its natural size */ + step = (int)(10 * (size/18.0 * SYMBOL_WID) + .5) / 10.0; + textpos = SYMBOL_WID; + + for (i=0; i 0xc0) c = ' '; /* F code */ + sprintf(textptr, "%g:%g:%c ", textpos, size, c); + textptr += strlen(textptr); + textpos += step; + } + + bc->partial = partial; + bc->textinfo = textinfo; + free(codes); + return 0; +} + +/* + * A raw 128 code is given as a sequence of space separated numbers + * from 0 to 105, starting from the start code to be (Leonid) + */ + +int Barcode_128raw_verify(unsigned char *text) +{ + int n; + unsigned val; + + if (!strlen(text)) + return -1; + while (*text) { + if (sscanf(text, "%u%n", &val, &n) < 1) + return -1; + if (val > 105) + return -1; + text += n; + } + return 0; +} + +int Barcode_128raw_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, n, count, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("128raw"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* + * length of partial code is unknown in advance, but it is + * at most 6* (1+text/2 + check + tail) + final + terminator + */ + partial = malloc( (3+ strlen(text)/2) * 6 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * 1+strlen/2 +term */ + textinfo = malloc(12 * (1+strlen(text)/2) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + textptr = textinfo; + textpos = 0; + + for (i=0, count = 0; i < strlen(text); count++) { + if (sscanf(text + i, "%u%n", &code, &n) < 1) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + strcat(partial, codeset[code]); + + /* + * since the start code is part of the "raw" input, it is + * counted in the checksum by itself + */ + if (!count) checksum += code; /* the start code */ + else checksum += code * count; /* first * 1 + second * 2 ... */ + + /* + * print as "%s", because we have ".5" positions + * also, use a size of 9 like codeC above, as each symbol is + * represented by two chars + */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, + code >= 100 ? 'A' : code/10 + '0', + textpos + (double)SYMBOL_WID/2, code%10 + '0'); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + i += n; + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + diff --git a/glabels2/barcode-0.98/code39.c b/glabels2/barcode-0.98/code39.c new file mode 100644 index 00000000..3308c950 --- /dev/null +++ b/glabels2/barcode-0.98/code39.c @@ -0,0 +1,173 @@ +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "1234567890" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. *" "$/+%"; + +/* the checksum alphabet has a different order */ +static char checkbet[] = + "0123456789" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. $" "/+%"; + +/* The first 40 symbols repeat this bar pattern */ +static char *bars[] = { + "31113","13113","33111","11313","31311", + "13311","11133","31131","13131","11331"}; + +/* The first 4 decades use these space patterns */ +static char *spaces[] = {"1311","1131","1113","3111"}; + +/* the last four symbols are special */ +static char *specialbars[] = { + "11111","11111","11111","11111"}; + +static char *specialspaces[] = { + "3331","3313","3133","1333"}; + +static char *fillers[]= { + "0a3a1c1c1a", + "1a3a1c1c1a" +}; + + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_39_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + + if (text[0] == '\0') + return -1; + for (i=0; text[i]; i++) { + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + if (!strchr(alphabet,toupper(text[i]))) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + char *b, *s; + + if (code < 40) { + b = bars[code%10]; + s = spaces[code/10]; + } else { + b = specialbars[code-40]; + s = specialspaces[code-40]; + } + sprintf(ptr,"1%c%c%c%c%c%c%c%c%c", /* separator */ + b[0], s[0], b[1], s[1], b[2], s[2], + b[3], s[3], b[4]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_39_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 39"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 10* (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 10 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = 22; + + for (i=0; text[i]; i++) { + c = strchr(alphabet, toupper(text[i])); + if (!c) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + c = strchr(checkbet,*c); + if (c) /* the '*' is not there */ + checksum += (c-checkbet); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += 16; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + } + /* Add the checksum */ + if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) { + code = (strchr(alphabet, checkbet[checksum % 43]) - alphabet); + add_one(ptr, code); + } + strcat(ptr, fillers[1]); /* end */ + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/code93.c b/glabels2/barcode-0.98/code93.c new file mode 100644 index 00000000..73f8cee3 --- /dev/null +++ b/glabels2/barcode-0.98/code93.c @@ -0,0 +1,213 @@ +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Nathan D. Holmes / FedEx Services (ndholmes@fedex.com) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; + +static char *codeset[] = { + "131112", "111213", "111312", "111411", "121113", /* 0 - 4 */ + "121212", "121311", "111114", "131211", "141111", /* 5 - 9 */ + "211113", "211212", "211311", "221112", "221211", /* A - E */ + "231111", "112113", "112212", "112311", "122112", /* F - J */ + "132111", "111123", "111222", "111321", "121122", /* K - O */ + "131121", "212112", "212211", "211122", "211221", /* P - T */ + "221121", "222111", "112122", "112221", "122121", /* U - Y */ + "123111", "121131", "311112", "311211", "321111", /* Z - $ */ + "112131", "113121", "211131", "121221", "312111", /* / - (%) */ + "311121", "122211", "111141" /* (/) - (terminator) */ +}; + + +/* 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111 */ +/* 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222 */ +/* 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 */ +static char shiftset[] = + "%$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%% /// ///// / /%%%%%% %%%%%%++++++++++++++++++++++++++%%%%%"; +static char shiftset2[] = + "UABCDEFGHIJKLMNOPQRSTUVWXYZABCDE ABC FGHIJ L ZFGHIJV KLMNOWABCDEFGHIJLKMNOPQRSTUVWXYZPQRST"; + +#define START_STOP 47 +#define EXTEND_DOLLAR 43 +#define EXTEND_PERCENT 44 +#define EXTEND_SLASH 45 +#define EXTEND_PLUS 46 + +/* + * Check that the text can be encoded. Returns 0 or -1. + * All of ASCII-7 is accepted. + */ +int Barcode_93_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + + /* Test if beyond the range of 7-bit ASCII */ + if ((int)text[i] > 127) + return -1; + } + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_93_encode(struct Barcode_Item *bc) +{ + static unsigned char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *textptr; + int *checksum_str; + int i, code, textpos, checksum_len=0; + int c_checksum = 0; + int k_checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 93"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + /* the partial code is 6 * (head + 2* text + 2* check + tail) + margin + term. */ + partial = malloc( (strlen(text) *2 + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + checksum_str = (int *)malloc( (strlen(text) + 3) * 2 * sizeof(int)); + if (!checksum_str) { + free(partial); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(checksum_str); + return -1; + } + + textptr = textinfo; + textpos = 22; + strcpy(partial, "0"); + strcat(partial, codeset[START_STOP]); + + for (i=0; iflags & BARCODE_NO_CHECKSUM)==0 ) + { + for(i=1; i<=checksum_len; i++) + { + c_checksum += i * (int)checksum_str[checksum_len - i]; + k_checksum += (i+1) * (int)checksum_str[checksum_len - i]; + } + + c_checksum = c_checksum % 47; + k_checksum += c_checksum; + k_checksum = k_checksum % 47; + + strcat(partial, codeset[c_checksum]); + strcat(partial, codeset[k_checksum]); + + } + strcat(partial, codeset[START_STOP]); /* end */ + + /* Encodes final 1-unit width bar to turn the start character into a stop char */ + strcat(partial, "1"); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/compat/getopt.c b/glabels2/barcode-0.98/compat/getopt.c new file mode 100644 index 00000000..91f00b55 --- /dev/null +++ b/glabels2/barcode-0.98/compat/getopt.c @@ -0,0 +1,831 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996 + 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include +#if defined (_LIBC) || defined (HAVE_UNISTD_H) +#include +#endif +#endif /* GNU C library. */ + +#ifdef VMS +#include +#if HAVE_STRING_H - 0 +#include +#endif +#endif + +#ifdef WIN32 +/* It's not Unix, really. See? Capital letters. */ +#include +#define getpid() GetCurrentProcessId() +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +#ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +static const char *nonoption_flags; +static int nonoption_flags_len; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined (__STDC__) && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined (__STDC__) && __STDC__ +static const char *_getopt_initialize (const char *); +#endif +static const char * +_getopt_initialize (optstring) + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + + if (posixly_correct == NULL) + { + /* Bash 2.0 puts a special variable in the environment for each + command it runs, specifying which ARGV elements are the results of + file name wildcard expansion and therefore should not be + considered as options. */ + char var[100]; + sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); + nonoption_flags = getenv (var); + if (nonoption_flags == NULL) + nonoption_flags_len = 0; + else + nonoption_flags_len = strlen (nonoption_flags); + } + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0) + { + optstring = _getopt_initialize (optstring); + optind = 1; /* Don't scan ARGV[0], the program name. */ + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. */ +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && nonoption_flags[optind] == '1')) + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + +#ifdef lint /* Suppress `used before initialized' warning. */ + indfound = 0; +#endif + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if (nameend - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/glabels2/barcode-0.98/compat/getopt.h b/glabels2/barcode-0.98/compat/getopt.h new file mode 100644 index 00000000..952f4830 --- /dev/null +++ b/glabels2/barcode-0.98/compat/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 90, 91, 92, 93, 94 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/glabels2/barcode-0.98/configure b/glabels2/barcode-0.98/configure new file mode 100755 index 00000000..bf7e1b82 --- /dev/null +++ b/glabels2/barcode-0.98/configure @@ -0,0 +1,3556 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="barcode.h" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:819: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:830: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:838: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:854: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:858: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:864: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:866: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:868: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:887: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:889: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:909: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:912: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:929: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:944: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:952: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:955: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:964: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:979: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:987: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:990: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1003: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1018: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1026: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1029: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1038: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1053: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1061: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1064: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1077: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1097: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1119: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1122: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1133: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1148: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1156: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1159: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1172: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1187: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1195: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1198: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1210: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1215:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1218: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:1221: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1223: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:1226: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1228: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:1231: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1235 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1251: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1254: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1257: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1280: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1286: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1291: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1297: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1300: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1307: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1315: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1322: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1324: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1327: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1329: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1332: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1348: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1354: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1360: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1366 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1378: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1381: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1393: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1400: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1404: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1410 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1425: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1428: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1431: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1434: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1446: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1452: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1458 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1470: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1473: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1476: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1479: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1489: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1516: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1519: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1522: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1525: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1537 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1550: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1553: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1556: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1559: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1569 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1581: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1584: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1587: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1590: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:1620: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:1635: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:1643: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:1646: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:1655: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:1670: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:1679: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:1682: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:1708: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1728: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1777: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test x$GCC = xyes; then + CFLAGS="$CFLAGS -Wall" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:1797: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1818 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1823: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1829: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1852 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:1856: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1862: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:1899: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1909 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1914: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1920: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1943 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:1947: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1953: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:1981: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:1992: checking for getopt.h" >&5 +echo $ECHO_N "checking for getopt.h... $ECHO_C" >&6 +if test "${ac_cv_header_getopt_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1998 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2002: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2008: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_getopt_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_getopt_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2027: result: $ac_cv_header_getopt_h" >&5 +echo "${ECHO_T}$ac_cv_header_getopt_h" >&6 +if test $ac_cv_header_getopt_h = yes; then + : +else + NO_GETOPT=-DNO_GETOPT;GETOPT_O=compat/getopt.o +fi + +echo "$as_me:2035: checking for paper.h" >&5 +echo $ECHO_N "checking for paper.h... $ECHO_C" >&6 +if test "${ac_cv_header_paper_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2041 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2045: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2051: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_paper_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_paper_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2070: result: $ac_cv_header_paper_h" >&5 +echo "${ECHO_T}$ac_cv_header_paper_h" >&6 +if test $ac_cv_header_paper_h = yes; then + LIBPAPER=-lpaper +else + NO_LIBPAPER=-DNO_LIBPAPER +fi + +for ac_header in unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:2081: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2087 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2091: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2097: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2116: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for strerror... $ECHO_C" >&6 +if test "${ac_cv_func_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2132 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strerror (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +char (*f) (); + +int +main () +{ +/* 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_strerror) || defined (__stub___strerror) +choke me +#else +f = strerror; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2163: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2166: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2169: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2172: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_strerror=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2182: result: $ac_cv_func_strerror" >&5 +echo "${ECHO_T}$ac_cv_func_strerror" >&6 +if test $ac_cv_func_strerror = yes; then + : +else + NO_STRERROR=-DNO_STRERROR +fi + +for ac_func in strcasecmp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:2193: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2199 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2230: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2233: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2236: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2239: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2249: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking \"for gmake\"... $ECHO_C" >&6 +GMAKE=no +${MAKE=make} --version 2> /dev/null | grep GNU > /dev/null && GMAKE=yes +echo "$as_me:2263: result: $GMAKE" >&5 +echo "${ECHO_T}$GMAKE" >&6 +if test "$GMAKE" = "yes"; then + GMAKEDEPEND0='ifeq (.depend,$(wildcard .depend))' + GMAKEDEPEND1='include .depend' + GMAKEDEPEND2='endif' +fi + +echo "$as_me:2271: checking \"if makeinfo can output html\"" >&5 +echo $ECHO_N "checking \"if makeinfo can output html\"... $ECHO_C" >&6 +MAKEINFOHTML=no +${MAKEINFO=makeinfo} --help | grep .--html > /dev/null && MAKEINFOHTML=yes +echo "$as_me:2275: result: $MAKEINFOHTML" >&5 +echo "${ECHO_T}$MAKEINFOHTML" >&6 +if test "$MAKEINFOHTML" = "yes"; then + REMOVEHTMLTAGS="cat" + INFOTOHTML="$MAKEINFO --html" +else + REMOVEHTMLTAGS="sed 's/ifnottex/ifinfo/; s/ifnotinfo/iftex/'" + INFOTOHTML="perl texi2html -monolithic" +fi + +ac_config_files="$ac_config_files Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\EOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +EOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:2395: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:2563: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:2582: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:2618: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CPP@,$CPP,;t t +s,@GETOPT_O@,$GETOPT_O,;t t +s,@NO_GETOPT@,$NO_GETOPT,;t t +s,@NO_LIBPAPER@,$NO_LIBPAPER,;t t +s,@LIBPAPER@,$LIBPAPER,;t t +s,@NO_STRERROR@,$NO_STRERROR,;t t +s,@GMAKEDEPEND0@,$GMAKEDEPEND0,;t t +s,@GMAKEDEPEND1@,$GMAKEDEPEND1,;t t +s,@GMAKEDEPEND2@,$GMAKEDEPEND2,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:2833: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:2851: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:2864: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +ac_config_files="$ac_config_files doc/Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\EOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +EOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:3029: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:3197: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:3216: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + *) { { echo "$as_me:3253: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CPP@,$CPP,;t t +s,@GETOPT_O@,$GETOPT_O,;t t +s,@NO_GETOPT@,$NO_GETOPT,;t t +s,@NO_LIBPAPER@,$NO_LIBPAPER,;t t +s,@LIBPAPER@,$LIBPAPER,;t t +s,@NO_STRERROR@,$NO_STRERROR,;t t +s,@GMAKEDEPEND0@,$GMAKEDEPEND0,;t t +s,@GMAKEDEPEND1@,$GMAKEDEPEND1,;t t +s,@GMAKEDEPEND2@,$GMAKEDEPEND2,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@REMOVEHTMLTAGS@,$REMOVEHTMLTAGS,;t t +s,@INFOTOHTML@,$INFOTOHTML,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:3471: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3489: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3502: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/glabels2/barcode-0.98/configure.in b/glabels2/barcode-0.98/configure.in new file mode 100644 index 00000000..07120b48 --- /dev/null +++ b/glabels2/barcode-0.98/configure.in @@ -0,0 +1,65 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(barcode.h) +AC_PREREQ(2.12) + +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_INSTALL + +dnl Add "-Wall" if this is gcc +if test x$GCC = xyes; then + CFLAGS="$CFLAGS -Wall" +fi + + +dnl Check for getopt and libpaper. If getopt is missing, use our version +AC_CHECK_HEADER(getopt.h, ,NO_GETOPT=-DNO_GETOPT;GETOPT_O=compat/getopt.o) +AC_CHECK_HEADER(paper.h, LIBPAPER=-lpaper, NO_LIBPAPER=-DNO_LIBPAPER) +AC_CHECK_HEADERS(unistd.h) + +AC_CHECK_FUNC(strerror, , NO_STRERROR=-DNO_STRERROR) +AC_CHECK_FUNCS(strcasecmp) + +dnl Check if this is gmake, but allow ovverriding using $MAKE +AC_MSG_CHECKING("for gmake") +GMAKE=no +${MAKE=make} --version 2> /dev/null | grep GNU > /dev/null && GMAKE=yes +AC_MSG_RESULT($GMAKE) +if test "$GMAKE" = "yes"; then + GMAKEDEPEND0='ifeq (.depend,$(wildcard .depend))' + GMAKEDEPEND1='include .depend' + GMAKEDEPEND2='endif' +fi + +dnl Check if we use makeinfo or the local texi2html tool +AC_MSG_CHECKING("if makeinfo can output html") +MAKEINFOHTML=no +${MAKEINFO=makeinfo} --help | grep .--html > /dev/null && MAKEINFOHTML=yes +AC_MSG_RESULT($MAKEINFOHTML) +if test "$MAKEINFOHTML" = "yes"; then + REMOVEHTMLTAGS="cat" + INFOTOHTML="$MAKEINFO --html" +else + REMOVEHTMLTAGS="sed 's/ifnottex/ifinfo/; s/ifnotinfo/iftex/'" + INFOTOHTML="perl texi2html -monolithic" +fi + + +AC_SUBST(GETOPT_O) +AC_SUBST(NO_GETOPT) +AC_SUBST(NO_LIBPAPER) +AC_SUBST(LIBPAPER) +AC_SUBST(NO_STRERROR) +AC_SUBST(GMAKEDEPEND0) +AC_SUBST(GMAKEDEPEND1) +AC_SUBST(GMAKEDEPEND2) + +AC_OUTPUT(Makefile) + +AC_SUBST(MAKEINFO) +AC_SUBST(REMOVEHTMLTAGS) +AC_SUBST(INFOTOHTML) + +AC_OUTPUT(doc/Makefile) + diff --git a/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..69df9562ce09785778516c0fb6a73a8d2181eda5 GIT binary patch literal 2880 zcmV-G3%~RqiwFQKjek4<1ML}WbJ|EUU&F8HaFqnG00Dk%jO{&QlY}eBb^%T<6{lQ6 z8o?w&LurIDyOsZb-7_O0Z0E5TCwo<=whEG_U(@fAM^5Alk5vb6Ue+J{B(UvGduL}0 zzioTF)l}bh!+dLaVDD_Uc6RLTt;Xg9Tx;%ZKY*>DrBD{;GIk<>2hn`QL;htvMDzV$ zq0p~|QO5tTolnf?0lRM*b_4ysz4=A|x3;!Y|8H(L5Wlt4+Iax>eJgSo{Ga<@UX6DP z52xsPz)Mkh=((w|b7YYC{oNx)VNQ@(A3V7*93~Pw+LP-v@VLJuKJ;)NdMtu?!XReRRD$r;&C8Q>c*#N*IRTu_M*(-?n7b^L3>=hA zPvnGoFw%^OhydFos)O) zw$tx-PKNK=h#gM^uCgnpdGYBi;K&*`7CB+OMEw?;ZDs?{FLNqBlJ0 z4hHbzv=1FP>-2}c!}H@#AI{GEXQzX13ShuUF{U_t#mv5P6z-A7PmdC=vUsgpclF| z3$~uYkfEIzoCS`HJ{`=7L#t(5@Lb54Fkg27>}I3Us5V;m4#4@KQz%sGg~C60=mvA_ zPkS=SR zn?hyeTIjpuE>!$-yHFrXs>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JawKXoIk5idP#JLI(DjfVn?h^8O7I|;2woKTqg;>#0#oXMT>ln z7DHX=|3E59bQ_}+*1nzHWR~Mvg;*~hI_Rs(GZa%-B}9{0##H5uIWlqZg>9!OjrJ;1 zH}=!eGcTmp%f?rVhQOf~YqjpBX_QKR2&9Qv^-iX%3-fBpD`-c`Ii@g?Ewgy5vvD$! zW->fx*Wd9Hk~}vLB{o)^Su<&_Ed3FPR0&7@qL4KjYqLh}L7Y6QFiL!srM%V-fav6(63!LnBt!`KV#hXOoPs zCT4BGD7~-XzGs)DD+-@t$O*TkcT_gb_fd*b&b~9PHg2^otPvuNtG+Yk0R{9c7F?lQ zT?d0utw{a{_1;D^)A;arF~ROrqT*pB>!hK=@=+I-tWDo@*g*SlK;r{E+J~q3^W;h4 zA$%3-!hYKRh()Nas_%3bFLAaLGfVeEJibJXP8CQ(CnoJ-EDFgh-q4*bOQ{_!SaUK; z;brS%@8GjgJPC4|kUC2g_DquvE)|Zl6shU74 z!vP9GWs{qkpg~?u!z+zBBE4%U-&0YvR*%%I@z}*v2`;IMkqBPNC|keTR(20x%X)g* zwKB||g3<9*1talxas#kgyccftdQ5h%on)VP0_y1qyOhZNNh- z&I%rjjg8jE`eY3FFaBlmryZv9CFAZha7UqA%`4t$RURua>yZv e9CFAZha7UqA%`4t$RUTH2>$^%TPsBXPyhhX7=M`n literal 0 HcmV?d00001 diff --git a/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README new file mode 100644 index 00000000..1608ebaf --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README @@ -0,0 +1,24 @@ + +[readme written by GNU-barcode maintainer] + +This is a stripped version of what you can find at: + http://www.onefour.net/barcode/SVG/barcode097-SVG.tar.gz + +It's by David J. Humphreys, it's GPL code and the original tarball +(as per the previous URL) contains: + +-rwxr--r-- david/david 243 2002-01-02 04:18:00 Makefile +-rwxr--r-- david/david 1284 2002-01-08 00:26:42 main.c +-rwxr--r-- david/david 37796 2002-01-02 04:33:00 screen1.png +-rwxr--r-- david/david 5503 2002-01-08 00:30:00 svg.c +-rwxr--r-- david/david 2499 2002-01-02 03:37:00 test1.svg +-rwxr--r-- david/david 2499 2002-01-02 03:44:00 test2.svg +-rwxr--r-- david/david 2499 2002-01-02 03:49:00 test3.svg +-rwxr--r-- david/david 34185 2002-01-02 04:41:00 test4.png +-rwxr--r-- david/david 1834 2002-01-02 04:19:00 test4.svg +-rwxr--r-- david/david 92713 2002-01-02 04:36:00 transformation.png +-rwxr--r-- david/david 586 2002-01-02 04:11:00 transformation.svg + +Here I only included Makefile, main.c, svg.c, after converting +newlines to unix-style and changing permissions. + diff --git a/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..cbc8e67693f6a90df86e6aafb2debb625321e861 GIT binary patch literal 19010 zcmV(jK=!{MiwFRV_J2G81LQnwSKG*v`J8j|AL=q;EQ1V|3CWBdW-iZ3b`!z@W@qkB z5{@jlu!1akC7IyiQ669oFc2sQ2g37U+Mwx82<){dc## z-j??qZNYoq+x8wo_dBe8=jZ>q{%_&wtAo?0U!FX^UHdK{!UX&2be=_*<09_^{C4sN zzUK3tX?l8+rJq<(9Qza2e-jEbKbt@0i-_Sj=_L}oy|umdybo#*Oe5L@fD>pAz$v>1 zZ^I+;giQ-YAbbVCGYvB=gFn|y%+thEjYoICe=!>lc~QDKV8i``^S=x8R;RIRFF=leo)ZfoA3(A>CZL5Jp_DF z2XrBvA>n+t`ooxk&uvn&+}kD^e=1p~?GZEo8uxDx(h#=6Ny%)qwVpiQ+dbWXcW`)d zaCo%)`copBKAt-~E1kPU_m|q7-f+A0rW0P>dNlha8F& z{2)kY31jFH_4;@v0oy%g^7e2zxN z*hTM2Ns1<@Tjjhdc;;&MO&W&o9Djf*Q~T_RpW#wX>Dy=LfgiK54+rTCO-xBI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yg~$f+j-c{0M2!44n-^%s3rec<-js`4~?ENadG{Qi5I-2GGk@mK{Fy)VXa3Be`7?j!&-|G` t^Jo6dpZPO?=Fj|@Kl5k)%%Ax)f9B8pnLqPq{`@VU{|}_&g7E-o0RRYmr!fEk literal 0 HcmV?d00001 diff --git a/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README new file mode 100644 index 00000000..36d216d7 --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README @@ -0,0 +1,10 @@ + +The barcode-for-delphi tarball includes a version of this package +ported to run under Delphi. Please note that you can't distribute the +executable because of the GPL (i.e., disitributing it would be +copyright violation, because the executable is a derived work of GNU +barcode, whose authors don't allow distributing under non-GPL terms. + +I still think it may be useful to some users. + +The code has been contributed by Michael Geddes . diff --git a/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz b/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz new file mode 100644 index 0000000000000000000000000000000000000000..1dadb1c6a6dc085cee750585295ea63d06b5e056 GIT binary patch literal 2036 zcmVL5=V47J7Bw8s3}=SlkUpOto&0sW^Fvz@2Ep!l zyc3}9?M}=ybno2V3WJ?sFWlXm?2X3b5d1u0hk_q#mTk4tQAM;9r@5@Y$|oxIGYtB< z&7;TK3vM)vs#qqXR78OvTH@n#nl?mO`(e-z_B`)bD?!mh6rzf>NGL1lOe%d5S6QjO z*)_e13Pl%jDr-u$F82q6)oSG{Ciuyv=dHOZQxs8I$wd_{mszo(JSrA-v=Ba>YDyyv z=Q-(AP%H~w$()p~>R8v6P+lQK0{wGYQCx{g^ZZ$3pDfI@d4BEFKQo=;3d+QnXj$fh zGNZbXx)Gu!v|R~`KubmSpiK}Fb=OKT56oVxGpa<#FDq!xtQDO(WtA0LRKDlEXM@bL zvRSP&7`(`?AVtZgXbib-2(k7d3ZI3;(Ri}E_sgs2ggiUOicW_U=cuL7sZ2O(SE9ORiS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=MIhFoU_V!!cL;aWKq3u(@AxOBrte?Z^8pn*$ zOPi0O!m^Zu!Cc#NSBGAx(c9ZkeaW5&RK z02E@ctA}_HwtaO1(Y^9B{i)M@J){Y(A2H~c9;C=R-;Ek&Q4f^UJjVRpleAX19X?#2 zpUoShwt9G@H~d-?++D7Yg2Y3mIj)KsMpl!TxkYVq<$NMc1UBY;^IWw5BVofI>5QV! zxv@MAMf3dd0BDA9&9=er zsy@vczg&NO4=ydMAiy_?Hwvd2t&gi|aDqq2ueAZ@)3HYt|D6#LaY3tZc7K$`U9%W}WjXnZ5D-4`Jo)!ZpEp%ArM05Gf`dkL< znC;r8DJlK!8{4)1>TFL;Vp)0^!u67;G$+g0p+got6$gw;uy*ihc++!zp3PqI9I\n"); +} + +print "# end of pass 1\n" if $verbose; + +#+++############################################################################ +# # +# Pass 2/3: handle style, menu, index, cross-reference # +# # +#---############################################################################ + +@lines2 = (); # whole document (2nd pass) +@lines3 = (); # whole document (3rd pass) +$in_menu = 0; # am I inside a menu + +while (@lines) { + $_ = shift(@lines); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@lines2, $_); + next; + } + # + # menu + # + $in_menu = 1, push(@lines2, &debug("
    \n", __LINE__)), next if /^\@menu\b/; + $in_menu = 0, push(@lines2, &debug("
\n", __LINE__)), next if /^\@end\s+menu\b/; + if ($in_menu) { + if (/^\*\s+($NODERE)::/o) { + $descr = $'; + chop($descr); + &menu_entry($1, $1, $descr); + } elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/) { + $descr = $'; + chop($descr); + &menu_entry($1, $2, $descr); + } elsif (/^\*/) { + warn "$ERROR Bad menu line: $_"; + } else { # description continued? + push(@lines2, $_); + } + next; + } + # + # printindex + # + if (/^\@printindex\s+(\w\w)\b/) { + local($index, *ary, @keys, $key, $letter, $last_letter, @refs); + if ($predefined_index{$1}) { + $index = $predefined_index{$1} . 'index'; + } else { + $index = $1 . 'index'; + } + eval("*ary = *$index"); + @keys = keys(%ary); + foreach $key (@keys) { + $_ = $key; + 1 while s/<(\w+)>\`(.*)\'<\/\1>/$2/; # remove HTML tags with quotes + 1 while s/<(\w+)>(.*)<\/\1>/$2/; # remove HTML tags + $_ = &unprotect_html($_); + &unprotect_texi; + tr/A-Z/a-z/; # lowercase + $key2alpha{$key} = $_; + print "# index $key sorted as $_\n" + if $key ne $_ && $debug & $DEBUG_INDEX; + } + $last_letter = undef; + foreach $key (sort byalpha @keys) { + $letter = substr($key2alpha{$key}, 0, 1); + $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;; + if (!defined($last_letter) || $letter ne $last_letter) { + push(@lines2, "\n") if defined($last_letter); + push(@lines2, "

" . &protect_html($letter) . "

\n"); + push(@lines2, "\n"); + $last_letter = $letter; + } + @refs = (); + foreach (split(/$;/, $ary{$key})) { + push(@refs, &anchor('', $_, $key, 0)); + } + push(@lines2, "
  • " . join(", ", @refs) . "\n"); + } + push(@lines2, "
  • \n") if defined($last_letter); + next; + } + # + # simple style substitutions + # + $_ = &substitute_style($_); + # + # xref + # + while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) { + # note: Texinfo may accept other characters + ($type, $nodes, $full) = ($1, $2, $3); + ($before, $after) = ($`, $'); + if (! $full && $after) { + warn "$ERROR Bad xref (no ending } on line): $_"; + $_ = "$before$;0${type}ref\{$nodes$after"; + next; # while xref + } + if ($type eq 'x') { + $type = 'See '; + } elsif ($type eq 'px') { + $type = 'see '; + } elsif ($type eq 'info') { + $type = 'See Info'; + } else { + $type = ''; + } + unless ($full) { + $next = shift(@lines); + $next = &substitute_style($next); + chop($nodes); # remove final newline + if ($next =~ /\}/) { # split on 2 lines + $nodes .= " $`"; + $after = $'; + } else { + $nodes .= " $next"; + $next = shift(@lines); + $next = &substitute_style($next); + chop($nodes); + if ($next =~ /\}/) { # split on 3 lines + $nodes .= " $`"; + $after = $'; + } else { + warn "$ERROR Bad xref (no ending }): $_"; + $_ = "$before$;0xref\{$nodes$after"; + unshift(@lines, $next); + next; # while xref + } + } + } + $nodes =~ s/\s+/ /g; # remove useless spaces + @args = split(/\s*,\s*/, $nodes); + $node = $args[0]; # the node is always the first arg + &normalise_node($node); + $sec = $node2sec{$node}; + if (@args == 5) { # reference to another manual + $sec = $args[2] || $node; + $man = $args[4] || $args[3]; + $_ = "${before}${type}section `$sec' in \@cite{$man}$after"; + } elsif ($type =~ /Info/) { # inforef + warn "$ERROR Wrong number of arguments: $_" unless @args == 3; + ($nn, $_, $in) = @args; + $_ = "${before}${type} file `$in', node `$nn'$after"; + } elsif ($sec) { + $href = $node2href{$node}; + $_ = "${before}${type}section " . &anchor('', $href, $sec) . $after; + } else { + warn "$ERROR Undefined node ($node): $_"; + $_ = "$before$;0xref{$nodes}$after"; + } + } + # + # try to guess bibliography references or glossary terms + # + unless (/^
    /) { + $done .= $pre . &anchor('', $href, $what); + } else { + $done .= "$pre$what"; + } + $_ = $post; + } + $_ = $done . $_; + } + if ($use_glossary) { + $done = ''; + while (/\b\w+\b/) { + ($pre, $what, $post) = ($`, $&, $'); + $entry = $what; + $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/; + $href = $gloss2href{$entry}; + if (defined($href) && $post !~ /^[^<]*<\/A>/) { + $done .= $pre . &anchor('', $href, $what); + } else { + $done .= "$pre$what"; + } + $_ = $post; + } + $_ = $done . $_; + } + } + # otherwise + push(@lines2, $_); +} +print "# end of pass 2\n" if $verbose; + +# +# split style substitutions +# +while (@lines2) { + $_ = shift(@lines2); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@lines3, $_); + next; + } + # + # split style substitutions + # + $old = ''; + while ($old ne $_) { + $old = $_; + if (/\@(\w+)\{/) { + ($before, $style, $after) = ($`, $1, $'); + if (defined($style_map{$style})) { + $_ = $after; + $text = ''; + $after = ''; + $failed = 1; + while (@lines2) { + if (/\}/) { + $text .= $`; + $after = $'; + $failed = 0; + last; + } else { + $text .= $_; + $_ = shift(@lines2); + } + } + if ($failed) { + die "* Bad syntax (\@$style) after: $before\n"; + } else { + $text = &apply_style($style, $text); + $_ = "$before$text$after"; + } + } + } + } + # otherwise + push(@lines3, $_); +} +print "# end of pass 3\n" if $verbose; + +#+++############################################################################ +# # +# Pass 4: foot notes, final cleanup # +# # +#---############################################################################ + +@foot_lines = (); # footnotes +@doc_lines = (); # final document +$end_of_para = 0; # true if last line is

    + +while (@lines3) { + $_ = shift(@lines3); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@doc_lines, $_); + $end_of_para = 0; + next; + } + # + # footnotes + # + while (/\@footnote([^\{\s]+)\{/) { + ($before, $d, $after) = ($`, $1, $'); + $_ = $after; + $text = ''; + $after = ''; + $failed = 1; + while (@lines3) { + if (/\}/) { + $text .= $`; + $after = $'; + $failed = 0; + last; + } else { + $text .= $_; + $_ = shift(@lines3); + } + } + if ($failed) { + die "* Bad syntax (\@footnote) after: $before\n"; + } else { + $foot_num++; + $docid = "DOCF$foot_num"; + $footid = "FOOT$foot_num"; + $foot = "($foot_num)"; + push(@foot_lines, "

    " . &anchor($footid, "$d#$docid", $foot) . "

    \n"); + $text = "

    $text" unless $text =~ /^\s*

    /; + push(@foot_lines, "$text\n"); + $_ = $before . &anchor($docid, "$docu_foot#$footid", $foot) . $after; + } + } + # + # remove unnecessary

    + # + if (/^\s*

    \s*$/) { + next if $end_of_para++; + } else { + $end_of_para = 0; + } + # otherwise + push(@doc_lines, $_); +} +print "# end of pass 4\n" if $verbose; + +#+++############################################################################ +# # +# Pass 5: print things # +# # +#---############################################################################ + +$header = < +EOT + +$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document"; +$title = $value{'_settitle'} || $full_title; +$_ = &substitute_style($full_title); +&unprotect_texi; +s/\n$//; # rmv last \n (if any) +$full_title = "

    " . join("

    \n

    ", split(/\n/, $_)) . "

    \n"; + +# +# print ToC +# +if (!$monolithic && @toc_lines) { + if (open(FILE, "> $docu_toc")) { + print "# creating $docu_toc...\n" if $verbose; + &print_toplevel_header("$title - Table of Contents"); + &print_ruler; + &print(*toc_lines, FILE); + &print_toplevel_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_toc: $!\n"; + } +} + +# +# print footnotes +# +if (!$monolithic && @foot_lines) { + if (open(FILE, "> $docu_foot")) { + print "# creating $docu_foot...\n" if $verbose; + &print_toplevel_header("$title - Footnotes"); + &print_ruler; + &print(*foot_lines, FILE); + &print_toplevel_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_foot: $!\n"; + } +} + +# +# print document +# +if ($split_chapter || $split_node) { # split + $doc_num = 0; + $last_num = scalar(@sections); + $first_doc = &doc_name(1); + $last_doc = &doc_name($last_num); + while (@sections) { + $section = shift(@sections); + &next_doc; + if (open(FILE, "> $docu_doc")) { + print "# creating $docu_doc...\n" if $verbose; + &print_header("$title - $section"); + $prev_doc = ($doc_num == 1 ? undef : &doc_name($doc_num - 1)); + $next_doc = ($doc_num == $last_num ? undef : &doc_name($doc_num + 1)); + $navigation = "Go to the "; + $navigation .= ($prev_doc ? &anchor('', $first_doc, "first") : "first"); + $navigation .= ", "; + $navigation .= ($prev_doc ? &anchor('', $prev_doc, "previous") : "previous"); + $navigation .= ", "; + $navigation .= ($next_doc ? &anchor('', $next_doc, "next") : "next"); + $navigation .= ", "; + $navigation .= ($next_doc ? &anchor('', $last_doc, "last") : "last"); + $navigation .= " section, " . &anchor('', $docu_toc, "table of contents") . ".\n"; + print FILE $navigation; + &print_ruler; + # find corresponding lines + @tmp_lines = (); + while (@doc_lines) { + $_ = shift(@doc_lines); + last if ($_ eq $SPLITTAG); + push(@tmp_lines, $_); + } + &print(*tmp_lines, FILE); + &print_ruler; + print FILE $navigation; + &print_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_doc: $!\n"; + } + } +} else { # not split + if (open(FILE, "> $docu_doc")) { + print "# creating $docu_doc...\n" if $verbose; + if ($monolithic || !@toc_lines) { + &print_toplevel_header($title); + } else { + &print_header($title); + print FILE $full_title; + } + if ($monolithic && @toc_lines) { + &print_ruler; + print FILE "

    Table of Contents

    \n"; + &print(*toc_lines, FILE); + } + &print_ruler; + &print(*doc_lines, FILE); + if ($monolithic && @foot_lines) { + &print_ruler; + print FILE "

    Footnotes

    \n"; + &print(*foot_lines, FILE); + } + if ($monolithic || !@toc_lines) { + &print_toplevel_footer; + } else { + &print_footer; + } + close(FILE); + } else { + warn "$ERROR Can't write to $docu_doc: $!\n"; + } +} + +print "# that's all folks\n" if $verbose; + +#+++############################################################################ +# # +# Low level functions # +# # +#---############################################################################ + +sub update_sec_num { + local($name, $level) = @_; + + $level--; # here we start at 0 + if ($name =~ /^appendix/) { + # appendix style + if (defined(@appendix_sec_num)) { + &incr_sec_num($level, @appendix_sec_num); + } else { + @appendix_sec_num = ('A', 0, 0, 0); + } + return(join('.', @appendix_sec_num[0..$level])); + } else { + # normal style + if (defined(@normal_sec_num)) { + &incr_sec_num($level, @normal_sec_num); + } else { + @normal_sec_num = (1, 0, 0, 0); + } + return(join('.', @normal_sec_num[0..$level])); + } +} + +sub incr_sec_num { + local($level, $l); + $level = shift(@_); + $_[$level]++; + foreach $l ($level+1 .. 3) { + $_[$l] = 0; + } +} + +sub check { + local($_, %seen, %context, $before, $match, $after); + + while (<>) { + if (/\@(\*|\.|\:|\@|\{|\})/) { + $seen{$&}++; + $context{$&} .= "> $_" if $verbose; + $_ = "$`XX$'"; + redo; + } + if (/\@(\w+)/) { + ($before, $match, $after) = ($`, $&, $'); + if ($before =~ /\b[\w-]+$/ && $after =~ /^[\w-.]*\b/) { # e-mail address + $seen{'e-mail address'}++; + $context{'e-mail address'} .= "> $_" if $verbose; + } else { + $seen{$match}++; + $context{$match} .= "> $_" if $verbose; + } + $match =~ s/^\@/X/; + $_ = "$before$match$after"; + redo; + } + } + + foreach (sort(keys(%seen))) { + if ($verbose) { + print "$_\n"; + print $context{$_}; + } else { + print "$_ ($seen{$_})\n"; + } + } +} + +sub open { + local($name) = @_; + + ++$fh_name; + if (open($fh_name, $name)) { + unshift(@fhs, $fh_name); + } else { + warn "$ERROR Can't read file $name: $!\n"; + } +} + +sub init_input { + @fhs = (); # hold the file handles to read + @input_spool = (); # spooled lines to read + $fh_name = 'FH000'; + &open($docu); +} + +sub next_line { + local($fh, $line); + + if (@input_spool) { + $line = shift(@input_spool); + return($line); + } + while (@fhs) { + $fh = $fhs[0]; + $line = <$fh>; + return($line) if $line; + close($fh); + shift(@fhs); + } + return(undef); +} + +# used in pass 1, use &next_line +sub skip_until { + local($tag) = @_; + local($_); + + while ($_ = &next_line) { + return if /^\@end\s+$tag\s*$/; + } + die "* Failed to find '$tag' after: " . $lines[$#lines]; +} + +# +# HTML stacking to have a better HTML output +# + +sub html_reset { + @html_stack = ('html'); + $html_element = 'body'; +} + +sub html_push { + local($what) = @_; + push(@html_stack, $html_element); + $html_element = $what; +} + +sub html_push_if { + local($what) = @_; + push(@html_stack, $html_element) + if ($html_element && $html_element ne 'P'); + $html_element = $what; +} + +sub html_pop { + $html_element = pop(@html_stack); +} + +sub html_pop_if { + local($elt); + + if (@_) { + foreach $elt (@_) { + if ($elt eq $html_element) { + $html_element = pop(@html_stack) if @html_stack; + last; + } + } + } else { + $html_element = pop(@html_stack) if @html_stack; + } +} + +sub html_debug { + local($what, $line) = @_; + return("$what") + if $debug & $DEBUG_HTML; + return($what); +} + +# to debug the output... +sub debug { + local($what, $line) = @_; + return("$what") + if $debug & $DEBUG_HTML; + return($what); +} + +sub normalise_node { + $_[0] =~ s/\s+/ /g; + $_[0] =~ s/ $//; + $_[0] =~ s/^ //; +} + +sub menu_entry { + local($entry, $node, $descr) = @_; + local($href); + + &normalise_node($node); + $href = $node2href{$node}; + if ($href) { + $descr =~ s/^\s+//; + $descr = ": $descr" if $descr; + push(@lines2, "
  • " . &anchor('', $href, $entry) . "$descr\n"); + } else { + warn "$ERROR Undefined node ($node): $_"; + } +} + +sub do_ctrl { "^$_[0]" } + +sub do_sc { "\U$_[0]\E" } + +sub apply_style { + local($texi_style, $text) = @_; + local($style); + + $style = $style_map{$texi_style}; + if (defined($style)) { # known style + if ($style =~ /^\"/) { # add quotes + $style = $'; + $text = "\`$text\'"; + } + if ($style =~ /^\&/) { # custom + $style = $'; + $text = &$style($text); + } elsif ($style) { # good style + $text = "<$style>$text"; + } else { # no style + } + } else { # unknown style + $text = undef; + } + return($text); +} + +# remove Texinfo styles +sub remove_style { + local($_) = @_; + s/\@\w+{([^\{\}]+)}/$1/g; + return($_); +} + +sub substitute_style { + local($_) = @_; + local($changed, $done, $style, $text); + + $changed = 1; + while ($changed) { + $changed = 0; + $done = ''; + while (/\@(\w+){([^\{\}]+)}/) { + $text = &apply_style($1, $2); + if ($text) { + $_ = "$`$text$'"; + $changed = 1; + } else { + $done .= "$`\@$1"; + $_ = "{$2}$'"; + } + } + $_ = $done . $_; + } + return($_); +} + +sub anchor { + local($name, $href, $text, $newline) = @_; + local($result); + + $result = "

    \n"; +} + +sub print_header { + local($_); + + # clean the title + $_ = &remove_style($_[0]); + &unprotect_texi; + # print the header + if ($doctype eq 'html2') { + print FILE $html2_doctype; + } elsif ($doctype) { + print FILE $doctype; + } + print FILE < + +$header +$_ + + +EOT +} + +sub print_toplevel_header { + local($_); + + &print_header; # pass given arg... + print FILE $full_title; + if ($value{'_subtitle'}) { + $value{'_subtitle'} =~ s/\n+$//; + foreach (split(/\n/, $value{'_subtitle'})) { + $_ = &substitute_style($_); + &unprotect_texi; + print FILE "

    $_

    \n"; + } + } + if ($value{'_author'}) { + $value{'_author'} =~ s/\n+$//; + foreach (split(/\n/, $value{'_author'})) { + $_ = &substitute_style($_); + &unprotect_texi; + s/[\w.-]+\@[\w.-]+/
    $&<\/A>/g; + print FILE "
    $_
    \n"; + } + } + print FILE "

    \n"; +} + +sub print_footer { + print FILE < + +EOT +} + +sub print_toplevel_footer { + &print_ruler; + print FILE <texi2html +translator version 1.51.

    +EOT + &print_footer; +} + +sub protect_texi { + # protect @ { } ` ' + s/\@\@/$;0/go; + s/\@\{/$;1/go; + s/\@\}/$;2/go; + s/\@\`/$;3/go; + s/\@\'/$;4/go; +} + +sub protect_html { + local($what) = @_; + # protect & < > + $what =~ s/\&/\&\#38;/g; + $what =~ s/\/\&\#62;/g; + # but recognize some HTML things + $what =~ s/\&\#60;\/A\&\#62;/<\/A>/g; # + $what =~ s/\&\#60;A ([^\&]+)\&\#62;//g; # + $what =~ s/\&\#60;IMG ([^\&]+)\&\#62;//g; # + return($what); +} + +sub unprotect_texi { + s/$;0/\@/go; + s/$;1/\{/go; + s/$;2/\}/go; + s/$;3/\`/go; + s/$;4/\'/go; +} + +sub unprotect_html { + local($what) = @_; + $what =~ s/\&\#38;/\&/g; + $what =~ s/\&\#60;/\/g; + return($what); +} + +sub byalpha { + $key2alpha{$a} cmp $key2alpha{$b}; +} + +############################################################################## + + # These next few lines are legal in both Perl and nroff. + +.00 ; # finish .ig + +'di \" finish diversion--previous line must be blank +.nr nl 0-1 \" fake up transition to first page again +.nr % 0 \" start at page 1 +'; __END__ ############# From here on it's a standard manual page ############ +.TH TEXI2HTML 1 "09/10/96" +.AT 3 +.SH NAME +texi2html \- a Texinfo to HTML converter +.SH SYNOPSIS +.B texi2html [options] file +.PP +.B texi2html -check [-verbose] files +.SH DESCRIPTION +.I Texi2html +converts the given Texinfo file to a set of HTML files. It tries to handle +most of the Texinfo commands. It creates hypertext links for cross-references, +footnotes... +.PP +It also tries to add links from a reference to its corresponding entry in the +bibliography (if any). It may also handle a glossary (see the +.B \-glossary +option). +.PP +.I Texi2html +creates several files depending on the contents of the Texinfo file and on +the chosen options (see FILES). +.PP +The HTML files created by +.I texi2html +are closer to TeX than to Info, that's why +.I texi2html +converts @iftex sections and not @ifinfo ones by default. You can reverse +this with the \-expandinfo option. +.SH OPTIONS +.TP 12 +.B \-check +Check the given file and give the list of all things that may be Texinfo commands. +This may be used to check the output of +.I texi2html +to find the Texinfo commands that have been left in the HTML file. +.TP +.B \-expandinfo +Expand @ifinfo sections, not @iftex ones. +.TP +.B \-glossary +Use the section named 'Glossary' to build a list of terms and put links in the HTML +document from each term toward its definition. +.TP +.B \-invisible \fIname\fP +Use \fIname\fP to create invisible destination anchors for index links. This is a workaround +for a known bug of many WWW browsers, including xmosaic. +.TP +.B \-I \fIdir\fP +Look also in \fIdir\fP to find included files. +.TP +.B \-menu +Show the Texinfo menus; by default they are ignored. +.TP +.B \-monolithic +Output only one file, including the table of contents and footnotes. +.TP +.B \-number +Number the sections. +.TP +.B \-split_chapter +Split the output into several HTML files (one per main section: +chapter, appendix...). +.TP +.B \-split_node +Split the output into several HTML files (one per node). +.TP +.B \-usage +Print usage instructions, listing the current available command-line options. +.TP +.B \-verbose +Give a verbose output. Can be used with the +.B \-check +option. +.PP +.SH FILES +By default +.I texi2html +creates the following files (foo being the name of the Texinfo file): +.TP 16 +.B foo_toc.html +The table of contents. +.TP +.B foo.html +The document's contents. +.TP +.B foo_foot.html +The footnotes (if any). +.PP +When used with the +.B \-split +option, it creates several files (one per chapter or node), named +.B foo_n.html +(n being the indice of the chapter or node), instead of the single +.B foo.html +file. +.PP +When used with the +.B \-monolithic +option, it creates only one file: +.B foo.html +.SH VARIABLES +.I texi2html +predefines the following variables: \fBhtml\fP, \fBtexi2html\fP. +.SH ADDITIONAL COMMANDS +.I texi2html +implements the following non-Texinfo commands: +.TP 16 +.B @ifhtml +This indicates the start of an HTML section, this section will passed through +without any modofication. +.TP +.B @end ifhtml +This indcates the end of an HTML section. +.SH VERSION +This is \fItexi2html\fP version 1.51, 09/10/96. +.PP +The latest version of \fItexi2html\fP can be found in WWW, cf. URL +http://wwwcn.cern.ch/dci/texi2html/ +.SH AUTHOR +The main author is Lionel Cons, CERN CN/DCI/UWS, Lionel.Cons@cern.ch. +Many other people around the net contributed to this program. +.SH COPYRIGHT +This program is the intellectual property of the European +Laboratory for Particle Physics (known as CERN). No guarantee whatsoever is +provided by CERN. No liability whatsoever is accepted for any loss or damage +of any kind resulting from any defect or inaccuracy in this information or +code. +.PP +CERN, 1211 Geneva 23, Switzerland +.SH "SEE ALSO" +GNU Texinfo Documentation Format, +HyperText Markup Language (HTML), +World Wide Web (WWW). +.SH BUGS +This program does not understand all Texinfo commands (yet). +.PP +TeX specific commands (normally enclosed in @iftex) will be +passed unmodified. +.ex diff --git a/glabels2/barcode-0.98/ean.c b/glabels2/barcode-0.98/ean.c new file mode 100644 index 00000000..0801a0ef --- /dev/null +++ b/glabels2/barcode-0.98/ean.c @@ -0,0 +1,774 @@ +/* + * ean.c -- encoding for ean, upc and isbn + * + * Copyright (c) 1999 Alessandro Rubini + * Copyright (c) 1999 Prosa Srl. + * Copyright (c) 2001 Boszormenyi Zoltan + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +/* + * IMPORTANT NOTE: if you are reading this file to learn how to add a + * new encoding type, this is the wrong place as there are too many + * special cases. Please refer to code39.c instead. If you want to + * learn how UPC, EAN, ISBN work, on the other hand, I did my best to + * commend things and hope you enjoy it. + */ + +/* + * These following static arrays are used to describe the barcode. + * + * The various forms of UPC and EAN are documented as using three + * different alphabets to encode the ten digits. However, each digit + * has exactly one encoding; only, it is sometimes mirrored. Moreover, + * if you represent the width of each symbol (bar/space) instead of + * the sequence of 1's and 0's, you find that even-parity and odd-parity + * encoding are exactly the same. So, here are the digits: */ +static char *digits[] = { + "3211","2221","2122","1411","1132", + "1231","1114","1312","1213","3112"}; + +/* + * What EAN encoding does is adding a leading digit (the 13th digit). + * Such an extra digit is encoded by mirroring three of the six digits that + * appear in the left half of the UPC code. Here how mirroring works: + */ +static char *ean_mirrortab[] = { + "------","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E (the 6-digit one), instead, encodes the check character as + * a mirroring of the symbols. This is similar, but the encoding for "0" is + * different (EAN uses no mirroring for "0" to be compatible with UPC). + * The same rule is used for UPC-5 (the supplemental digits for ISBN) + */ +static char *upc_mirrortab[] = { + "---111","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E mirroring for encoding "1" + */ +static char *upc_mirrortab1[] = { + "111---","11-1--","11--1-","11---1","1-11--", + "1--11-","1---11","1-1-1-","1-1--1","1--1-1" +}; + +/* UPC-2 has just two digits to mirror */ +static char *upc_mirrortab2[] = { + "11","1-","-1","--" +}; + +/* + * initial, middle, final guard bars (first symbol is a a space). + * EAN-13 overwrites the first "0" with "9" to make space for the extra digit. + */ +static char *guard[] = {"0a1a","1a1a1","a1a"}; + +/* initial, final guard bars for UPC-E*/ +static char *guardE[] = {"0a1a","1a1a1a"}; + +/* initial and inter-char guard bars for supplementals (first is space) */ +static char *guardS[] = {"9112","11"}; + +/* + * These functions are shortcuts I use in the encoding engine + */ +static int ean_make_checksum(char *text, int mode) +{ + int esum = 0, osum = 0, i; + int even=1; /* last char is even */ + + if (strchr(text, ' ')) + i = strchr(text, ' ') - text; /* end of first part */ + else + i = strlen(text); /* end of all */ + + while (i-- > 0) { + if (even) esum += text[i]-'0'; + else osum += text[i]-'0'; + even = !even; + } + if (!mode) { /* standard upc/ean checksum */ + i = (3*esum + osum) % 10; + return (10-i) % 10; /* complement to 10 */ + } else { /* add-5 checksum */ + i = (3*esum + 9*osum); + return i%10; + } +} + +/* + * Check that the text can be encoded. Returns 0 or -1. + * Accept: + * 13 or 12 digits: EAN-13 w/ or w/o checksum + * or + * 8 or 7 digits: EAN-8 w/ or w/o checksum. + * For both EAN-13 and EAN-8, accept an addon of 2 or 5 digits, + * separated by ' ' + */ +int Barcode_ean_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; i= '5' && text[10] <= '9') { + memcpy(&result[1], text+1, 5); + result[6] = text[10]; + } else { + return NULL; + } + result[7] = chksum + '0'; + + return result; +} + +/* + * UPC-A is the same as EAN, but accept + * 12 or 11 digits (UPC-A w/ or w/o checksum) + * or accept UPC-E as: + * 6 digits (w/o number system and checksum): number system '0' assumed, + * 7 digits (either w/o number system or checksum), + * 8 digits (w/ number system and checksum) + * plus the 2 or 5-digit add-on + */ +int Barcode_upc_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; iascii) { + bc->error = EINVAL; + return -1; + } + + /* Find out whether the barcode has addon and + * the length of the barcode w/o the addon. + */ + len = strlen(bc->ascii); + spc = strchr(bc->ascii, ' '); + if (spc) { + len0 = spc - bc->ascii; + addon = strlen(spc + 1); + if (addon != 2 && addon != 5) { + bc->error = EINVAL; /* impossible, actually */ + return -1; + } + } else { + len0 = len; + addon = 0; + } + + if (!bc->encoding) { + /* ISBN already wrote what it is; if unknown, find it out */ + + /* + * Do not decide only by barcode length, it may be ambiguous. + * Anyway, either the user specified the barcode type or + * we already found a fitting one. + */ + switch(bc->flags & BARCODE_ENCODING_MASK) { + case BARCODE_EAN: + switch (len0) { + case 7: case 8: + bc->encoding = strdup("EAN-8"); + encoding = EAN8; + break; + case 12: case 13: + bc->encoding = strdup("EAN-13"); + encoding = EAN13; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + + case BARCODE_UPC: + switch (len0) { + case 6: case 7: case 8: + bc->encoding = strdup("UPC-E"); + encoding = UPCE; + break; + case 11: case 12: + bc->encoding = strdup("UPC-A"); + encoding = UPCA; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + default: + /* else, it's wrong (impossible, as the text is checked) */ + bc->error = -EINVAL; + return -1; + } + } + + /* better safe than sorry */ + if (bc->partial) free(bc->partial); bc->partial = NULL; + if (bc->textinfo) free(bc->textinfo); bc->textinfo = NULL; + + if (encoding == UPCA) { /* add the leading 0 (not printed) */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else if (encoding == UPCE) { + strcpy(text, upc_a_to_e(upc_e_to_a(bc->ascii))); + } else { + strcpy(text, bc->ascii); + } + + /* + * build the checksum and the bars: any encoding is slightly different + */ + if (encoding == UPCA || encoding == EAN13 || encoding == ISBN) { + if (!(encoding == UPCA && len0 == 12) && + !(encoding == EAN13 && len0 == 13)) { + checksum = ean_make_checksum(text, 0); + text[12] = '0' + checksum; /* add it to the text */ + text[13] = '\0'; + } + + strcpy(partial, guard[0]); + if (encoding == EAN13 || encoding == ISBN) { /* The first digit */ + sprintf(tptr,"0:12:%c ",text[0]); + tptr += strlen(tptr); + partial[0] = '9'; /* extra space for the digit */ + } else if (encoding == UPCA) + partial[0] = '9'; /* UPC has one digit before the symbol, too */ + xpos = width_of_partial(partial); + mirror = ean_mirrortab[text[0]-'0']; + + /* left part */ + for (i=1;i<7;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i-1] == '1') { + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + /* + * Write the ascii digit. UPC has a special case + * for the first digit, which is out of the bars + */ + if (encoding == UPCA && i==1) { + sprintf(tptr, "0:10:%c ", text[i]); + tptr += strlen(tptr); + ptr1[1] += 'a'-'1'; /* bars are long */ + ptr1[3] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + /* count the width of the symbol */ + xpos += 7; /* width_of_partial(ptr2) */ + } + + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=7;i<13;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + /* + * Ascii digit. Once again, UPC has a special + * case for the last digit + */ + if (encoding == UPCA && i==12) { + sprintf(tptr, "%i:10:%c ", xpos+13, text[i]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + xpos += 7; /* width_of_partial(ptr2) */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + xpos += width_of_partial(guard[2]); + + } else if (encoding == UPCE) { + checksum = text[7] - '0'; + + strcpy(partial, guardE[0]); + partial[0] = '9'; /* UPC-A has one digit before the symbol, too */ + xpos = width_of_partial(partial); + + /* UPC-E has the number system written before the bars. */ + sprintf(tptr, "0:10:%c ", text[0]); + tptr += strlen(tptr); + + if (text[0] == '0') + mirror = upc_mirrortab[checksum]; + else + mirror = upc_mirrortab1[checksum]; + + for (i=0;i<6;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i+1]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i] != '1') { /* negated wrt EAN13 */ + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + sprintf(tptr, "%i:12:%c ", xpos, text[i+1]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(ptr2) */ + } + + sprintf(tptr, "%i:10:%c ", xpos+10, text[7]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guardE[1]); /* end */ + + } else { /* EAN-8 almost identical to EAN-13 but no mirroring */ + + if (len0 != 8) { + checksum = ean_make_checksum(text, 0); + text[7] = '0' + checksum; /* add it to the text */ + text[8] = '\0'; + } + + strcpy(partial, guard[0]); + xpos = width_of_partial(partial); + + /* left part */ + for (i=0;i<4;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=4;i<8;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + } + + /* + * And that's it. Now, in case some add-on is specified it + * must be encoded too. Look for it. + */ + if ( (ptr1 = spc) ) { + ptr1++; + strcpy(text, ptr1); + if (strlen(ptr1)==5) { + checksum = ean_make_checksum(text, 1 /* special way */); + mirror = upc_mirrortab[checksum]+1; /* only last 5 digits */ + } else { + checksum = atoi(text)%4; + mirror = upc_mirrortab2[checksum]; + } + strcat(textinfo, " +"); strcat(partial, "+"); + tptr = textinfo + strlen(textinfo); + for (i=0; ipartial = strdup(partial); + if (!bc->partial) { + bc->error = errno; + return -1; + } + bc->textinfo = strdup(textinfo); + if (!bc->textinfo) { + bc->error = errno; + free(bc->partial); + bc->partial = NULL; + return -1; + } + if (!bc->width) + bc->width = width_of_partial(partial); + + return 0; /* success */ +} + +int Barcode_upc_encode(struct Barcode_Item *bc) +{ + return Barcode_ean_encode(bc); /* UPC is folded into EAN */ +} + +int Barcode_isbn_encode(struct Barcode_Item *bc) +{ + /* For ISBN we must normalize the string and prefix "978" */ + unsigned char *text = malloc(24); /* 13 + ' ' + 5 plus some slack */ + unsigned char *otext; + int i, j, retval; + + if (!text) { + bc->error = ENOMEM; + return -1; + } + strcpy(text, "978"); j=3; + + otext = bc->ascii; + for (i=0; otext[i]; i++) { + if (isdigit(otext[i])) + text[j++] = otext[i]; + if (j == 12) /* checksum added later */ + break; + } + text[j]='\0'; + if (strchr(otext, ' ')) + strcat(text, strchr(otext, ' ')); + bc->ascii = text; + bc->encoding = strdup("ISBN"); + retval = Barcode_ean_encode(bc); + bc->ascii = otext; /* restore ascii for the ps comments */ + free(text); + return retval; +} + diff --git a/glabels2/barcode-0.98/i25.c b/glabels2/barcode-0.98/i25.c new file mode 100644 index 00000000..72bd0358 --- /dev/null +++ b/glabels2/barcode-0.98/i25.c @@ -0,0 +1,164 @@ +/* + * i25.c -- "interleaved 2 of 5" + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char *codes[] = { + "11331", "31113", "13113", "33111", "11313", + "31311", "13311", "11133", "31131", "13131" +}; + +static char *guard[] = {"a1a1", "c1a"}; /* begin end */ + +int Barcode_i25_verify(unsigned char *text) +{ + if (!text[0]) + return -1; + while (*text && isdigit(*text)) + text++; + if (*text) + return -1; /* a non-digit char */ + return 0; /* ok */ +} + +int Barcode_i25_encode(struct Barcode_Item *bc) +{ + unsigned char *text; + unsigned char *partial; /* dynamic */ + unsigned char *textinfo; /* dynamic */ + unsigned char *textptr, *p1, *p2, *pd; + int i, len, sum[2], textpos, usesum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("interleaved 2 of 5"); + + text = bc->ascii; + if (!bc->ascii) { + bc->error = EINVAL; + return -1; + } + + if ((bc->flags & BARCODE_NO_CHECKSUM)) usesum = 0; else usesum = 1; + + /* create the real text string, padded to an even number of digits */ + text = malloc(strlen(bc->ascii) + 3); /* leading 0, checksum, term. */ + if (!text) { + bc->error = errno; + return -1; + } + /* add the leading 0 if needed */ + i = strlen(bc->ascii) + usesum; + if (i % 2) { + /* add a leading 0 */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else { + strcpy(text, bc->ascii); + } + /* add the trailing checksum if needed, the leading 0 is ignored */ + if (usesum) { + sum[0] = sum[1] = 0; + for (i=0; text[i]; i++) + sum[i%2] += text[i]-'0'; + /* + * The "even" sum must be multiplied by three, and the * + * rightmost digit is defined as "even". The digits' position + * is already correct, whether or not we added a leading zero. + * (e.g., they are in pos. 0..4 or 1..4 of the string) + */ + i = sum[0] * 3 + sum[1]; + strcat(text, "0"); + text[strlen(text)-1] += (10 - (i%10)) % 10; + } + + /* the partial code is 5 * (text + check) + 4(head) + 3(tail) + term. */ + partial = malloc( (strlen(text) + 3) * 5 +2); /* be large... */ + if (!partial) { + bc->error = errno; + free(text); + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen+1) +term */ + textinfo = malloc(10*(strlen(text)+1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(text); + return -1; + } + + + strcpy(partial, "0"); /* the first space */ + strcat(partial, guard[0]); /* start */ + textpos = 4; /* width of initial guard */ + textptr = textinfo; + + len = strlen(text); + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + free(text); + return -1; + } + /* interleave two digits */ + p1 = codes[text[i]-'0']; + p2 = codes[text[i+1]-'0']; + pd = partial + strlen(partial); /* destination */ + while (*p1) { + *(pd++) = *(p1++); + *(pd++) = *(p2++); + } + *pd = '\0'; + /* and print the ascii text (but don't print the checksum, if any */ + if (usesum && strlen(text+i)==2) { + /* print only one digit, discard the checksum */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + } else { + sprintf(textptr, "%i:12:%c %i:12:%c ", textpos, text[i], + textpos+9, text[i+1]); + } + textpos += 18; /* width of two codes */ + textptr += strlen(textptr); + } + strcat(partial, guard[1]); + + bc->partial = partial; + bc->textinfo = textinfo; + free(text); + + return 0; +} + diff --git a/glabels2/barcode-0.98/install-sh b/glabels2/barcode-0.98/install-sh new file mode 100644 index 00000000..ab74c882 --- /dev/null +++ b/glabels2/barcode-0.98/install-sh @@ -0,0 +1,238 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/glabels2/barcode-0.98/library.c b/glabels2/barcode-0.98/library.c new file mode 100644 index 00000000..a8787020 --- /dev/null +++ b/glabels2/barcode-0.98/library.c @@ -0,0 +1,244 @@ +/* + * library.c -- external functions of libbarcode + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H /* sometimes (windows, for instance) it's missing */ +# include +#endif +#include + +#include "barcode.h" + +/* + * This function allocates a barcode structure and strdup()s the + * text string. It returns NULL in case of error + */ +struct Barcode_Item *Barcode_Create(char *text) +{ + struct Barcode_Item *bc; + + bc = malloc(sizeof(*bc)); + if (!bc) return NULL; + + memset(bc, 0, sizeof(*bc)); + bc->ascii = strdup(text); + bc->margin = BARCODE_DEFAULT_MARGIN; /* default margin */ + return bc; +} + + +/* + * Free a barcode structure + */ +int Barcode_Delete(struct Barcode_Item *bc) +{ + if (bc->ascii) + free(bc->ascii); + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + if (bc->encoding) + free(bc->encoding); + free(bc); + return 0; /* always success */ +} + + +/* + * The various supported encodings. This might be extended to support + * dynamic addition of extra encodings + */ +extern int Barcode_ean_verify(unsigned char *text); +extern int Barcode_ean_encode(struct Barcode_Item *bc); +extern int Barcode_upc_verify(unsigned char *text); +extern int Barcode_upc_encode(struct Barcode_Item *bc); +extern int Barcode_isbn_verify(unsigned char *text); +extern int Barcode_isbn_encode(struct Barcode_Item *bc); +extern int Barcode_39_verify(unsigned char *text); +extern int Barcode_39_encode(struct Barcode_Item *bc); +extern int Barcode_128b_verify(unsigned char *text); +extern int Barcode_128b_encode(struct Barcode_Item *bc); +extern int Barcode_128c_verify(unsigned char *text); +extern int Barcode_128c_encode(struct Barcode_Item *bc); +extern int Barcode_128_verify(unsigned char *text); +extern int Barcode_128_encode(struct Barcode_Item *bc); +extern int Barcode_128raw_verify(unsigned char *text); +extern int Barcode_128raw_encode(struct Barcode_Item *bc); +extern int Barcode_i25_verify(unsigned char *text); +extern int Barcode_i25_encode(struct Barcode_Item *bc); +extern int Barcode_cbr_verify(unsigned char *text); +extern int Barcode_cbr_encode(struct Barcode_Item *bc); +extern int Barcode_msi_verify(unsigned char *text); +extern int Barcode_msi_encode(struct Barcode_Item *bc); +extern int Barcode_pls_verify(unsigned char *text); +extern int Barcode_pls_encode(struct Barcode_Item *bc); +extern int Barcode_93_verify(unsigned char *text); +extern int Barcode_93_encode(struct Barcode_Item *bc); + + +struct encoding { + int type; + int (*verify)(unsigned char *text); + int (*encode)(struct Barcode_Item *bc); +}; + +struct encoding encodings[] = { + {BARCODE_EAN, Barcode_ean_verify, Barcode_ean_encode}, + {BARCODE_UPC, Barcode_upc_verify, Barcode_upc_encode}, + {BARCODE_ISBN, Barcode_isbn_verify, Barcode_isbn_encode}, + {BARCODE_128B, Barcode_128b_verify, Barcode_128b_encode}, + {BARCODE_128C, Barcode_128c_verify, Barcode_128c_encode}, + {BARCODE_128RAW, Barcode_128raw_verify, Barcode_128raw_encode}, + {BARCODE_39, Barcode_39_verify, Barcode_39_encode}, + {BARCODE_I25, Barcode_i25_verify, Barcode_i25_encode}, + {BARCODE_128, Barcode_128_verify, Barcode_128_encode}, + {BARCODE_CBR, Barcode_cbr_verify, Barcode_cbr_encode}, + {BARCODE_PLS, Barcode_pls_verify, Barcode_pls_encode}, + {BARCODE_MSI, Barcode_msi_verify, Barcode_msi_encode}, + {BARCODE_93, Barcode_93_verify, Barcode_93_encode}, + {0, NULL, NULL} +}; + +/* + * A function to encode a string into bc->partial, ready for + * postprocessing to the output file. Meaningful bits for "flags" are + * the encoding mask and the no-checksum flag. These bits + * get saved in the data structure. + */ +int Barcode_Encode(struct Barcode_Item *bc, int flags) +{ + int validbits = BARCODE_ENCODING_MASK | BARCODE_NO_CHECKSUM; + struct encoding *cptr; + + /* If any flag is cleared in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_ENCODING_MASK)) + flags |= bc->flags & BARCODE_ENCODING_MASK; + if (!(flags & BARCODE_NO_CHECKSUM)) + flags |= bc->flags & BARCODE_NO_CHECKSUM; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (!(flags & BARCODE_ENCODING_MASK)) { + /* get the first code able to handle the text */ + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->verify((unsigned char *)bc->ascii)==0) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* no code can handle this text */ + return -1; + } + flags |= cptr->type; /* this works */ + bc->flags |= cptr->type; + } + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->type == (flags & BARCODE_ENCODING_MASK)) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* invalid barcode type */ + return -1; + } + if (cptr->verify(bc->ascii) != 0) { + bc->error = EINVAL; + return -1; + } + return cptr->encode(bc); +} + + +/* + * When multiple output formats are supported, there will + * be a jumpt table like the one for the types. Now we don't need it + */ +extern int Barcode_ps_print(struct Barcode_Item *bc, FILE *f); +extern int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f); + +/* + * A function to print a partially decoded string. Meaningful bits for + * "flags" are the output mask etc. These bits get saved in the data + * structure. + */ +int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags) +{ + int validbits = BARCODE_OUTPUT_MASK | BARCODE_NO_ASCII + | BARCODE_OUT_NOHEADERS; + + /* If any flag is clear in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_OUTPUT_MASK)) + flags |= bc->flags & BARCODE_OUTPUT_MASK; + if (!(flags & BARCODE_NO_ASCII)) + flags |= bc->flags & BARCODE_NO_ASCII; + if (!(flags & BARCODE_OUT_NOHEADERS)) + flags |= bc->flags & BARCODE_OUT_NOHEADERS; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (bc->flags & BARCODE_OUT_PCL) + return Barcode_pcl_print(bc, f); + return Barcode_ps_print(bc, f); +} + +/* + * Choose the position + */ +int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef) +{ + bc->width = wid; bc->height = hei; + bc->xoff = xoff; bc->yoff = yoff; + bc->scalef = scalef; + return 0; +} + +/* + * Do it all in one step + */ +int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags) +{ + struct Barcode_Item * bc; + + if (!(bc=Barcode_Create(text))) { + errno = -ENOMEM; + return -1; + } + if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 + || Barcode_Encode(bc, flags) < 0 + || Barcode_Print(bc, f, flags) < 0) { + errno = bc->error; + Barcode_Delete(bc); + return -1; + } + Barcode_Delete(bc); + return 0; +} + +/* + * Return the version + */ + +int Barcode_Version(char *vptr) +{ + if (vptr) + strcpy(vptr, BARCODE_VERSION); + return BARCODE_VERSION_INT; +} diff --git a/glabels2/barcode-0.98/main.c b/glabels2/barcode-0.98/main.c new file mode 100644 index 00000000..e07e4d3c --- /dev/null +++ b/glabels2/barcode-0.98/main.c @@ -0,0 +1,604 @@ +/* + * main.c - a commandline frontend for the barcode library + * + * Copyright (c) 1999 Michele Comitini (mcm@glisco.it) + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include + +#include "cmdline.h" +#include "barcode.h" + +#ifndef NO_LIBPAPER +#include +#endif + +/* + * Most of this file deals with command line options, by exploiting + * the cmdline.[ch] engine to offer defaults via environment variables + * and handling functions for complex options. + * + * In order to offer a friendly interface (for those who feel the + * cmdline *is* friendly, like me), we have to convert names to enums... + */ + +struct { + char *name; + int type; +} encode_tab[] = { + {"ean", BARCODE_EAN}, + {"ean13", BARCODE_EAN}, + {"ean-13", BARCODE_EAN}, + {"ean8", BARCODE_EAN}, + {"ean-8", BARCODE_EAN}, + {"upc", BARCODE_UPC}, + {"upc-a", BARCODE_UPC}, + {"upc-e", BARCODE_UPC}, + {"isbn", BARCODE_ISBN}, + {"39", BARCODE_39}, + {"code39", BARCODE_39}, + {"128c", BARCODE_128C}, + {"code128c", BARCODE_128C}, + {"128b", BARCODE_128B}, + {"code128b", BARCODE_128B}, + {"128", BARCODE_128}, + {"code128", BARCODE_128}, + {"128raw", BARCODE_128RAW}, + {"i25", BARCODE_I25}, + {"interleaved 2 of 5", BARCODE_I25}, + {"cbr", BARCODE_CBR}, + {"codabar", BARCODE_CBR}, + {"msi", BARCODE_MSI}, + {"pls", BARCODE_PLS}, + {"plessey", BARCODE_PLS}, + {"code93", BARCODE_93}, + {"93", BARCODE_93}, + + {NULL, 0} +}; + +/* + * Get encoding type from string rapresentation. + * Returns -1 on error. + */ +#ifndef HAVE_STRCASECMP /* some libs (windows, for example) have stricmp */ +# define strcasecmp stricmp +#endif + +int encode_id(char *encode_name) +{ + int i; + for (i = 0; encode_tab[i].name; i++) + if (!strcasecmp(encode_tab[i].name, encode_name)) + return encode_tab[i].type; + return -1; +} + +int list_encodes(FILE *f) /* used in the help message */ +{ + int prev = -1; + int i; + + fprintf(f, "Known encodings are (synonyms appear on the same line):"); + for (i = 0; encode_tab[i].name; i++) { + if (encode_tab[i].type != prev) + fprintf(f, "\n\t"); + else + fprintf(f, ", "); + fprintf(f, "\"%s\"", encode_tab[i].name); + prev = encode_tab[i].type; + } + fprintf(f, "\n"); + return 0; +} + + +/* + * Variables to hold cmdline arguments (or defaults) + */ + +char *ifilename, *ofilename; +int encoding_type; /* filled by get_encoding() */ +int code_width, code_height; /* "-g" for standalone codes */ +int lines, columns; /* "-t" for tables */ +int xmargin0, ymargin0; /* both for "-g" and "-t" */ +int xmargin1, ymargin1; /* same, but right and top */ +int ximargin, yimargin; /* "-m": internal margins */ +int eps, pcl, ps, noascii, nochecksum; /* boolean flags */ +int page_wid, page_hei; /* page size in points */ +char *page_name; /* name of the media */ +double unit = 1.0; /* unit specification */ + +char *prgname; /* used to print error msgs, initialized to argv[0] by main */ + +/* + * Functions to handle command line arguments + */ + +struct encode_item { + char *string; + struct encode_item *next; +} *list_head, *list_tail; + +/* each "-b" option adds a string to the input pool allocating its space */ +int get_input_string(void *arg) +{ + struct encode_item *item = malloc(sizeof(*item)); + if (!item) { + fprintf(stderr, "%s: malloc: %s\n", prgname, strerror(errno)); + return -2; + } + item->string = strdup(arg); + if (!list_head) { + list_head = list_tail = item; + } else { + list_tail->next = item; + list_tail = item; + } + item->next = NULL; + return 0; +} + +/* and this function extracts strings from the pool */ +unsigned char *retrieve_input_string(FILE *ifile) +{ + char *string; + static char fileline[128]; + + struct encode_item *item = list_head; + if (list_tail) { /* this means at least one "-b" was specified */ + if (!item) + return NULL; /* the list is empty */ + string = item->string; + list_head = item->next; + free(item); + return string; + } + + /* else, read from the file */ + if (!fgets(fileline, 128, ifile)) + return NULL; + if (fileline[strlen(fileline)-1]=='\n') + fileline[strlen(fileline)-1]= '\0'; + return strdup(fileline); +} + +/* accept a unit specification */ +int get_unit(void *arg) +{ + static struct { + char *str; + double unit; + } *ptr, unittab[] = { + {"pt", 1.0}, + {"in", 72.0}, + {"cm", 72.0/2.54}, + {"mm", 72.0/25.4}, + {NULL, 0.0} + }; + + for (ptr = unittab; ptr->str && strcmp((char *)arg, ptr->str); ptr++) + ; + unit = ptr->unit; + if (ptr->str) return 0; + + fprintf(stderr, "%s: incorrect unit \"%s\" (use one of", + prgname, (char *)arg); + for (ptr = unittab; ptr->str; ptr++) + fprintf(stderr, " \"%s\"", ptr->str); + fprintf(stderr, ")\n"); + return -2; +} + +/* convert an encoding name to an encoding integer code */ +int get_encoding(void *arg) +{ + encoding_type = encode_id((char *)arg); + if (encoding_type >=0) return 0; + fprintf(stderr, "%s: wrong encoding \"%s\"\n", prgname, + (char *)arg); + return -2; /* error, no help */ +} + +/* convert a geometry specification */ +int get_geometry(void *arg) +{ + double w = 0.0, h = 0.0; + double x = 0.0, y = 0.0; + int n; + + if (((char *)arg)[0]=='+') { + n = sscanf((char *)arg, "+%lf+%lf%s", &x, &y, (char *)arg); + } else { + n = sscanf((char *)arg, "%lfx%lf+%lf+%lf%s", &w, &h, &x, &y, + (char *)arg); + } + if (n!=4 && n!=2) { + fprintf(stderr, "%s: wrong geometry \"%s\"\n", prgname, (char *)arg); + return -2; + } + /* convert to points */ + code_width = w * unit; + code_height = h * unit; + xmargin0 = x * unit; + ymargin0 = y * unit; + return 0; +} + +/* convert a geometry specification */ +int get_table(void *arg) +{ + double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0; + int n; + + n = sscanf((char *)arg, "%dx%d+%lf+%lf-%lf-%lf", + &columns, &lines, &x0, &y0, &x1, &y1); + + if (n==1 || n==3) { /* error: 2, 4, 5, 6 are fine */ + fprintf(stderr, "%s: wrong table specification \"%s\"\n", prgname, + (char *)arg); + return -2; + } + if (n < 6) y1 = y0; /* symmetric by default */ + if (n < 5) x1 = x0; + + /* convert and return */ + xmargin0 = x0 * unit; + ymargin0 = y0 * unit; + xmargin1 = x1 * unit; + ymargin1 = y1 * unit; + return 0; +} + +/* convert an internal margin specification */ +int get_margin(void *arg) +{ + char separator; + double x,y; + int n; + + /* accept one number or two, separated by any char */ + n = sscanf((char *)arg, "%lf%c%lf", &x, &separator, &y); + + if (n==1) { + n=3; y = x; + } + if (n==3) { + ximargin = x * unit; + yimargin = y * unit; + return 0; + } + fprintf(stderr, "%s: wrong margin specification \"%s\"\n", prgname, + (char *)arg); + return -2; + return 0; +} + +/* convert a page geometry specification */ +int get_page_geometry(void *arg) +{ + int n; + double dpw, dph; /* page width, height in mm or inches */ + static char tmpstr[20]; + page_name = arg; /* if undecipherable, we won't run the program :) */ + /* + * try to decode a "mm" string (eg. "210mmx297mm" or "210x297mm") + */ + n = sscanf((char *)arg, "%lfmmx%lf", &dpw, &dph); + if (n != 2 && strlen(arg)<20) { + n = sscanf((char *)arg, "%lfx%lf%s", &dpw, &dph, tmpstr); + if (n == 3 && !strcmp(tmpstr, "mm")) { + /* Ok, convert to points: 1in is 25.4mm, 1in is also 72p */ + page_wid = (int)(dpw / 25.4 * 72.0 + 0.5); + page_hei = (int)(dph / 25.4 * 72.0 + 0.5); + return 0; + } + } + + /* + * try to decode an "in" string (eg. "8.5inx11in" or "8.5x11in") + */ + n = sscanf((char *)arg, "%lfinx%lf", &dpw, &dph); + if (n != 2 && strlen(arg)<20) { + n = sscanf((char *)arg, "%lfx%lf%s", &dpw, &dph, tmpstr); + if (n == 3 && !strcmp(tmpstr, "in")) { + page_wid = (int)(dpw * 72.0 + 0.5); /* round to points */ + page_hei = (int)(dph * 72.0 + 0.5); + return 0; + } + } + + /* + * try to decode a numeric specification + */ + n = sscanf((char *)arg, "%lfx%lf", &dpw, &dph); + if (n == 2) { + page_wid = dpw * unit; + page_hei = dph * unit; + if (unit != 1.0) { /* rebuild the page name */ + page_name = malloc(32); /* big, to avoid snprintf, missing on HP */ + if (page_name) + sprintf(page_name, "%dx%d\n", page_wid, page_hei); + } + return 0; + } + +#ifndef NO_LIBPAPER + /* + * try to use libpaper, since it is available + */ + { + const struct paper* paptr; + + paperinit(); + paptr = paperinfo(arg); + if (!paptr) { /* unknown name */ + paperdone(); + return -1; + } + page_wid = (int)(paperpswidth(paptr) + 0.5); + page_hei = (int)(paperpsheight(paptr) + 0.5); + paperdone(); + return 0; + } +#endif + /* If we got here, the argument is undecipherable: fail */ + fprintf(stderr, "%s: wrong page size specification \"%s\"\n", prgname, + (char *)arg); + return -2; +} + +/* + * The table of possible arguments + */ +struct commandline option_table[] = { + {'i', CMDLINE_S, &ifilename, NULL, NULL, NULL, + "input file (strings to encode), default is stdin"}, + {'o', CMDLINE_S, &ofilename, NULL, NULL, NULL, + "output file, default is stdout"}, + {'b', CMDLINE_S, NULL, get_input_string, NULL, NULL, + "string to encode (use input file if missing)"}, + {'e', CMDLINE_S, NULL, get_encoding, "BARCODE_ENCODING", NULL, + "encoding type (default is best fit for first string)"}, + {'u', CMDLINE_S, NULL, get_unit, "BARCODE_UNIT", NULL, + "unit (\"mm\", \"in\", ...) used to decode -g, -t, -p"}, + {'g', CMDLINE_S, NULL, get_geometry, "BARCODE_GEOMETRY", NULL, + "geometry on the page: [x][++]"}, + {'t', CMDLINE_S, NULL, get_table, "BARCODE_TABLE", NULL, + "table geometry: x[++]"}, + {'m', CMDLINE_S, NULL, get_margin, "BARCODE_MARGIN", "10", + "internal margin for each item in a table: [,]"}, + {'n', CMDLINE_NONE, &noascii, NULL, NULL, NULL, + "\"numeric\": avoid printing text along with the bars"}, + {'c', CMDLINE_NONE, &nochecksum, NULL, NULL, NULL, + "no Checksum character, if the chosen encoding allows it"}, + {'E', CMDLINE_NONE, &eps, NULL, NULL, NULL, + "print one code as eps file (default: multi-page ps)"}, + {'P', CMDLINE_NONE, &pcl, NULL, NULL, NULL, + "create PCL output instead of postscript"}, + {'p', CMDLINE_S, NULL, get_page_geometry, NULL, NULL, + "page size (refer to the man page)"}, + {0,} +}; + +#ifdef NO_STRERROR +/* + * A strerror replacement (thanks to Thad Floryan ) + */ +char *strerror(int error) +{ + static char msg[16]; + if (error >= 0 && error < sys_nerr) + return sys_errlist[error]; + sprintf(msg, "Error %d", error); + return msg; +} +#endif + +/* + * The main function + */ +int main(int argc, char **argv) +{ + struct Barcode_Item * bc; + FILE *ifile = stdin; + FILE *ofile = stdout; + char *line; + int flags=0; /* for the library */ + int page, retval; + + prgname = argv[0]; + + /* First of all, accept "--help" and "-h" as a special case */ + if (argc == 2 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h"))) { + commandline_errormsg(stderr, option_table, argv[0], "Options:\n"); + fprintf(stderr,"\n"); + list_encodes(stderr); + exit(1); + } + /* Also, accept "--version" as a special case */ + if (argc == 2 && (!strcmp(argv[1],"--version"))) { + printf("barcode frontend (GNU barcode) " BARCODE_VERSION "\n"); + exit(0); + } + + /* Otherwise, parse the commandline */ + retval = commandline(option_table, argc, argv, "Use: %s [options]\n"); + if (retval) { + if (retval == -1) /* help printed, complete it */ + list_encodes(stderr); + else /* no help printed, suggest it */ + fprintf(stderr, "%s: try \"%s --help\"\n", prgname, prgname); + exit(1); + } + + /* If no paper size has been specified, use the default, if any */ + if (!page_name) { + page_wid = 595; page_hei = 842; + page_name = "A4"; /* I live in Europe :) */ +#ifndef NO_LIBPAPER + get_page_geometry(systempapername()); /* or the system default */ +#endif + } + + /* FIXME: print warnings for incompatible options */ + + /* open the input stream if specified */ + if (ifilename) + ifile = fopen(ifilename,"r"); + if (!ifile) { + fprintf(stderr, "%s: %s: %s\n", argv[0], ifilename, + strerror(errno)); + exit(1); + } + + /* open the output stream if specified */ + if (ofilename) + ofile = fopen(ofilename,"w"); + if (!ofile) { + fprintf(stderr, "%s: %s: %s\n", argv[0], ofilename, + strerror(errno)); + exit(1); + } + + if (encoding_type < 0) { /* unknown type specified */ + fprintf(stderr,"%s: Unknown endoding. Try \"%s --help\"\n", + argv[0], argv[0]); + exit(1); + } + flags |= encoding_type; + if (pcl) { + flags |= BARCODE_OUT_PCL; + } else { + ps = !eps; /* a shortcut */ + if (eps) + flags |= BARCODE_OUT_EPS; /* print headers too */ + else + flags |= BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + } + if (noascii) + flags |= BARCODE_NO_ASCII; + if (nochecksum) + flags |= BARCODE_NO_CHECKSUM; + + /* the table is not available in eps mode */ + if (eps && (lines>1 || columns>1)) { + fprintf(stderr, "%s: can't print tables in EPS format\n",argv[0]); + exit(1); + } + + if (ps) { /* The header is independent of single/table mode */ + /* Headers. Don't let the library do it, we may need multi-page */ + fprintf(ofile, "%%!PS-Adobe-2.0\n"); + /* It would be nice to know the bounding box. Leave it alone */ + fprintf(ofile, "%%%%Creator: \"barcode\", " + "libbarcode sample frontend\n"); + if (page_name) + fprintf(ofile, "%%%%DocumentPaperSizes: %s\n", page_name); + fprintf(ofile, "%%%%EndComments\n"); + fprintf(ofile, "%%%%EndProlog\n\n"); + } + + /* + * Here we are, ready to work. Handle the one-per-page case first, + * as it is shorter. + */ + if (!lines && !columns) { + page = 0; + while ( (line = retrieve_input_string(ifile)) ) { + page++; + if (ps) { + fprintf(ofile, "%%%%Page: %i %i\n\n",page,page); + } + if (Barcode_Encode_and_Print(line, ofile, code_width, code_height, + xmargin0, ymargin0, flags) < 0) { + fprintf(stderr, "%s: can't encode \"%s\"\n", argv[0], line); + } + if (eps) break; /* if output is eps, do it once only */ + if (ps) fprintf(ofile, "showpage\n"); + if (pcl) fprintf(ofile, "\f"); + } + /* no more lines, print footers */ + if (ps) { + fprintf(ofile, "%%%%Trailer\n\n"); + } + } else { + + /* table mode, the header has been already printed */ + + int xstep = (page_wid - xmargin0 - xmargin1)/columns; + int ystep = (page_hei - ymargin0 - ymargin1)/lines; + int x = columns, y = -1; /* position in the table, start off-page */ + + if (!ximargin) ximargin = BARCODE_DEFAULT_MARGIN; + if (!yimargin) yimargin = BARCODE_DEFAULT_MARGIN; + /* Assign default size unless -g did it (Joachim Reichelt) */ + if ( !code_width && !code_height) { + code_width = xstep - 2*ximargin; + code_height = ystep - 2*yimargin; + } + + page=0; + while ( (line = retrieve_input_string(ifile)) ) { + x++; /* fit x and y */ + if (x >= columns) { + x=0; y--; + if (y<0) { + y = lines-1; page++; + /* flush page */ + if (ps && page > 1) fprintf(ofile, "showpage\n"); + if (pcl && page > 1) fprintf(ofile, "\f"); + /* new page */ + if (ps) fprintf(ofile, "%%%%Page: %i %i\n\n",page,page); + } + } + + /* + * Create a barcode item. This allows to set the margin to 0, as + * we have [xy]imargin to use. But don't use Encode_and_Print(), + * unroll it here instead + */ + bc = Barcode_Create(line); + if (!bc) { + fprintf(stderr, "%s: Barcode_Create(): %s\n", argv[0], + strerror(errno)); + exit(1); + } + bc->margin = 0; + if ( (Barcode_Position(bc, code_width, code_height, + xmargin0 + ximargin + x * xstep, + ymargin0 + yimargin + y * ystep, 0.0) < 0) + || (Barcode_Encode(bc, flags) < 0) + || (Barcode_Print(bc, ofile, flags) < 0) ) { + fprintf(stderr, "%s: can't encode \"%s\": %s\n", argv[0], + line, strerror(bc->error)); + } + Barcode_Delete(bc); + } + if (ps) fprintf(ofile, "showpage\n\n%%%%Trailer\n\n"); + if (pcl) fprintf(ofile, "\f"); + } + return 0; +} + + + diff --git a/glabels2/barcode-0.98/missing b/glabels2/barcode-0.98/missing new file mode 100755 index 00000000..d46f79f6 --- /dev/null +++ b/glabels2/barcode-0.98/missing @@ -0,0 +1,198 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.in; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`$configure_ac'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`$configure_ac'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`$configure_ac'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/glabels2/barcode-0.98/mkinstalldirs b/glabels2/barcode-0.98/mkinstalldirs new file mode 100755 index 00000000..6b3b5fc5 --- /dev/null +++ b/glabels2/barcode-0.98/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/glabels2/barcode-0.98/msi.c b/glabels2/barcode-0.98/msi.c new file mode 100644 index 00000000..77a373b2 --- /dev/null +++ b/glabels2/barcode-0.98/msi.c @@ -0,0 +1,155 @@ +/* + * msi.c -- encoding for MSI-Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* Patterns */ +static char *patterns[] = { "13", "31" }; + +static char *fillers[] = { "031", "131" }; + +static int width = 16 /* each character uses 4 patterns */, + startpos = 6 /* length of the first filler */; + +/* + * Check that the text can be encoded. Returns 0 or -1. + */ +int Barcode_msi_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!isdigit(text[i])) + return -1; + } + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[(code >> 3) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 1) & 1], + patterns[code & 1]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_msi_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("msi"); + + if ((bc->flags & BARCODE_NO_CHECKSUM)) + usesum = 0; + else + usesum = 1; + + text = bc->ascii; + + /* the partial code is head + 8 * (text + check) + tail + margin + term. */ + partial = malloc( 3 + 8 * (strlen(text) + 1) + 3 + 2 ); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; ipartial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/pcl.c b/glabels2/barcode-0.98/pcl.c new file mode 100644 index 00000000..d5ec097a --- /dev/null +++ b/glabels2/barcode-0.98/pcl.c @@ -0,0 +1,200 @@ +/* + * pcl.c -- printing the "partial" bar encoding in PCL format + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Andrea Scopece (a.scopece@tin.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? See file "ps.c" + */ + + +int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + char font_id[6]; /* default font, should be "scalable" */ + /* 0 Line printer, use on older LJet II, isn't scalable */ + /* 4148 Univers, use on LJet III series, and Lj 4L, 5L */ + /* 16602 Arial, default LJ family 4, 5, 6, Color, Djet */ + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + +#if 0 + /* If too small (5 + text), enlarge and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + int hei = i * scalef; + bc->yoff -= (hei-bc->height)/2; + bc->height = hei; + if (bc->yoff < 0) { + bc->height += -bc->yoff; + bc->yoff = 0; + } + } +#else + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } +#endif + + /* + * deal with PCL output + */ + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + + fprintf(f,"%c&a%.0fH", 27, x0 * 10.0); + fprintf(f,"%c&a%.0fV", 27, y0 * 10.0); + fprintf(f,"%c*c%.0fH", 27, ((j*scalef)-SHRINK_AMOUNT) * 10.0); + fprintf(f,"%c*c%.0fV", 27, yr * 10.0); + fprintf(f,"%c*c0P\n", 27); + } + xpos += j * scalef; + } + + /* the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + /* select a Scalable Font */ + + if (fsav != f2) + { + if ((bc->flags & BARCODE_OUT_PCL_III) == BARCODE_OUT_PCL_III) + { strcpy(font_id, "4148"); /* font Univers */ + } + else + { strcpy(font_id, "16602"); /* font Arial */ + } + + fprintf(f,"%c(8U%c(s1p%5.2fv0s0b%sT", 27, 27, f2 * scalef, font_id); + } + fsav = f2; + + fprintf(f,"%c&a%.0fH", 27, (bc->xoff + f1 * scalef + bc->margin) * 10.0); + fprintf(f,"%c&a%.0fV", 27, + mode != '-' + ? ((double)bc->yoff + bc->margin + 8*scalef) * 10.0 + : ((double)bc->yoff + bc->margin + bc->height ) * 10.0); + + fprintf(f, "%c", c); + } + + } + + return 0; +} diff --git a/glabels2/barcode-0.98/plessey.c b/glabels2/barcode-0.98/plessey.c new file mode 100644 index 00000000..ec471005 --- /dev/null +++ b/glabels2/barcode-0.98/plessey.c @@ -0,0 +1,164 @@ +/* + * plessey.c -- encoding for Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char * patterns[] = { "13", "31" }; + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "ABCDEF"; + +/* stop sequence may be 231311313 (barcodemill.com) */ +static char *fillers[] = { "031311331", "331311313" }; + +static int width = 16, startpos = 16; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_pls_verify(unsigned char *text) +{ + int i, upper = 0, lower = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!strchr(alphabet,toupper(text[i]))) + return -1; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + } + if (upper && lower) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[code & 1], + patterns[(code >> 1) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 3) & 1] + ); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_pls_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + unsigned char *checkptr; + int i, code, textpos; + static char check[9] = {1,1,1,1,0,1,0,0,1}; + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("plessey"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 4) * 8 + 3); + checkptr = calloc (1, strlen(text) * 4 + 8); + + if (!partial || !checkptr) { + if (partial) free(partial); + if (checkptr) free(checkptr); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += width; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + checkptr[4*i] = code & 1; + checkptr[4*i+1] = (code >> 1) & 1; + checkptr[4*i+2] = (code >> 2) & 1; + checkptr[4*i+3] = (code >> 3) & 1; + } + /* The CRC checksum is required */ + for (i=0; i < 4*strlen(text); i++) { + int j; + if (checkptr[i]) + for (j = 0; j < 9; j++) + checkptr[i+j] ^= check[j]; + } + for (i = 0; i < 8; i++) { + sprintf(ptr, patterns[checkptr[strlen(text) * 4 + i]]); + ptr += 2; + } + fprintf(stderr, "CRC: "); + for (i = 0; i < 8; i++) { + fputc('0' + checkptr[strlen(text) * 4 + i], stderr); + } + fputc('\n', stderr); + strcpy(ptr, fillers[1]); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/ps.c b/glabels2/barcode-0.98/ps.c new file mode 100644 index 00000000..35917517 --- /dev/null +++ b/glabels2/barcode-0.98/ps.c @@ -0,0 +1,272 @@ +/* + * ps.c -- printing the "partial" bar encoding + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? + * + * The first char in "partial" tells how much extra space to add to the + * left of the bars. For EAN-13, it is used to leave space to print the + * first digit, other codes may have '0' for no-extra-space-needed. + * + * The next characters are alternating bars and spaces, as multiples + * of the base dimension which is 1 unless the code is + * rescaled. Rescaling is calculated as the ratio from the requested + * width and the calculated width. Digits represent bar/space + * dimensions. Lower-case letters represent those bars that should + * extend lower than the others: 'a' is equivalent to '1', 'b' is '2' and + * so on. + * + * The "textinfo" string is made up of fields "%lf:%lf:%c" separated by + * blank space. The first integer is the x position of the character, + * the second is the font size (before rescaling) and the char item is + * the charcter to be printed. + * + * Both the "partial" and "textinfo" strings may include "-" or "+" as + * special characters (in "textinfo" the char should be a standalone + * word). They state where the text should be printed: below the bars + * ("-", default) or above the bars. This is used, for example, to + * print the add-5 and add-2 codes to the right of UPC or EAN codes + * (the add-5 extension is mostly used in ISBN codes. + */ + + +int Barcode_ps_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen, printable=1; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + +#if 0 + /* If too small (5 + text), enlarge and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + int hei = i * scalef; + bc->yoff -= (hei-bc->height)/2; + bc->height = hei; + if (bc->yoff < 0) { + bc->height += -bc->yoff; + bc->yoff = 0; + } + } +#else + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } +#endif + + /* + * Ok, then deal with actual ps (eps) output + */ + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { /* spit a header first */ + if (bc->flags & BARCODE_OUT_EPS) + fprintf(f, "%%!PS-Adobe-2.0 EPSF-1.2\n"); + else + fprintf(f, "%%!PS-Adobe-2.0\n"); + fprintf(f, "%%%%Creator: libbarcode\n"); + if (bc->flags & BARCODE_OUT_EPS) { + fprintf(f, "%%%%BoundingBox: %i %i %i %i\n", + bc->xoff, + bc->yoff, + bc->xoff + bc->width + 2* bc->margin, + bc->yoff + bc->height + 2* bc->margin); + } + fprintf(f, "%%%%EndComments\n"); + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f, "%%%%EndProlog\n\n"); + fprintf(f, "%%%%Page: 1 1\n\n"); + } + } + + /* Print some informative comments */ + for (i=0; bc->ascii[i]; i++) + if (bc->ascii[i] < ' ') + printable = 0; + + fprintf(f,"%% Printing barcode for \"%s\", scaled %5.2f", + printable ? bc->ascii : "", scalef); + if (bc->encoding) + fprintf(f,", encoded using \"%s\"",bc->encoding); + fprintf(f, "\n"); + fprintf(f,"%% The space/bar succession is represented " + "by the following widths (space first):\n" + "%% "); + for (i=0; ipartial); i++) { + unsigned char c = bc->partial[i]; + if (isdigit(c)) putc(c, f); + if (islower(c)) putc(c-'a'+'1', f); + if (isupper(c)) putc(c-'A'+'1', f); + } + /* open array for "forall" */ + fprintf(f, "\n[\n%% height xpos ypos width" + " height xpos ypos width\n"); + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos + (j*scalef)/2; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + y0 += (isdigit(*ptr) ? 10 : 5) * scalef; + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + /* Define an array and then use "forall" (Hans Schou) */ + fprintf(f," [%5.2f %6.2f %6.2f %5.2f]%s", + yr, x0, y0, (j * scalef) - SHRINK_AMOUNT, + i%4 == 1 ? " " : "\n"); + } + xpos += j * scalef; + } + fprintf(f,"\n]\t{ {} forall setlinewidth moveto 0 exch rlineto stroke} " + "bind forall\n"); + + /* Then, the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + fprintf(f, "[\n%% char xpos ypos fontsize\n"); + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + fprintf(f, " [("); + /* Both the backslash and the two parens are special */ + if (c=='\\' || c==')' || c=='(') + fprintf(f, "\\%c) ", c); + else + fprintf(f, "%c) ", c); + fprintf(f, "%6.2f %6.2f %5.2f]\n", + bc->xoff + f1 * scalef + bc->margin, + mode == '-' + ? (double)bc->yoff + bc->margin + : (double)bc->yoff + bc->margin+bc->height - 8*scalef, + fsav == f2 ? 0.0 : f2 * scalef); + fsav = f2; + } + fprintf(f,"] { {} forall dup 0.00 ne {\n\t" + "/Helvetica findfont exch scalefont setfont\n" + " } {pop} ifelse\n" + " moveto show} bind forall\n"); + + + } + + fprintf(f,"%% End barcode for \"%s\"\n\n", + printable ? bc->ascii : ""); + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f,"showpage\n"); + fprintf(f, "%%%%Trailer\n\n"); + } + } + return 0; +} + + + + diff --git a/glabels2/barcode-0.98/sample.c b/glabels2/barcode-0.98/sample.c new file mode 100644 index 00000000..46e62058 --- /dev/null +++ b/glabels2/barcode-0.98/sample.c @@ -0,0 +1,98 @@ +#include +#include + +#include "barcode.h" + +int main(int argc, char **argv) +{ + int ps = 1, pcl = 0, oflags; + if (argc == 2 && !strcmp(argv[1],"-P")) { + ps = 0; pcl = 1; argc=1; + } + if (argc>2) { + fprintf(stderr, "%s: use \"%s\" for postscript or \"%s -P\" for PCL\n", + argv[0], argv[0], argv[0]); + exit(1); + } + if (pcl) { + oflags = BARCODE_OUT_PCL; + } else { + oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + printf("%%!PS-Adobe-2.0\n"); + printf("%%%%Creator: barcode sample program\n"); + printf("%%%%EndComments\n"); + printf("%%%%EndProlog\n\n"); + printf("%%%%Page: 1 1\n\n"); + } + /* Print a few barcodes in several places in the page */ + + /* default size, bottom left */ + Barcode_Encode_and_Print("800894002700",stdout, 0, 0, 40, 40, + BARCODE_EAN | oflags); + + /* smaller */ + Barcode_Encode_and_Print("800894002700",stdout, 70, 50, 160, 55, + BARCODE_EAN | oflags); + + /* smallest */ + Barcode_Encode_and_Print("800894002700",stdout, 40, 30, 270, 70, + BARCODE_EAN | oflags); + + /* A bigger all-0 */ + Barcode_Encode_and_Print("000000000000",stdout, 170, 0, 40, 160, + BARCODE_EAN | oflags); + + /* Still bigger all-0 (but UPC, this time) */ + Barcode_Encode_and_Print("00000000000",stdout, 250, 0, 270, 160, + BARCODE_UPC | oflags); + + /* A few code-39 ones */ + Barcode_Encode_and_Print("silly code",stdout, 0, 0, 40, 320, + BARCODE_39 | oflags); + Barcode_Encode_and_Print("SAMPLE CODES",stdout, 100, 30, 400, 80, + BARCODE_39 | oflags); + + /* ISBN with add-5 */ + Barcode_Encode_and_Print("1-56592-292-1 90000",stdout, 0, 0, 40, 430, + BARCODE_ISBN | oflags); + + /* UPC with add-2 */ + Barcode_Encode_and_Print("07447084452 07",stdout, 0, 0, 300, 410, + BARCODE_UPC | oflags); + + /* code 128-C */ + Barcode_Encode_and_Print("12345678900123456789",stdout, 0, 0, 40, 530, + BARCODE_128C | oflags); + + /* and my data as code-128B autodetected */ + Barcode_Encode_and_Print("RBNLSN68T11E897W",stdout, 0, 60, 240, 510, + oflags); + /* same as code-39, forced */ + Barcode_Encode_and_Print("RBNLSN68T11E897W",stdout, 0, 60, 240, 590, + BARCODE_NO_CHECKSUM | BARCODE_39 | oflags); + + /* one interleaved 2 of 5 */ + Barcode_Encode_and_Print("0123456789",stdout, 0, 0, 40, 620, + BARCODE_I25 | oflags); + + /* upc-e and ean-8 (autotected based on code size) */ + Barcode_Encode_and_Print("012345",stdout, 0, 0, 50, 720, oflags); + Barcode_Encode_and_Print("0123456",stdout, 0, 0, 160, 720, oflags); + + + + if (pcl) { + printf("\f"); + } else { + printf("\nshowpage\n"); + printf("%%%%Trailer\n\n"); + } + return 0; +} + + + + + + + diff --git a/glabels2/config.h.in b/glabels2/config.h.in new file mode 100644 index 00000000..bceba424 --- /dev/null +++ b/glabels2/config.h.in @@ -0,0 +1,154 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef PACKAGE +#undef VERSION +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR +#undef GETTEXT_PACKAGE +#undef HACKTEXT + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define if using `alloca.c'. */ +#undef C_ALLOCA + +/* always defined to indicate that i18n is enabled */ +#undef ENABLE_NLS + +/* Define if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Define if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if your file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT + +/* Define if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT + +/* Define if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY + +/* Name of package */ +#undef PACKAGE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `long' if does not define. */ +#undef off_t + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/glabels2/configure b/glabels2/configure new file mode 100755 index 00000000..d6f01ddf --- /dev/null +++ b/glabels2/configure @@ -0,0 +1,6303 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52 for glabels 1.89.0. +# +# Report bugs to . +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="src/glabels.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subdirs_all="$ac_subdirs_all barcode-0.98" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME='glabels' +PACKAGE_TARNAME='glabels' +PACKAGE_VERSION='1.89.0' +PACKAGE_STRING='glabels 1.89.0' +PACKAGE_BUGREPORT='http://sourceforge.net/tracker/?func=add&group_id=46122&atid=445116' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF +glabels configure 1.89.0 +generated by GNU Autoconf 2.52 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:878: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:889: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:897: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:913: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:917: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:923: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:925: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:927: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:946: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:948: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:968: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:971: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:997: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1017: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1066: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:1077: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:1100: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { { echo "$as_me:1113: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest* +echo "$as_me:1120: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +echo "$as_me:1135: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:1155: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:1159: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +PACKAGE=glabels + +VERSION=1.89.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { { echo "$as_me:1169: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <>confdefs.h <&5 +echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$as_me:1190: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$as_me:1194: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1198: checking for working autoconf" >&5 +echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$as_me:1205: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$as_me:1209: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1213: checking for working automake" >&5 +echo $ECHO_N "checking for working automake... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$as_me:1220: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$as_me:1224: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1228: checking for working autoheader" >&5 +echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$as_me:1235: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$as_me:1239: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1243: checking for working makeinfo" >&5 +echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$as_me:1250: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$as_me:1254: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1258: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:1267: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + +ac_config_headers="$ac_config_headers config.h" + +ac_config_commands="$ac_config_commands default-1" + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:1285: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:1302: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:1313: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:1316: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + have_pkgconfig=no + if test -x "$PKG_CONFIG" ; then + have_pkgconfig=yes + else + PKG_CONFIG= + fi + echo "$as_me:1326: checking for pkg-config" >&5 +echo $ECHO_N "checking for pkg-config... $ECHO_C" >&6 + pkgconfig_required_version=0.8.0 + if test x$have_pkgconfig = xyes ; then + $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version + if test $? -ne 0; then + echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + have_pkgconfig=no + fi + fi + if test x$have_pkgconfig = xyes ; then + echo "$as_me:1338: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + PKG_CONFIG= + echo "$as_me:1342: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + if test xfail = xfail; then + { { echo "$as_me:1345: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&5 +echo "$as_me: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&2;} + { (exit 1); exit 1; }; } + fi + fi + + if test xyes = xyes ; then + platform_gnome_2_default=yes + else + platform_gnome_2_default=no + fi + if test xforce = xforce ; then + platform_gnome_2="$platform_gnome_2_default"; + else + # Check whether --enable-platform-gnome-2 or --disable-platform-gnome-2 was given. +if test "${enable_platform_gnome_2+set}" = set; then + enableval="$enable_platform_gnome_2" + platform_gnome_2="$enableval" +else + platform_gnome_2="$platform_gnome_2_default" +fi; + fi + +if test $platform_gnome_2 = yes; then + PLATFORM_GNOME_2_TRUE= + PLATFORM_GNOME_2_FALSE='#' +else + PLATFORM_GNOME_2_TRUE='#' + PLATFORM_GNOME_2_FALSE= +fi + + echo "$as_me:1382: checking for GNOME Platform" >&5 +echo $ECHO_N "checking for GNOME Platform... $ECHO_C" >&6 + if test $platform_gnome_2 = yes; then + echo "$as_me:1385: result: GNOME 2.x" >&5 +echo "${ECHO_T}GNOME 2.x" >&6 + GNOME_INTERFACE_VERSION=2 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:1391: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:1408: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:1419: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:1422: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + have_pkgconfig=no + if test -x "$PKG_CONFIG" ; then + have_pkgconfig=yes + else + PKG_CONFIG= + fi + echo "$as_me:1432: checking for pkg-config" >&5 +echo $ECHO_N "checking for pkg-config... $ECHO_C" >&6 + pkgconfig_required_version=0.8.0 + if test x$have_pkgconfig = xyes ; then + $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version + if test $? -ne 0; then + echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + have_pkgconfig=no + fi + fi + if test x$have_pkgconfig = xyes ; then + echo "$as_me:1444: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + PKG_CONFIG= + echo "$as_me:1448: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + if test xfail = xfail; then + { { echo "$as_me:1451: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&5 +echo "$as_me: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&2;} + { (exit 1); exit 1; }; } + fi + fi + + else + echo "$as_me:1464: result: GNOME 1.x" >&5 +echo "${ECHO_T}GNOME 1.x" >&6 + GNOME_INTERFACE_VERSION=1 + fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1477: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1492: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1500: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1503: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1512: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1527: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1535: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1538: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1551: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1566: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1574: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1577: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1586: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1601: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1609: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1612: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1625: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1645: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1667: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1670: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1681: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1696: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1704: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1707: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1720: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1735: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1743: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1746: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1758: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1763:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1766: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:1769: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1771: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:1774: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1776: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:1779: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1783 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1799: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1802: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1805: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1828: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1834: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1839: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1845: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1848: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1855: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1863: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1870: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1872: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1875: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1877: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1880: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1896: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1902: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1908: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1914 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1926: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1929: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1941: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1948: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1952: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1958 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1973: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1976: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1979: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1982: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1994: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:2000: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2006 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2018: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2021: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2024: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2027: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2037: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2064: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2067: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2070: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2073: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 2085 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2098: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2101: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2104: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2107: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 2117 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2129: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2132: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2135: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2138: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + echo "$as_me:2165: checking for strerror in -lcposix" >&5 +echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6 +if test "${ac_cv_lib_cposix_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2173 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2192: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2195: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2198: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2201: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_cposix_strerror=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_cposix_strerror=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2212: result: $ac_cv_lib_cposix_strerror" >&5 +echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6 +if test $ac_cv_lib_cposix_strerror = yes; then + LIBS="$LIBS -lcposix" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:2226: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:2241: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2249: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2252: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:2261: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:2276: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:2284: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:2287: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:2300: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:2315: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2323: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2326: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:2335: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:2350: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:2358: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:2361: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:2374: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:2394: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2416: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2419: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:2430: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:2445: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2453: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2456: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2469: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:2484: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:2492: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:2495: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:2507: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:2512:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:2515: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:2518: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:2520: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:2523: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:2525: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:2528: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:2531: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2537 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2552: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2555: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2558: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2561: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:2573: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:2579: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2585 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2597: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2600: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2603: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2606: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2616: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2643: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2646: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2649: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2652: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 2664 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2677: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2680: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2683: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2686: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 2696 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2708: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2711: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2714: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2717: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:2744: checking for ${CC-cc} option to accept ANSI C" >&5 +echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 +if test "${am_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + cat >conftest.$ac_ext <<_ACEOF +#line 2761 "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; + +int +main () +{ + +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2803: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2806: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2809: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2812: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_prog_cc_stdc="$ac_arg"; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +CC="$ac_save_CC" + +fi + +if test -z "$am_cv_prog_cc_stdc"; then + echo "$as_me:2826: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 +else + echo "$as_me:2829: result: $am_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$am_cv_prog_cc_stdc" >&6 +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:2842: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2863 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2868: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2874: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2897 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2901: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2907: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2944: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2954 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2959: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2965: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2988 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2992: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2998: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:3026: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:3037: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3043 "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:3051: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:3057: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 3079 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 3097 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 3118 "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:3144: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3147: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:3149: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3152: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:3165: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + if test -z "" ; then + default_compile_warnings=no + else + default_compile_warnings="" + fi + + # Check whether --enable-compile-warnings or --disable-compile-warnings was given. +if test "${enable_compile_warnings+set}" = set; then + enableval="$enable_compile_warnings" + enable_compile_warnings="$enableval" +else + enable_compile_warnings="$default_compile_warnings" +fi; + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall -Wunused" + ;; + yes) + warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" + ;; + maximum|error) + warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wsign-promo -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + echo "$as_me:3213: checking whether gcc understands $option" >&5 +echo $ECHO_N "checking whether gcc understands $option... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 3216 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3228: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3231: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3234: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3237: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + has_option=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +has_option=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + echo "$as_me:3247: result: $has_option" >&5 +echo "${ECHO_T}$has_option" >&6 + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + { { echo "$as_me:3261: error: Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" >&5 +echo "$as_me: error: Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + CFLAGS="$realsave_CFLAGS" + echo "$as_me:3267: checking what warning flags to pass to the C compiler" >&5 +echo $ECHO_N "checking what warning flags to pass to the C compiler... $ECHO_C" >&6 + echo "$as_me:3269: result: $warning_flags" >&5 +echo "${ECHO_T}$warning_flags" >&6 + + # Check whether --enable-iso-c or --disable-iso-c was given. +if test "${enable_iso_c+set}" = set; then + enableval="$enable_iso_c" + +else + enable_iso_c=no +fi; + + echo "$as_me:3280: checking what language compliance flags to pass to the C compiler" >&5 +echo $ECHO_N "checking what language compliance flags to pass to the C compiler... $ECHO_C" >&6 + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *\ \ -ansi\ \ *) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *\ \ -pedantic\ \ *) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + echo "$as_me:3295: result: $complCFLAGS" >&5 +echo "${ECHO_T}$complCFLAGS" >&6 + + WARN_CFLAGS="$warning_flags $complCFLAGS" + +GNOME_X_CHECKS + +# Extract the first word of "glib-genmarshal", so it can be a program name with args. +set dummy glib-genmarshal; ac_word=$2 +echo "$as_me:3304: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GLIB_GENMARSHAL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GLIB_GENMARSHAL in + [\\/]* | ?:[\\/]*) + ac_cv_path_GLIB_GENMARSHAL="$GLIB_GENMARSHAL" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GLIB_GENMARSHAL="$ac_dir/$ac_word" + echo "$as_me:3321: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +GLIB_GENMARSHAL=$ac_cv_path_GLIB_GENMARSHAL + +if test -n "$GLIB_GENMARSHAL"; then + echo "$as_me:3332: result: $GLIB_GENMARSHAL" >&5 +echo "${ECHO_T}$GLIB_GENMARSHAL" >&6 +else + echo "$as_me:3335: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +GTK_REQUIRED=2.0.5 +LIBGNOMEUI_REQUIRED=2.0.1 +LIBXML_REQUIRED=2.4.23 +LIBGNOMEPRINT_REQUIRED=1.115.0 +LIBGNOMEPRINTUI_REQUIRED=1.115.0 +LIBGNOMECANVAS_REQUIRED=2.0.1 +GDKPIXBUF_REQUIRED=2.0.5 + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:3352: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:3369: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:3381: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:3384: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:3398: checking for gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED" >&5 +echo $ECHO_N "checking for gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED" ; then + echo "$as_me:3420: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:3424: checking GLABELS_CFLAGS" >&5 +echo $ECHO_N "checking GLABELS_CFLAGS... $ECHO_C" >&6 + GLABELS_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED"` + echo "$as_me:3433: result: $GLABELS_CFLAGS" >&5 +echo "${ECHO_T}$GLABELS_CFLAGS" >&6 + + echo "$as_me:3436: checking GLABELS_LIBS" >&5 +echo $ECHO_N "checking GLABELS_LIBS... $ECHO_C" >&6 + GLABELS_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED"` + echo "$as_me:3445: result: $GLABELS_LIBS" >&5 +echo "${ECHO_T}$GLABELS_LIBS" >&6 + else + GLABELS_CFLAGS="" + GLABELS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GLABELS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED"` + echo $GLABELS_PKG_ERRORS + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + : + else + { { echo "$as_me:3471: error: Library requirements (gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 +echo "$as_me: error: Library requirements (gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} + { (exit 1); exit 1; }; } + fi + +GETTEXT_PACKAGE=glabels + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:3513: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:3521: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:3524: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:3533: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:3548: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:3557: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:3560: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +echo "$as_me:3569: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 3577 "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:3626: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3629: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3632: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3635: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:3652: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:3655: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:3660: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3666 "configure" +#include "confdefs.h" + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3724: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3727: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3730: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3733: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3743: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\EOF +#define const +EOF + +fi + +echo "$as_me:3753: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +#line 3761 "configure" +#include "confdefs.h" +#ifndef __cplusplus +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3770: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3773: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3776: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3779: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:3790: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in + inline | yes) ;; + no) +cat >>confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3817 "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3823: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3826: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3829: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3832: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3842: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3858 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3873: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3876: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3879: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3882: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3892: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3910 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3925: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3928: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3931: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3934: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3944: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3964 "configure" +#include "confdefs.h" +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3976: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3979: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3982: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3985: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_working_alloca_h=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3995: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo "$as_me:4005: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4011 "configure" +#include "confdefs.h" +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4043: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4046: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4049: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4052: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_alloca_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_alloca_works=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4062: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 + +if test $ac_cv_func_alloca_works = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=alloca.$ac_objext + +cat >>confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + +echo "$as_me:4083: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4089 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +echo "$as_me:4107: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4112: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4118 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4149: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4152: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4155: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4158: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4168: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4191 "configure" +#include "confdefs.h" +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + exit (find_stack_direction () < 0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4214: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4217: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4219: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4222: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_stack_direction=1 +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_stack_direction=-1 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:4234: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4252 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4256: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4262: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4281: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4300 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4331: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4334: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4337: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4340: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4350: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat >conftest.$ac_ext <<_ACEOF +#line 4369 "configure" +#include "confdefs.h" +$ac_includes_default +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include +#include + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4496: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4499: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4501: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4504: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:4516: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi +rm -f conftest.mmap + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:4531: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4537 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4541: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4547: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4566: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4586 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4617: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4620: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4623: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4626: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4636: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4653 "configure" +#include "confdefs.h" +#include +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4665: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4668: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4671: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4674: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4684: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + USE_NLS=yes + + nls_cv_force_use_gnu_gettext="no" + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + echo "$as_me:4704: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4710 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:4714: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4720: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_libintl_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_libintl_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4739: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 +if test $ac_cv_header_libintl_h = yes; then + echo "$as_me:4742: checking for dgettext in libc" >&5 +echo $ECHO_N "checking for dgettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_dgettext_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4748 "configure" +#include "confdefs.h" +#include +int +main () +{ +return (int) dgettext ("","") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4760: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4763: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4766: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4769: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_dgettext_libc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +gt_cv_func_dgettext_libc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4779: result: $gt_cv_func_dgettext_libc" >&5 +echo "${ECHO_T}$gt_cv_func_dgettext_libc" >&6 + + if test "$gt_cv_func_dgettext_libc" != "yes"; then + echo "$as_me:4783: checking for bindtextdomain in -lintl" >&5 +echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 4791 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char bindtextdomain (); +int +main () +{ +bindtextdomain (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4810: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4813: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4816: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4819: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_bindtextdomain=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_intl_bindtextdomain=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4830: result: $ac_cv_lib_intl_bindtextdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6 +if test $ac_cv_lib_intl_bindtextdomain = yes; then + echo "$as_me:4833: checking for dgettext in libintl" >&5 +echo $ECHO_N "checking for dgettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_dgettext_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + echo "$as_me:4838: checking for dgettext in -lintl" >&5 +echo $ECHO_N "checking for dgettext in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_dgettext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 4846 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dgettext (); +int +main () +{ +dgettext (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4865: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4868: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4871: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4874: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_dgettext=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_intl_dgettext=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4885: result: $ac_cv_lib_intl_dgettext" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_dgettext" >&6 +if test $ac_cv_lib_intl_dgettext = yes; then + gt_cv_func_dgettext_libintl=yes +else + gt_cv_func_dgettext_libintl=no +fi + +fi +echo "$as_me:4894: result: $gt_cv_func_dgettext_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_dgettext_libintl" >&6 +fi + + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + LIBS="$LIBS -lintl"; + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + +cat >>confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:4913: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$as_me:4940: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:4943: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + if test "$MSGFMT" != "no"; then + +for ac_func in dcgettext +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4951: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4957 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* 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_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4988: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4991: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4994: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4997: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5007: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + echo "$as_me:5036: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:5048: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:5051: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:5057: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$as_me:5084: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:5087: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + cat >conftest.$ac_ext <<_ACEOF +#line 5092 "configure" +#include "confdefs.h" + +int +main () +{ +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5105: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5108: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5111: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5114: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + INSTOBJEXT=.mo + fi + fi + + # Added by Martin Baulig 12/15/98 for libc5 systems + if test "$gt_cv_func_dgettext_libc" != "yes" \ + && test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS=-lintl + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + fi + +fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" != "yes"; then + +cat >>confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + else + CATOBJEXT= + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$as_me:5157: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + ac_config_commands="$ac_config_commands default-2" + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo "$as_me:5177: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + echo "$as_me:5186: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + test -d po || mkdir po + if test "$CATOBJEXT" = ".cat"; then + echo "$as_me:5197: checking for linux/version.h" >&5 +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_version_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5203 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:5207: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5213: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_linux_version_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_linux_version_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:5232: result: $ac_cv_header_linux_version_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 +if test $ac_cv_header_linux_version_h = yes; then + msgformat=linux +else + msgformat=xopen +fi + + sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + +if test "x${prefix}" = "xNONE"; then + cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h <confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:5367: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:5543: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:5562: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me (glabels 1.89.0) 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/pixmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/pixmaps/Makefile" ;; + "src/stock-pixmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/stock-pixmaps/Makefile" ;; + "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/C/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/C/Makefile" ;; + "glabels.spec" ) CONFIG_FILES="$CONFIG_FILES glabels.spec" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "default-2" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-2" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:5615: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@PLATFORM_GNOME_2_TRUE@,$PLATFORM_GNOME_2_TRUE,;t t +s,@PLATFORM_GNOME_2_FALSE@,$PLATFORM_GNOME_2_FALSE,;t t +s,@GNOME_INTERFACE_VERSION@,$GNOME_INTERFACE_VERSION,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t +s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t +s,@GLABELS_CFLAGS@,$GLABELS_CFLAGS,;t t +s,@GLABELS_LIBS@,$GLABELS_LIBS,;t t +s,@GETTEXT_PACKAGE@,$GETTEXT_PACKAGE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t +s,@DATADIRNAME@,$DATADIRNAME,;t t +s,@GMOFILES@,$GMOFILES,;t t +s,@INSTOBJEXT@,$INSTOBJEXT,;t t +s,@INTLDEPS@,$INTLDEPS,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@INTLOBJS@,$INTLOBJS,;t t +s,@POFILES@,$POFILES,;t t +s,@POSUB@,$POSUB,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@subdirs@,$subdirs,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:5861: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:5879: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:5892: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:5953: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:5964: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:5977: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:6094: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + default-2 ) case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac ;; + esac +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d $srcdir/$ac_subdir || continue + + { echo "$as_me:6215: configuring in $ac_subdir" >&5 +echo "$as_me: configuring in $ac_subdir" >&6;} + case $srcdir in + .) ;; + *) { case "./$ac_subdir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="./$ac_subdir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + if test -d ./$ac_subdir; then :; + else + { { echo "$as_me:6237: error: cannot create \`pwd\`/$ac_subdir" >&5 +echo "$as_me: error: cannot create \`pwd\`/$ac_subdir" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_subdir + + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + ac_sub_configure="$SHELL '$ac_sub_srcdir/configure.gnu'" + elif test -f $ac_sub_srcdir/configure; then + ac_sub_configure="$SHELL '$ac_sub_srcdir/configure'" + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + { echo "$as_me:6268: WARNING: no configuration information is in $ac_subdir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_dots$cache_file ;; + esac + + { echo "$as_me:6282: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" >&5 +echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" >&6;} + # The eval makes quoting arguments work. + eval $ac_sub_configure $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir || + { { echo "$as_me:6287: error: $ac_sub_configure failed for $ac_subdir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_subdir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd $ac_popdir + done +fi + +echo " + +Configuration: + + Source code location: ${srcdir} + Compiler: ${CC} + +" diff --git a/glabels2/configure.in b/glabels2/configure.in new file mode 100644 index 00000000..3938d7b9 --- /dev/null +++ b/glabels2/configure.in @@ -0,0 +1,97 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(glabels, 1.89.0, http://sourceforge.net/tracker/?func=add&group_id=46122&atid=445116) +AC_CONFIG_SRCDIR(src/glabels.c) +AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) + +AM_MAINTAINER_MODE +AM_CONFIG_HEADER(config.h) + +GNOME_PLATFORM_GNOME_2(yes, force) + +AC_ISC_POSIX +AC_PROG_CC +AM_PROG_CC_STDC +AC_HEADER_STDC + +GNOME_COMPILE_WARNINGS +GNOME_X_CHECKS + +AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + + +dnl ******************************************************************* +dnl * Check for required package and version +dnl ******************************************************************* +dnl Minimum versions of libraries +GTK_REQUIRED=2.0.5 +LIBGNOMEUI_REQUIRED=2.0.1 +LIBXML_REQUIRED=2.4.23 +LIBGNOMEPRINT_REQUIRED=1.115.0 +LIBGNOMEPRINTUI_REQUIRED=1.115.0 +LIBGNOMECANVAS_REQUIRED=2.0.1 +GDKPIXBUF_REQUIRED=2.0.5 + +PKG_CHECK_MODULES(GLABELS, gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED) +AC_SUBST(GLABELS_CFLAGS) +AC_SUBST(GLABELS_LIBS) + +dnl **************************************** +dnl * Supported languages +dnl **************************************** +dnl Add the languages which your application supports here. +GETTEXT_PACKAGE=glabels +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE") +ALL_LINGUAS="fr de ja pt_BR" +AM_GLIB_GNU_GETTEXT + + +dnl **************************************** +dnl * Set PACKAGE_LOCALE_DIR in config.h. +dnl **************************************** +if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale") + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/${DATADIRNAME}") +else + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale") + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/${DATADIRNAME}") +fi + + +dnl **************************************** +dnl * Configure barcode library +dnl **************************************** +AC_CONFIG_SUBDIRS(barcode-0.98) + + + +dnl **************************************** +dnl * Makefiles +dnl **************************************** +AC_OUTPUT([ +Makefile +src/Makefile +src/pixmaps/Makefile +src/stock-pixmaps/Makefile +po/Makefile.in +doc/Makefile +doc/C/Makefile +glabels.spec +]) + + +echo " + +Configuration: + + Source code location: ${srcdir} + Compiler: ${CC} + +" diff --git a/glabels2/cvswrappers b/glabels2/cvswrappers new file mode 100644 index 00000000..755951d6 --- /dev/null +++ b/glabels2/cvswrappers @@ -0,0 +1 @@ +*.png -k 'b' diff --git a/glabels2/data/predefined-labels.template b/glabels2/data/predefined-labels.template new file mode 100644 index 00000000..5ada0103 --- /dev/null +++ b/glabels2/data/predefined-labels.template @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/glabels2/glabels.desktop b/glabels2/glabels.desktop new file mode 100644 index 00000000..0459cb15 --- /dev/null +++ b/glabels2/glabels.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=gLabels +Name[ja]=gLabels +Comment=Create Labels & Business Cards +Comment[ja]=¥é¥Ù¥ë¤È¥Ó¥¸¥Í¥¹¥«¡¼¥É¤ÎºîÀ®¥×¥í¥°¥é¥à +Exec=glabels +Icon=glabels/glabels-icon.png +Terminal=0 +Type=Application diff --git a/glabels2/glabels.spec.in b/glabels2/glabels.spec.in new file mode 100644 index 00000000..9ff85051 --- /dev/null +++ b/glabels2/glabels.spec.in @@ -0,0 +1,57 @@ +%define name @PACKAGE@ +%define ver @VERSION@ +%define RELEASE 1 +%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} +%define prefix /usr +%define sysconfdir /etc + +Summary: glabels is a GNOME program to create labels and business cards +Name: %name +Version: %ver +Release: %rel +Copyright: GPL +Group: Applications/Graphics +Source: glabels-%{ver}.tar.gz +URL: http://snaught.com/glabels/ +BuildRoot: /var/tmp/glabels-%{PACKAGE_VERSION}-root + +Requires: gtk+ >= 1.3 +Requires: gnome-libs >= 1.108 +Requires: gnome-print >= 1.109 +Requires: gdk-pixbuf >= 1.3 + +%description +gLabels is a lightweight program for creating labels and +business cards for the GNOME desktop environment. +It is designed to work with various laser/ink-jet peel-off +label and business card sheets that you'll find at most office +supply stores. + + +%prep +%setup + +%build +CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure --prefix=%{prefix} +make + +%install +rm -rf $RPM_BUILD_ROOT + +make prefix=$RPM_BUILD_ROOT%{prefix} install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) +%doc README COPYING ChangeLog NEWS AUTHORS INSTALL +%{prefix}/bin/glabels +%{prefix}/bin/glabels-batch +%{prefix}/share/* + + +%changelog +* Sat May 19 2001 Jim Evins +- Created + diff --git a/glabels2/install-sh b/glabels2/install-sh new file mode 100755 index 00000000..e9de2384 --- /dev/null +++ b/glabels2/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the 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. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/glabels2/missing b/glabels2/missing new file mode 100755 index 00000000..7789652e --- /dev/null +++ b/glabels2/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/glabels2/mkinstalldirs b/glabels2/mkinstalldirs new file mode 100755 index 00000000..6b3b5fc5 --- /dev/null +++ b/glabels2/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/glabels2/pixmaps/glabels-about-logo.png b/glabels2/pixmaps/glabels-about-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6f5d852805f001798803c7f9b522160d5d988a91 GIT binary patch literal 12949 zcmW+-2Q*vn8#ZEvV?=6isZ~WawKqYmHi}A%+G@5jYpoST#Lz4`Kv=Xu^YQBU+Vz${<_0s=5nQ%xT@M*@c(IVtcw^%+b8oJcLT zHPi@h|GR%`E=mNhP`uGZyAcpjLjF4lf6oM50T;>Kk-7-7-^3sg9naqqj-N9f^E~<_JMiu%W zVh>^|hSj*H%-N`y)4#@tefVK@U!BUlI5R~_Kkr{kNoiBcmoGmDehxH=+Pz%sXjro~ z@~ZixS@84AP5_U~wC}^$v%Uw}Yu|5A{byHbUN7ADqbDcxCm;jSJs|*(5Hf2L2F~5* zxZcu@kz`c{DV5+iyJ&7Y<8B8M#>Qy6asw?lFFZ~!y1Vf$dyFryW`2zLFux*J701Ey zrZOSFl{wo?!>@=H_lPNP_v~&W6s5cm&J-0qx6V|W%|`Ftt2{ac3I}ni4WfbS_{+v`}<3;V{B(p;e3s3ydC&CQHV|?U^X)b{R z2KNeDm&kG3-1UuA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#j!0GCM|ujm9RvLUdGB6T;`>y zBBk=Q9>N!C_TrvvTN8vC-Lj!cmvQ+H5X4{gZlou|hz{G`F1*&wc zU9V`=St4`Be^=f-jtxJ_t6_E2^vs?ng5tF`|8Y(H?t2_|CGBS$ES+AKMmUD!abK03 zp-5_x4Z1uM_e%4>!7>3bZ=4~t3l!NdMs;!BVudymab1C2#LG8ZC4OLQnEl1sy!u4s zzVz$|P;m1M*t$xf2PD)6O0Sn79*Eu9%$vK@*I8$RntknmsFG>&))la!Jjo>IB$ls?zgp9*#Llw$ulM{C%F$)~AqxRt&kKgVCwf`c`&?BWsM zRMkJKZYH%rUVDbL%_38J^?X{6pnbjigeBJ6sC0Sk=RCZfZ~l&<&B}P5wtD2ry23Nm zDgP4nBkB43AzM8GxL#}im%P01r5o>P41>i(dbd_SyRJz-?gTSSw@qt(@C|3%V^DU9 z_$a{R+Y-rxP|PAMVfz>O2MGZZp{G`^Vjl88ZZFsR literal 0 HcmV?d00001 diff --git a/glabels2/pixmaps/glabels-icon.png b/glabels2/pixmaps/glabels-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..298ea89eb4b7cf19cca8fcd3d1fb25f61bb10f2c GIT binary patch literal 660 zcmV;F0&D$=P)bUBN`EqavD~p& zvJ)C2yXXTGd1hpPW6h_*F|}=rHRB;Sfqz9wAU8?^xlt0xjgmlatUiIKFxYOll9R}_ zXxo;6ZUxpx9{9`oY3vYLb}mHJkDYTv4J@5J@S5ZQBjOb3M1ynLNpF)~{uP^C0Xh+6 zC;c(DX&7T*jJcY?+?*LdC08I2)zDA>lAG3b-H(}>Hk*ya;=K3NG>z!^Fn zc<%{-Ff)1Y0YCttX&Q-gpb5aAb za=D~@?v2@PlupziQ@c*6U0uW47PA9=$wht6xoC{SncBAP+p=8H$Wn>Kc8mRfkK^%( zx~}1zLseDD*fE%yQo0G<*joGPrj2ZTqZHu~$IKLtaIUWre22p!b<1B#5l6+d00D~( zMEo$hjmEn0(lA*l263C5`KyH)-a^nx?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2Xb&WftF+=zUC$@v(naN(@Z^z$RrHV{9-) zgv6-P7%P`xIMWz~!BeF8wV0FR=P&_jR^7djKBa%lY@Ja&GK$L1OubrKxpt+lAJD|q z%Z%A=MWrzYtMS{q{Q18Cp(-;fP#Tbu8Y_h{mQutRxsm5z6PVEHe;CQT3fGXoX|_(O zF2uKUt)TT}qcim~yS>8zmBzcEQQ4P&W~v6CcSXyG20~#EH;5c8n%-eUx z+#D5rV3hXdpP7u3VN#NsY599t`5mU6dJIP~!!GOM?><1~uaUnBWwAbc=-sB)EZ$_7 zR=UmT%+q(3#s3QI%RTg$r8;x7m7+3|R<2!HJ3x>4(`0KC`?c0cYI%mEP*iH(HfSQT zhyJz*W#6I}pSIi`)op38wSGc0a`R4eYEkB0o%UMu_OH>t+(UnP8l4oMK4nH@Cty=2 z<2z())@^BKZtjuad#DlZf)qyz1~d`UttQGIF)O88Qv)du0DJg*54E7tculGUcgo^B zopqO3yl$F?EWXFS+(R|gI<#3wE7#VxBh8NfYY1)bk>7i$hB8V?Be~pse0B?}AAm-_ zYB=@VkmB`cyvM%WLp!790(|5c8sQGr8RPW=u^@jdc;5ABRvtKkam(AK&#YWBg1 zF>hCj1Hc~s-b16J|BWn;0QT6Id#DxdEIvQNzTBCj(%jq}b!ZcISy9;|zxPmc8nuJ4 zZtyNi@ll61VV9-&9{X|+?LJMPI=!U?ZQ=xMEye5UZ2(mE$nQP$_NbKvZQ=xMEybH0 zV)pSmPFTF=?are2$(H{Q8jA`X7@yt300000NkvXXu0mjfcubUF literal 0 HcmV?d00001 diff --git a/glabels2/po/ChangeLog b/glabels2/po/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/glabels2/po/Makefile.in.in b/glabels2/po/Makefile.in.in new file mode 100644 index 00000000..20ccd417 --- /dev/null +++ b/glabels2/po/Makefile.in.in @@ -0,0 +1,243 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. +# +# - Modified by Owen Taylor to use GETTEXT_PACKAGE +# instead of PACKAGE and to look for po2tbl in ./ not in intl/ +# +# - Modified by jacob berkman to install +# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize + +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(prefix)/share/glib-2.0/gettext/po +subdir = po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ + +CC = @CC@ +GENCAT = @GENCAT@ +GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ +MSGMERGE = PATH=../src:$$PATH msgmerge + +DEFS = @DEFS@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ + +INCLUDES = -I.. -I$(top_srcdir)/intl + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +SOURCES = +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ +$(POFILES) $(GMOFILES) $(SOURCES) + +POTFILES = \ + +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +INSTOBJEXT = @INSTOBJEXT@ + +.SUFFIXES: +.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat + +.c.o: + $(COMPILE) $< + +.po.pox: + $(MAKE) $(GETTEXT_PACKAGE).pot + $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && $(GENCAT) $@ $*.msg + + +all: all-@USE_NLS@ + +all-yes: $(CATALOGS) +all-no: + +$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(GETTEXT_PACKAGE).po \ + || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \ + && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot ) + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ + fi + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + case "$$cat" in \ + *.gmo) destdir=$(gnulocaledir);; \ + *) destdir=$(localedir);; \ + esac; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ + fi; \ + if test -r $$cat; then \ + $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + if test "$(PACKAGE)" = "glib"; then \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ + fi; \ + $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ + $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + done + rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in + +check: all + +dvi info tags TAGS ID: + +mostlyclean: + rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) +dist distdir: update-po $(DISTFILES) + dists="$(DISTFILES)"; \ + for file in $$dists; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(GETTEXT_PACKAGE).pot + PATH=`pwd`/../src:$$PATH; \ + cd $(srcdir); \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done + +# POTFILES is created from POTFILES.in by stripping comments, empty lines +# and Intltool tags (enclosed in square brackets), and appending a full +# relative path to them +POTFILES: POTFILES.in + ( if test 'x$(srcdir)' != 'x.'; then \ + posrcprefix='$(top_srcdir)/'; \ + else \ + posrcprefix="../"; \ + fi; \ + rm -f $@-t $@ \ + && (sed -e '/^#/d' \ + -e "s/^\[.*\] +//" \ + -e '/^[ ]*$$/d' \ + -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ + | sed -e '$$s/\\$$//') > $@-t \ + && chmod a-w $@-t \ + && mv $@-t $@ ) + +Makefile: Makefile.in.in ../config.status POTFILES + cd .. \ + && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/po/POTFILES.in b/glabels2/po/POTFILES.in new file mode 100644 index 00000000..68b42a55 --- /dev/null +++ b/glabels2/po/POTFILES.in @@ -0,0 +1,135 @@ +# List of source files containing translatable strings. + +src/glabels.c +src/glabels.h +src/glabels-batch.c +src/splash.c +src/splash.h +src/mdi.c +src/mdi.h +src/mdi-child.c +src/mdi-child.h +src/stock.c +src/stock.h +src/menus.h +src/menus.c +src/commands.h +src/commands.c +src/file.h +src/file.c +src/recent.h +src/recent.c +src/tools.h +src/tools.c +src/prefs.c +src/prefs.h +src/prefs-dialog.c +src/prefs-dialog.h +src/view.c +src/view.h +src/view-object.c +src/view-object.h +src/view-box.c +src/view-box.h +src/view-ellipse.c +src/view-ellipse.h +src/view-line.c +src/view-line.h +src/view-image.c +src/view-image.h +src/view-text.c +src/view-text.h +src/view-barcode.c +src/view-barcode.h +src/view-highlight.c +src/view-highlight.h +src/merge-properties.c +src/merge-properties.h +src/print.c +src/print.h +src/print-dialog.c +src/print-dialog.h +src/bc.c +src/bc.h +src/bc-gnubarcode.c +src/bc-gnubarcode.h +src/bc-postnet.c +src/bc-postnet.h +src/label.c +src/label.h +src/label-object.c +src/label-object.h +src/label-text.c +src/label-text.h +src/label-box.c +src/label-box.h +src/label-line.c +src/label-line.h +src/label-ellipse.c +src/label-ellipse.h +src/label-image.c +src/label-image.h +src/label-barcode.c +src/label-barcode.h +src/template.c +src/template.h +src/xml-label.c +src/xml-label.h +src/merge.c +src/merge.h +src/merge-text.c +src/merge-text.h +src/merge-ui.c +src/merge-ui.h +src/merge-ui-text.c +src/merge-ui-text.h +src/text-node.c +src/text-node.h +src/wdgt-text-props.c +src/wdgt-text-props.h +src/wdgt-text-entry.c +src/wdgt-text-entry.h +src/wdgt-position.c +src/wdgt-position.h +src/wdgt-size.c +src/wdgt-size.h +src/wdgt-line.c +src/wdgt-line.h +src/wdgt-fill.c +src/wdgt-fill.h +src/wdgt-vector.c +src/wdgt-vector.h +src/wdgt-bc-props.c +src/wdgt-bc-props.h +src/wdgt-bc-style.c +src/wdgt-bc-style.h +src/wdgt-bc-data.c +src/wdgt-bc-data.h +src/wdgt-print-copies.c +src/wdgt-print-copies.h +src/wdgt-print-merge.c +src/wdgt-print-merge.h +src/wdgt-media-select.c +src/wdgt-media-select.h +src/wdgt-mini-preview.c +src/wdgt-mini-preview.h +src/wdgt-rotate-label.c +src/wdgt-rotate-label.h +src/util.c +src/util.h +src/canvas-hacktext.c +src/canvas-hacktext.h +src/bonobo-mdi-child.c +src/bonobo-mdi-child.h +src/bonobo-mdi.c +src/bonobo-mdi.h +src/gnome-recent-model.c +src/gnome-recent-model.h +src/gnome-recent-util.c +src/gnome-recent-util.h +src/gnome-recent-view.c +src/gnome-recent-view.h +src/gnome-recent-view-bonobo.c +src/gnome-recent-view-bonobo.h +src/debug.c +src/debug.h diff --git a/glabels2/po/de.po b/glabels2/po/de.po new file mode 100644 index 00000000..c1e3142b --- /dev/null +++ b/glabels2/po/de.po @@ -0,0 +1,907 @@ +# French translation of glabels. +# Copyright (C) 2001 Jim Evins +# Marcus Bauer , 2001. +# +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.2.0\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2001-10-15 15:31+0200\n" +"Last-Translator: Marcus Bauer \n" +"Language-Team: German <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "Seiten:" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "Kopien" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "Begrenzungen drucken (um Druckausrichtung zu testen)" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "Spiegelbildlich drucken" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "Datei kann nicht geöffnet werden" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "Nicht speichern." + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "Nicht speichern." + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels 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 of the License, or (at your option) any later " +"version.\n" +" \n" +"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.\n" +msgstr "" +"Ein GNOME-Programm zur Erstellung von Etiketten und Visitenkarten.\n" +" \n" +"Glabels ist freie Software; Sie können sie weiterverteilen und/oder ändern " +"unter den Bedingungen der GNU General Public License, veröffentlicht von der " +"Free Software Foundation, entweder Version 2 der Lizenz oder (optional) " +"jeder späteren Version.\n" +" \n" +"Dieses Programm wird verteilt in der Hoffnung, dass es nützlich ist, aber " +"OHNE JEDE GARANTIE; Weitere Details in der GNU General Public License.\n" + +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "bis:" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "Labels" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "Neues Etikett oder neue Karte" + +#: src/file.c:109 +msgid "Media Type" +msgstr "Medien Typ" + +#: src/file.c:119 +#, fuzzy +msgid "Label orientation" +msgstr "Ausrichtung ändern" + +#: src/file.c:248 +msgid "Open" +msgstr "Öffnen" + +#: src/file.c:250 +msgid "Open label" +msgstr "Öffnen Etikett" + +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "Datei kann nicht geöffnet werden" + +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "Fehler beim Schreiben der Datei" + +#: src/file.c:468 +msgid "Save label as" +msgstr "Datei speichern unter" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "Dateinamen angeben" + +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "Fehler beim Schreiben der Datei" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +#, fuzzy +msgid "points" +msgstr "Punkt" + +#: src/prefs.c:627 +msgid "inches" +msgstr "Inch" + +#: src/prefs.c:629 +msgid "mm" +msgstr "mm" + +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "Skalierung" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels : Einstellungen" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "Anzeige Einheiten" + +#: src/prefs-dialog.c:289 +#, fuzzy +msgid "Points" +msgstr "Punkt" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "Inch" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "Millimeter" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "Standard Papierformat" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "Linie" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "Füllen" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "Löschen" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "Ganz nach vorne" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "Ganz nach hinten" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "Einstellungen ändern..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "Rechteck bearbeiten..." + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "Erscheinungsbild" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "Outline" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "Position/Breite" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "Position" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "Breite" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "Ellipse bearbeiten..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "Linienobjekt bearbeiten..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "Bildeinstellungen bearbeiten..." + +#: src/view-image.c:300 +msgid "Image" +msgstr "Bild" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "Reset Bildgröße" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "Text Objekt bearbeiten" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "Text" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "Barcode bearbeiten..." + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "Wert" + +#: src/view-barcode.c:292 +#, fuzzy +msgid "Barcode data" +msgstr "Barcode Wert" + +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "Text Einstellungen" + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "Stil" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "Ungültiger Barcode-Wert" + +#: src/merge-properties.c:84 +#, fuzzy +msgid "Edit document-merge properties" +msgstr "Dokumenten Mischerei bearbeiten..." + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "Quelle" + +#: src/merge-properties.c:142 +#, fuzzy +msgid "Format:" +msgstr "Font" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "Ort:" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "Felder" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "Drucken" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "Drucken" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "Kopien" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "Kontrolle der Mischung mit Datenquelle (Serienfunktion)" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "Optionen" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "Druckvorschau" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "Keine Dateivorlagen gefunden!" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "Fehler: xmlParseFile error" + +#: src/xml-label.c:174 +msgid "No document root" +msgstr "Kein document root" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "Fehlerhafter Dokument-Typ, glabels Namespace nicht gefunden" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Fehlerhafter root node = \"%s\"" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "fehlerhafter node = \"%s\"" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "Problem beim Speichern der xml-Datei." + +#: src/merge.c:80 +msgid "None" +msgstr "Keine" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "Text mit Tabulatoren als Trennern" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "Text mit Kommata als Separatoren" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "Text mit Doppelpunkten als Separatoren" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "Nicht verfügbar" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "Wählen Sie die einzumischende Datenquelle" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "Spalte" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "Benutzerdefinierter Feldschlüssel" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "Beispiel Daten" + +#. Font label +#: src/wdgt-text-props.c:184 +#, fuzzy +msgid "Font:" +msgstr "Font:" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +#, fuzzy +msgid "Color:" +msgstr "Farbe" + +#. Alignment label +#: src/wdgt-text-props.c:251 +#, fuzzy +msgid "Alignment:" +msgstr "Textanordnung:" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "Key:" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "Datenfeld einfügen" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y:" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +#, fuzzy +msgid "Width:" +msgstr "Länge der Linie" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "Höhe" + +#: src/wdgt-size.c:224 +#, fuzzy +msgid "Maintain current aspect ratio" +msgstr "Seitenverhältnis beibehalten" + +#. Length label +#: src/wdgt-vector.c:186 +#, fuzzy +msgid "Length:" +msgstr "Länge" + +#. Angle label +#: src/wdgt-vector.c:210 +#, fuzzy +msgid "Angle:" +msgstr "Winkel" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "Grad" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +#, fuzzy +msgid "Scale:" +msgstr "Skalierung" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "Zeige Text mit Barcode" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "Literale:" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "Seiten:" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "Labels" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "von:" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "bis:" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "Start bei Etikett" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "auf erster Seite" + +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "Zuordnen" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "Kopien:" + +#: src/wdgt-media-select.c:252 +#, fuzzy +msgid "Description:" +msgstr "Position" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "Seiten Format:" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "Etikett Format:" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "Layout:" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d pro Seite)" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "Rotieren" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "Öffnen" + +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "Gespeicherte Kopie von %s wiederherstellen?" + +#~ msgid "Unknown media type. Using default." +#~ msgstr "Unbekannter Medientyp. Nehme daher Standardeinstellung." + +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "``%s'' wurde geändert \n" +#~ "\n" +#~ "Wollen Sie speichern?" + +#~ msgid "Cannot save file" +#~ msgstr "Kann Datei nicht speichern" + +#~ msgid "Save As" +#~ msgstr "Speichern unter..." + +#~ msgid "Close / Save label as" +#~ msgstr "Schließen / Speichern des Etikett als" + +#~ msgid "Label no longer valid!" +#~ msgstr "Etikett nicht mehr gültig!" + +#~ msgid "Image format not currently supported" +#~ msgstr "Bildformat wird zur Zeit nicht unterstützt" + +#~ msgid "General" +#~ msgstr "Allgemeine Einstellungen" + +#~ msgid "_New" +#~ msgstr "_Neu" + +#~ msgid "Make a new, empty label" +#~ msgstr "Erzeuge neues, leeres Etikett" + +#~ msgid "U_nselect All " +#~ msgstr "A_uswahl aufheben" + +#~ msgid "Remove all selections" +#~ msgstr "Alle Auswahlen aufheben" + +#, fuzzy +#~ msgid "Select" +#~ msgstr "Löschen" + +#~ msgid "Select, move and modify objects" +#~ msgstr "Objekte auswählen, bewegen, ändern" + +#~ msgid "Create text object" +#~ msgstr "Textobjekt erzeugen" + +#~ msgid "Box" +#~ msgstr "Box" + +#~ msgid "Create box/rectangle object" +#~ msgstr "Rechteck-Objekt erzeugen" + +#~ msgid "Create line object" +#~ msgstr "Linienobjekt erzeugen" + +#~ msgid "Ellipse" +#~ msgstr "Ellipse" + +#~ msgid "Create ellipse/circle object" +#~ msgstr "Ellipsenobjekt erzeugen" + +#~ msgid "Create image object" +#~ msgstr "Bildobjekt erzeugen" + +#, fuzzy +#~ msgid "Barcode" +#~ msgstr "Barcode Wert" + +#~ msgid "Create barcode object" +#~ msgstr "Barcodeobjekt erzeugen" + +#~ msgid "Zoom in" +#~ msgstr "vergrößern" + +#~ msgid "Zoom out" +#~ msgstr "verkleinern" + +#~ msgid "Zoom 1:1" +#~ msgstr "Zoom 1:1" + +#~ msgid "Zoom to 1:1" +#~ msgstr "Maßstab auf 1:1 einstellen" + +#, fuzzy +#~ msgid "Merge properties" +#~ msgstr "Einstellungen ändern..." + +#, fuzzy +#~ msgid "Edit merge properties" +#~ msgstr "Bildeinstellungen bearbeiten..." + +#~ msgid "_Tools" +#~ msgstr "_Werkzeuge" + +#~ msgid " New " +#~ msgstr " Neu " + +#~ msgid "New Label/Card" +#~ msgstr "Neues Etikett/Neue Karte" + +#~ msgid " Open " +#~ msgstr " Öffnen " + +#~ msgid "Open a file" +#~ msgstr "Datei öffnen" + +#~ msgid " Save " +#~ msgstr " Speichern " + +#~ msgid "Save current file" +#~ msgstr "Aktuelle Datei speichern" + +#~ msgid " Print " +#~ msgstr " Drucken " + +#~ msgid "Print current file" +#~ msgstr "Aktuelle Datei drucken" + +#~ msgid "Function is not implemented!" +#~ msgstr "Funktion noch nicht implementiert!" + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Funktion noch nicht implementiert!" + +#~ msgid "w" +#~ msgstr "w" + +#~ msgid "h" +#~ msgstr "h" + +#~ msgid "x" +#~ msgstr "x" + +#~ msgid "y" +#~ msgstr "y" + +#~ msgid "Startup" +#~ msgstr "Programmstart" + +#~ msgid "Under construction" +#~ msgstr "Hier wird noch eifrig gebaut..." + +#, fuzzy +#~ msgid "Maintain original aspect ratio" +#~ msgstr "Seitenverhältnis beibehalten" + +#~ msgid "Text color" +#~ msgstr "Textfarbe" + +#~ msgid "Line Color" +#~ msgstr "Linienfarbe" + +#~ msgid "Fill Color" +#~ msgstr "Füllfarbe" diff --git a/glabels2/po/fr.po b/glabels2/po/fr.po new file mode 100644 index 00000000..0427321d --- /dev/null +++ b/glabels2/po/fr.po @@ -0,0 +1,2497 @@ +# French translation of glabels. + + + +# Copyright (C) 2001 Jim Evins + + + +# Olivier Berger , 2001. + + + +# + + + +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.2.0\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2001-10-15 15:31+0200\n" +"Last-Translator: Olivier Berger \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +# src/print_copies.c:193 + + + +# src/print_copies.c:193 + + + +# src/print_copies.c:171 + +# src/print_copies.c:170 +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "Feuilles :" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print.c:146 + +# src/print_dialog.c:104 +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "Copies" + +# src/print.c:180 + + + +# src/print.c:180 + + + +# src/print.c:196 + +# src/print_dialog.c:152 +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "imprimer des bordures (pour tester l'alignement de l'imprimante)" + +# src/print_dialog.c:160 +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "imprimer à l'envers (i.e. une image miroir)" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +# src/file.c:214 + + + +# src/file.c:214 + + + +# src/file.c:249 + +# src/file.c:249 +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "Impossible d'ouvrir le fichier" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +# src/mdi.c:482 + + + +# src/mdi.c:488 + + + +# src/mdi.c:459 + +# src/mdi.c:459 +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "Ne pas sauver" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +# src/mdi.c:482 + + + +# src/mdi.c:488 + + + +# src/mdi.c:459 + +# src/mdi.c:459 +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "Ne pas sauver" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +# src/menu.c:185 + + + +# src/menu.c:185 + + + +# src/menu.c:290 + +# src/menu.c:290 +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels 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 of the License, or (at your option) any later " +"version.\n" +" \n" +"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.\n" +msgstr "" +"Un programme de création d'étiquettes et de cartes de visite pour GNOME.\n" +" \n" +"Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le " +"modifier conformément aux dispositions de la Licence Publique Générale GNU, " +"telle que publiée par la Free Software Foundation ; version 2 de la licence, " +"ou encore (à votre choix) toute version ultérieure.\n" +" \n" +"Ce programme est distribué dans l'espoir qu'il sera utile, mais SANS AUCUNE " +"GARANTIE ; sans même la garantie implicite de COMMERCIALISATION ou " +"D'ADAPTATION A UN OBJET PARTICULIER. Pour plus de détail, voir la Licence " +"Publique Générale GNU.\n" + +# src/print_copies.c:221 + + + +# src/print_copies.c:221 + + + +# src/print_copies.c:199 + +# src/print_copies.c:198 +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "à :" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +# src/print_copies.c:210 + + + +# src/print_copies.c:210 + + + +# src/print_copies.c:188 + +# src/print_copies.c:187 +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "Etiquettes" + +# src/file.c:59 + + + +# src/file.c:59 + + + +# src/file.c:72 + +# src/file.c:72 +#: src/file.c:82 +msgid "New Label or Card" +msgstr "Nouvelle étiquette ou carte" + +# src/file.c:87 + + + +# src/file.c:87 + + + +# src/file.c:98 + +# src/file.c:98 +#: src/file.c:109 +msgid "Media Type" +msgstr "Type de média" + +# src/file.c:98 + + + +# src/file.c:98 + + + +# src/file.c:109 + +# src/file.c:109 +#: src/file.c:119 +msgid "Label orientation" +msgstr "Orientation de l'étiquette" + +# src/file.c:178 + + + +# src/file.c:178 + + + +# src/file.c:211 + +# src/file.c:211 +#: src/file.c:248 +msgid "Open" +msgstr "Ouvrir" + +# src/file.c:183 + + + +# src/file.c:183 + + + +# src/file.c:213 + +# src/file.c:213 +#: src/file.c:250 +msgid "Open label" +msgstr "Ouvrir une étiquette" + +# src/file.c:214 + + + +# src/file.c:214 + + + +# src/file.c:249 + +# src/file.c:249 +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "Impossible d'ouvrir le fichier" + +# src/file.c:330 src/mdi.c:740 + + + +# src/file.c:330 src/mdi.c:746 + + + +# src/file.c:374 src/mdi.c:705 + +# src/file.c:374 src/mdi.c:705 +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "Erreur d'écriture du fichier" + +# src/file.c:278 + + + +# src/file.c:278 + + + +# src/file.c:316 + +# src/file.c:316 +#: src/file.c:468 +msgid "Save label as" +msgstr "Enregistrer l'étiquette sous" + +# src/file.c:319 src/mdi.c:729 + + + +# src/file.c:319 src/mdi.c:735 + + + +# src/file.c:362 src/mdi.c:693 + +# src/file.c:362 src/mdi.c:693 +#: src/file.c:550 +msgid "Must supply file name" +msgstr "Vous devez donner un nom de fichier" + +# src/file.c:330 src/mdi.c:740 + + + +# src/file.c:330 src/mdi.c:746 + + + +# src/file.c:374 src/mdi.c:705 + +# src/file.c:374 src/mdi.c:705 +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "Erreur d'écriture du fichier" + +# src/print.c:171 + + + +# src/prefs.c:463 src/prefs.c:470 src/prop_line.c:202 + + + +# src/prefs.c:445 src/prefs.c:452 src/prop_line.c:183 + +# src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "points" + +# src/item_line.c:271 + + + +# src/prefs.c:465 + + + +# src/prefs.c:447 + +# src/prefs.c:450 +#: src/prefs.c:627 +msgid "inches" +msgstr "pouces" + +# src/prefs.c:467 + + + +# src/prefs.c:449 + +# src/prefs.c:452 +#: src/prefs.c:629 +msgid "mm" +msgstr "mm" + +# src/prop_bc.c:189 + + + +# src/prop_bc.c:187 + + + +# src/prop_bc.c:168 + +# src/prop_bc.c:168 +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "Echelle :" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +# src/preferences.c:92 + + + +# src/prefs.c:101 + + + +# src/prefs.c:92 + +# src/prefs.c:86 +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels : Préférences" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +# src/prefs.c:248 + + + +# src/prefs.c:226 + +# src/prefs.c:220 +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "Unités d'affichage" + +# src/print.c:149 + + + +# src/prefs.c:259 + + + +# src/prefs.c:237 + +# src/prefs.c:231 +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "Points" + +# src/prefs.c:265 + + + +# src/prefs.c:243 + +# src/prefs.c:237 +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "Pouces" + +# src/prefs.c:271 + + + +# src/prefs.c:250 + +# src/prefs.c:244 +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "Milimètres" + +# src/item_image.c:341 + + + +# src/prefs.c:278 + + + +# src/prefs.c:255 + +# src/prefs.c:249 +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "Taille de page par défaut" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +# src/item_line.c:271 + + + +# src/item_line.c:271 + + + +# src/item_line.c:256 src/menu.c:106 + +# src/item_line.c:256 src/menu.c:106 +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "Ligne" + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/item_box.c:258 src/item_ellipse.c:260 + +# src/item_box.c:258 src/item_ellipse.c:260 +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "Remplissage" + +# src/display.c:1157 src/display.c:1205 + + + +# src/display.c:1160 src/display.c:1208 + + + +# src/display.c:1171 src/display.c:1219 + +# src/display.c:1186 src/display.c:1234 +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "Supprimer" + +# src/display.c:1167 src/display.c:1215 + + + +# src/display.c:1170 src/display.c:1218 + + + +# src/display.c:1181 src/display.c:1229 + +# src/display.c:1196 src/display.c:1244 +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "Avancer au premier plan" + +# src/display.c:1173 src/display.c:1221 + + + +# src/display.c:1176 src/display.c:1224 + + + +# src/display.c:1187 src/display.c:1235 + +# src/display.c:1202 src/display.c:1250 +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "Reculer à l'arrière-plan" + +# src/display.c:1194 + + + +# src/display.c:1197 + + + +# src/display.c:1208 + +# src/display.c:1223 +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "Editer les propriétés..." + +# src/item_box.c:251 + + + +# src/item_box.c:251 + + + +# src/item_box.c:235 + +# src/item_box.c:235 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "Editer les propriétés de l'objet boîte..." + +# src/item_barcode.c:334 src/item_box.c:261 src/item_ellipse.c:266 + + + +# src/item_line.c:268 src/item_text.c:464 + + + +# src/item_barcode.c:340 src/item_box.c:261 src/item_ellipse.c:266 + + + +# src/item_line.c:268 src/item_text.c:464 + + + +# src/item_barcode.c:317 src/item_box.c:245 src/item_ellipse.c:247 + +# src/item_line.c:253 src/item_text.c:479 + +# src/item_barcode.c:317 src/item_box.c:245 src/item_ellipse.c:247 +# src/item_line.c:253 src/item_text.c:479 +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "Apparence" + +# src/item_box.c:264 src/item_ellipse.c:269 + + + +# src/item_box.c:264 src/item_ellipse.c:269 + + + +# src/item_box.c:248 src/item_ellipse.c:250 + +# src/item_box.c:248 src/item_ellipse.c:250 +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "Bordure" + +# src/item_box.c:288 src/item_ellipse.c:293 src/item_image.c:312 + + + +# src/item_line.c:286 + + + +# src/item_box.c:288 src/item_ellipse.c:293 src/item_image.c:312 + + + +# src/item_line.c:286 + + + +# src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 + +# src/item_line.c:271 + +# src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +# src/item_line.c:271 +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "Position/Taille" + +# src/item_barcode.c:362 src/item_barcode.c:365 src/item_box.c:291 + + + +# src/item_ellipse.c:296 src/item_image.c:315 src/item_line.c:289 + + + +# src/item_text.c:487 src/item_text.c:490 + + + +# src/item_barcode.c:368 src/item_barcode.c:371 src/item_box.c:291 + + + +# src/item_ellipse.c:296 src/item_image.c:315 src/item_line.c:289 + + + +# src/item_text.c:487 src/item_text.c:490 + + + +# src/item_barcode.c:345 src/item_barcode.c:348 src/item_box.c:275 + +# src/item_ellipse.c:277 src/item_image.c:318 src/item_line.c:274 + +# src/item_text.c:500 src/item_text.c:503 + +# src/item_barcode.c:345 src/item_barcode.c:348 src/item_box.c:275 +# src/item_ellipse.c:277 src/item_image.c:318 src/item_line.c:274 +# src/item_text.c:500 src/item_text.c:503 +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "Position" + +# src/item_box.c:302 src/item_ellipse.c:307 src/item_image.c:326 + + + +# src/item_line.c:300 + + + +# src/item_box.c:302 src/item_ellipse.c:307 src/item_image.c:326 + + + +# src/item_line.c:300 + + + +# src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 + +# src/item_line.c:285 + +# src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +# src/item_line.c:285 +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "Taille" + +# src/item_ellipse.c:256 + + + +# src/item_ellipse.c:256 + + + +# src/item_ellipse.c:237 + +# src/item_ellipse.c:237 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "Editer les propriétés de l'objet ellipse..." + +# src/item_line.c:258 + + + +# src/item_line.c:258 + + + +# src/item_line.c:243 + +# src/item_line.c:243 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "Editer les propriétés de l'objet ligne..." + +# src/item_image.c:272 + + + +# src/item_image.c:272 + + + +# src/item_image.c:257 + +# src/item_image.c:257 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "Editer les propriétés de l'objet image..." + +# src/item_image.c:283 + + + +# src/item_image.c:283 + + + +# src/item_image.c:268 src/menu.c:113 + +# src/item_image.c:268 src/menu.c:113 +#: src/view-image.c:300 +msgid "Image" +msgstr "Image" + +# src/item_image.c:341 + + + +# src/item_image.c:340 + + + +# src/item_image.c:342 + +# src/item_image.c:342 +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "Restaurer la taille d'image" + +# src/item_text.c:432 + + + +# src/item_text.c:432 + + + +# src/item_text.c:450 + +# src/item_text.c:450 +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "Editer les propriétés de l'objet texte..." + +# src/item_text.c:442 src/item_text.c:627 + + + +# src/item_text.c:442 src/item_text.c:627 + + + +# src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 + +# src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "Texte" + +# src/item_barcode.c:299 + + + +# src/item_barcode.c:299 + + + +# src/item_barcode.c:287 + +# src/item_barcode.c:287 +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "Editer les propriétés de l'objet code-barre..." + +# src/item_barcode.c:309 + + + +# src/item_barcode.c:308 + + + +# src/item_barcode.c:297 + +# src/item_barcode.c:297 +#: src/view-barcode.c:287 +msgid "Data" +msgstr "Données" + +# src/item_barcode.c:316 + + + +# src/item_barcode.c:317 + + + +# src/item_barcode.c:299 + +# src/item_barcode.c:299 +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "Données de code-barre" + +# src/item_text.c:467 + + + +# src/item_text.c:467 + + + +# src/item_text.c:482 + +# src/item_text.c:482 +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "Propriétés du texte" + +# src/item_barcode.c:347 + + + +# src/item_barcode.c:353 + + + +# src/item_barcode.c:330 + +# src/item_barcode.c:330 +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "Style" + +# src/item_barcode.c:564 src/item_barcode.c:588 src/print.c:641 + + + +# src/item_barcode.c:570 src/item_barcode.c:594 src/print.c:641 + + + +# src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:799 + +# src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:600 +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "Code-barre invalide" + +# src/item_box.c:251 + + + +# src/item_box.c:251 + + + +# src/merge_properties.c:82 + +# src/merge_properties.c:82 +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "Editer les propriétés de fusion de document" + +# src/merge_properties.c:131 + +# src/merge_properties.c:131 +#: src/merge-properties.c:130 +msgid "Source" +msgstr "Source" + +# src/prop_text.c:214 + + + +# src/prop_text.c:199 + + + +# src/merge_properties.c:143 + +# src/merge_properties.c:143 +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "Format :" + +# src/merge_properties.c:158 + +# src/merge_properties.c:158 +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "Emplacement :" + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/merge_properties.c:168 + +# src/merge_properties.c:168 +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "Champs" + +# src/print.c:149 + + + +# src/print.c:149 + + + +# src/print.c:141 + +# src/print_dialog.c:99 +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "Imprimer" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +# src/print.c:149 + + + +# src/print.c:149 + + + +# src/print.c:141 + +# src/print_dialog.c:99 +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "Imprimer" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print.c:146 + +# src/print_dialog.c:104 +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "Copies" + +# src/print.c:164 + +# src/print_dialog.c:121 +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "Contrôle de la fusion de document" + +# src/print.c:171 + + + +# src/print.c:171 + + + +# src/print.c:186 + +# src/print_dialog.c:141 +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "Options" + +# src/print.c:235 + + + +# src/print.c:235 + + + +# src/print.c:283 src/print.c:348 + +# src/print_dialog.c:241 src/print_dialog.c:280 +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "Aperçu avant impression" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +# src/template.c:179 + + + +# src/template.c:178 + +# src/template.c:223 +#: src/template.c:346 +msgid "No template files found!" +msgstr "Aucun fichier de patron trouvé !" + +# src/label.c:186 src/label.c:211 + + + +# src/label.c:186 src/label.c:211 + + + +# src/label.c:170 src/label.c:194 + +# src/label.c:168 src/label.c:192 +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "erreur xmlParseFile" + +# src/label.c:243 + + + +# src/label.c:244 + + + +# src/label.c:225 + +# src/label.c:223 +#: src/xml-label.c:174 +msgid "No document root" +msgstr "Pas de racine de document" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +# src/label.c:248 + + + +# src/label.c:249 + + + +# src/label.c:236 + +# src/label.c:234 +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "document de type erroné, aucun espace de noms glabels trouvé" + +# src/label.c:253 + + + +# src/label.c:254 + + + +# src/label.c:241 + +# src/label.c:239 +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Mauvais noeud racine = \"%s\"" + +# src/label.c:298 + + + +# src/label.c:301 + + + +# src/label.c:294 + +# src/label.c:290 +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "mauvais noeud = \"%s\"" + +# src/label.c:487 + + + +# src/label.c:493 + + + +# src/label.c:589 + +# src/label.c:587 +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "Problème de sauvegarde du fichier xml." + +# src/merge.c:80 + +# src/merge.c:78 +#: src/merge.c:80 +msgid "None" +msgstr "Aucun" + +# src/merge.c:89 + +# src/merge.c:86 +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "Texte avec séparateurs de tabulation" + +# src/merge.c:98 + +# src/merge.c:94 +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "Texte séparé par des virgules" + +# src/merge.c:107 + +# src/merge.c:102 +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "Texte séparé par des deux-points" + +# src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 + +# src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "Non défini" + +# src/merge_ui_text.c:170 + +# src/merge_ui_text.c:170 +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "Sélection de la base de données source de la fusion" + +# src/merge_ui_text.c:330 + +# src/merge_ui_text.c:330 +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "Colonne" + +# src/merge_ui_text.c:334 + +# src/merge_ui_text.c:334 +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "Clé de champ spécifique" + +# src/merge_ui_text.c:338 + +# src/merge_ui_text.c:338 +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "Exemple de données" + +# src/prop_text.c:214 + + + +# src/prop_text.c:199 + + + +# src/prop_text.c:181 + +# src/prop_text.c:181 +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "Police :" + +# src/prop_bc.c:204 src/prop_fill.c:186 src/prop_line.c:203 + + + +# src/prop_text.c:263 + + + +# src/prop_bc.c:210 src/prop_fill.c:184 src/prop_line.c:209 + + + +# src/prop_text.c:247 + + + +# src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 + +# src/prop_text.c:234 + +# src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +# src/prop_text.c:234 +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "Couleur :" + +# src/prop_text.c:277 + + + +# src/prop_text.c:264 + + + +# src/prop_text.c:248 + +# src/prop_text.c:248 +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "Alignement :" + +# src/prop_bc_data.c:196 src/prop_text_entry.c:180 + +# src/prop_bc_data.c:196 src/prop_text_entry.c:180 +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "Clé :" + +# src/prop_text_entry.c:196 + +# src/prop_text_entry.c:196 +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "Insérer champ de fusion" + +# src/prop_position.c:192 + + + +# src/prop_position.c:173 + +# src/prop_position.c:173 +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X :" + +# src/prop_position.c:212 + + + +# src/prop_position.c:191 + +# src/prop_position.c:191 +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y :" + +# src/prop_line.c:188 + + + +# src/prop_line.c:187 src/prop_size.c:202 + + + +# src/prop_line.c:169 src/prop_size.c:182 + +# src/prop_line.c:169 src/prop_size.c:182 +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "Largeur :" + +# src/prop_size.c:220 + + + +# src/prop_size.c:198 + +# src/prop_size.c:198 +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "Hauteur :" + +# src/prop_size.c:215 + + + +# src/prop_size.c:247 + + + +# src/prop_size.c:222 + +# src/prop_size.c:222 +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "Conserver le rapport d'échelle actuel" + +# src/prop_vector.c:196 + + + +# src/prop_vector.c:202 + + + +# src/prop_vector.c:183 + +# src/prop_vector.c:183 +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "Longueur :" + +# src/prop_vector.c:207 + + + +# src/prop_vector.c:228 + + + +# src/prop_vector.c:207 + +# src/prop_vector.c:207 +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "Angle :" + +# src/prop_vector.c:245 + + + +# src/prop_vector.c:224 + +# src/prop_vector.c:224 +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "degrés" + +# src/prop_bc.c:189 + + + +# src/prop_bc.c:187 + + + +# src/prop_bc.c:168 + +# src/prop_bc.c:168 +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "Echelle :" + +# src/prop_bc.c:202 + + + +# src/prop_bc.c:182 + +# src/prop_bc.c:182 +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +# src/prop_bc_style.c:328 + + + +# src/prop_bc_style.c:328 + + + +# src/prop_bc_style.c:313 + +# src/prop_bc_style.c:313 +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "Afficher du texte avec le code-barre" + +# src/prop_bc_data.c:176 + +# src/prop_bc_data.c:176 +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "Littéral :" + +# src/print_copies.c:193 + + + +# src/print_copies.c:193 + + + +# src/print_copies.c:171 + +# src/print_copies.c:170 +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "Feuilles :" + +# src/print_copies.c:210 + + + +# src/print_copies.c:210 + + + +# src/print_copies.c:188 + +# src/print_copies.c:187 +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "Etiquettes" + +# src/print_copies.c:213 + + + +# src/print_copies.c:213 + + + +# src/print_copies.c:191 + +# src/print_copies.c:190 +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "de :" + +# src/print_copies.c:221 + + + +# src/print_copies.c:221 + + + +# src/print_copies.c:199 + +# src/print_copies.c:198 +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "à :" + +# src/print_copies_merge.c:197 + +# src/print_merge.c:170 +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "Commencer par l'étiquette" + +# src/print_copies_merge.c:206 + +# src/print_merge.c:179 +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "en 1ère page" + +# src/rotate_select.c:187 + + + +# src/rotate_select.c:187 + + + +# src/print_copies_merge.c:186 + +# src/print_merge.c:188 +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "Assembler" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print_copies_merge.c:173 + +# src/print_merge.c:195 +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "Copies :" + +# src/media_select.c:216 + + + +# src/media_select.c:242 + + + +# src/media_select.c:222 + +# src/media_select.c:222 +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "Description :" + +# src/media_select.c:221 + + + +# src/media_select.c:247 + + + +# src/media_select.c:227 + +# src/media_select.c:227 +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "Taille de page :" + +# src/media_select.c:226 + + + +# src/media_select.c:252 + + + +# src/media_select.c:232 + +# src/media_select.c:232 +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "Taille d'étiquette :" + +# src/media_select.c:231 + + + +# src/media_select.c:257 + + + +# src/media_select.c:237 + +# src/media_select.c:237 +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "Disposition :" + +# src/media_select.c:515 + + + +# src/media_select.c:481 + +# src/media_select.c:353 +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d par feuille)" + +# src/media_select.c:522 + + + +# src/media_select.c:488 + +# src/media_select.c:367 +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +# src/media_select.c:522 + + + +# src/media_select.c:488 + +# src/media_select.c:372 +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +# src/rotate_select.c:187 + + + +# src/rotate_select.c:187 + + + +# src/rotate_select.c:167 + +# src/rotate_select.c:169 +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "Rotation" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +# src/file.c:178 + + + +# src/file.c:178 + + + +# src/file.c:211 + +# src/file.c:211 +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "Ouvrir" + +# src/mdi.c:190 + + + +# src/mdi.c:189 + + + +# src/mdi.c:169 + +# src/mdi.c:169 +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "Rétablir la version sauvegardée de %s ?" + +# src/mdi.c:219 + + + +# src/mdi.c:207 + +# src/mdi.c:207 +#~ msgid "Unknown media type. Using default." +#~ msgstr "Type de media inconnu. Utilisation de celui par défaut." + +# src/mdi.c:477 + + + +# src/mdi.c:483 + + + +# src/mdi.c:455 + +# src/mdi.c:455 +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "``%s'' a été modifié \n" +#~ "\n" +#~ "Voulez-vous l'enregistrer ?" + +# src/file.c:248 src/mdi.c:635 + + + +# src/file.c:248 src/mdi.c:641 + + + +# src/file.c:288 src/mdi.c:601 + +# src/file.c:288 src/mdi.c:601 +#~ msgid "Cannot save file" +#~ msgstr "Impossible d'enregistrer le fichier" + +# src/file.c:271 src/mdi.c:660 + + + +# src/file.c:271 src/mdi.c:666 + + + +# src/file.c:311 src/mdi.c:623 + +# src/file.c:311 src/mdi.c:623 +#~ msgid "Save As" +#~ msgstr "Enregistrer sous" + +# src/mdi.c:663 + + + +# src/mdi.c:669 + + + +# src/mdi.c:626 + +# src/mdi.c:626 +#~ msgid "Close / Save label as" +#~ msgstr "Fermer / Enregistrer l'étiquette sous" + +# src/file.c:309 src/mdi.c:716 + + + +# src/file.c:309 src/mdi.c:722 + + + +# src/file.c:352 src/mdi.c:680 + +# src/file.c:352 src/mdi.c:680 +#~ msgid "Label no longer valid!" +#~ msgstr "Etiquette plus valide !" + +# src/item_image.c:389 src/item_image.c:444 + + + +# src/item_image.c:388 src/item_image.c:442 + + + +# src/item_image.c:389 src/item_image.c:454 + +# src/item_image.c:389 src/item_image.c:454 +#~ msgid "Image format not currently supported" +#~ msgstr "Format d'image non supporté actuellement" + +# src/item_barcode.c:337 + + + +# src/item_barcode.c:343 src/prefs.c:243 + + + +# src/item_barcode.c:320 src/prefs.c:221 + +# src/item_barcode.c:320 src/prefs.c:215 +#~ msgid "General" +#~ msgstr "Général" + +# src/menu.c:50 + + + +# src/menu.c:50 + + + +# src/menu.c:50 + +# src/menu.c:50 +#~ msgid "_New" +#~ msgstr "_Nouveau" + +# src/menu.c:51 + + + +# src/menu.c:51 + + + +# src/menu.c:51 + +# src/menu.c:51 +#~ msgid "Make a new, empty label" +#~ msgstr "Créer une nouvelle étiquette vide" + +# src/menu.c:86 + + + +# src/menu.c:86 + + + +# src/menu.c:85 + +# src/menu.c:85 +#~ msgid "U_nselect All " +#~ msgstr "_Désélectionne tout" + +# src/menu.c:86 + + + +# src/menu.c:86 + + + +# src/menu.c:86 + +# src/menu.c:86 +#~ msgid "Remove all selections" +#~ msgstr "Supprime toutes les sélections" + +# src/display.c:1157 src/display.c:1205 + + + +# src/display.c:1160 src/display.c:1208 + + + +# src/menu.c:94 + +# src/menu.c:94 +#~ msgid "Select" +#~ msgstr "Sélectionner" + +# src/tools.c:59 + + + +# src/tools.c:59 + + + +# src/menu.c:95 src/menu.c:186 + +# src/menu.c:95 src/menu.c:186 +#~ msgid "Select, move and modify objects" +#~ msgstr "Sélectionner, déplacer et modifier les objets" + +# src/tools.c:64 + + + +# src/tools.c:64 + + + +# src/menu.c:100 src/menu.c:191 + +# src/menu.c:100 src/menu.c:191 +#~ msgid "Create text object" +#~ msgstr "Créer un objet texte" + +# src/menu.c:103 + +# src/menu.c:103 +#~ msgid "Box" +#~ msgstr "Boîte" + +# src/tools.c:67 + + + +# src/tools.c:67 + + + +# src/menu.c:103 src/menu.c:194 + +# src/menu.c:103 src/menu.c:194 +#~ msgid "Create box/rectangle object" +#~ msgstr "Créer un objet boîte/rectangle" + +# src/tools.c:70 + + + +# src/tools.c:70 + + + +# src/menu.c:106 src/menu.c:197 + +# src/menu.c:106 src/menu.c:197 +#~ msgid "Create line object" +#~ msgstr "Créer un objet ligne" + +# src/menu.c:109 + +# src/menu.c:109 +#~ msgid "Ellipse" +#~ msgstr "Ellipse" + +# src/tools.c:73 + + + +# src/tools.c:73 + + + +# src/menu.c:110 src/menu.c:200 + +# src/menu.c:110 src/menu.c:200 +#~ msgid "Create ellipse/circle object" +#~ msgstr "Créer un objet ellipse/cercle" + +# src/tools.c:76 + + + +# src/tools.c:76 + + + +# src/menu.c:113 src/menu.c:203 + +# src/menu.c:113 src/menu.c:203 +#~ msgid "Create image object" +#~ msgstr "Créer un objet image" + +# src/item_barcode.c:316 + + + +# src/item_barcode.c:317 + + + +# src/menu.c:116 + +# src/menu.c:116 +#~ msgid "Barcode" +#~ msgstr "Code-barre" + +# src/tools.c:79 + + + +# src/tools.c:79 + + + +# src/menu.c:116 src/menu.c:206 + +# src/menu.c:116 src/menu.c:206 +#~ msgid "Create barcode object" +#~ msgstr "Créer un objet code-barre" + +# src/tools.c:84 + + + +# src/tools.c:84 + + + +# src/menu.c:121 src/menu.c:211 + +# src/menu.c:121 src/menu.c:211 +#~ msgid "Zoom in" +#~ msgstr "Zoom supérieur" + +# src/tools.c:87 + + + +# src/tools.c:87 + + + +# src/menu.c:124 src/menu.c:214 + +# src/menu.c:124 src/menu.c:214 +#~ msgid "Zoom out" +#~ msgstr "Zoom inférieur" + +# src/tools.c:90 + + + +# src/tools.c:90 + + + +# src/menu.c:127 + +# src/menu.c:127 +#~ msgid "Zoom 1:1" +#~ msgstr "Zoom 1:1" + +# src/tools.c:90 + + + +# src/tools.c:90 + + + +# src/menu.c:127 src/menu.c:217 + +# src/menu.c:127 src/menu.c:217 +#~ msgid "Zoom to 1:1" +#~ msgstr "Zoomer à 1:1" + +# src/item_text.c:467 + + + +# src/item_text.c:467 + + + +# src/menu.c:132 src/menu.c:223 + +# src/menu.c:132 src/menu.c:223 +#~ msgid "Merge properties" +#~ msgstr "Propriétés de fusion" + +# src/item_image.c:272 + + + +# src/item_image.c:272 + + + +# src/menu.c:133 + +# src/menu.c:133 +#~ msgid "Edit merge properties" +#~ msgstr "Editer les propriétés de fusion" + +# src/menu.c:157 + +# src/menu.c:157 +#~ msgid "_Tools" +#~ msgstr "_Outils" + +# src/menu.c:138 + + + +# src/menu.c:138 + + + +# src/menu.c:168 + +# src/menu.c:168 +#~ msgid " New " +#~ msgstr " Nouveau " + +# src/menu.c:138 + + + +# src/menu.c:138 + + + +# src/menu.c:168 + +# src/menu.c:168 +#~ msgid "New Label/Card" +#~ msgstr "Nouvelle étiquette/carte" + +# src/menu.c:140 + + + +# src/menu.c:140 + + + +# src/menu.c:170 + +# src/menu.c:170 +#~ msgid " Open " +#~ msgstr " Ouvrir " + +# src/menu.c:140 + + + +# src/menu.c:140 + + + +# src/menu.c:170 + +# src/menu.c:170 +#~ msgid "Open a file" +#~ msgstr "Ouvrir un fichier" + +# src/menu.c:142 + + + +# src/menu.c:142 + + + +# src/menu.c:172 + +# src/menu.c:172 +#~ msgid " Save " +#~ msgstr " Enregistrer " + +# src/menu.c:142 + + + +# src/menu.c:142 + + + +# src/menu.c:172 + +# src/menu.c:172 +#~ msgid "Save current file" +#~ msgstr "Sauvegarder le fichier en cours" + +# src/menu.c:145 + + + +# src/menu.c:145 + + + +# src/menu.c:175 + +# src/menu.c:175 +#~ msgid " Print " +#~ msgstr " Imprimer " + +# src/menu.c:145 + + + +# src/menu.c:145 + + + +# src/menu.c:175 + +# src/menu.c:175 +#~ msgid "Print current file" +#~ msgstr "Imprimer le fichier en cours" + +# src/menu.c:221 + + + +# src/menu.c:221 + + + +# src/menu.c:326 + +# src/menu.c:326 +#~ msgid "Function is not implemented!" +#~ msgstr "Cette fonction n'est pas implémentée !" + +# src/tools.c:297 + + + +# src/tools.c:297 + + + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Cette fonction n'est pas encore implémentée !" + +# src/prop_size.c:194 + + + +#~ msgid "w" +#~ msgstr "l" + +# src/prop_size.c:203 + + + +#~ msgid "h" +#~ msgstr "h" + +# src/prop_position.c:183 + + + +#~ msgid "x" +#~ msgstr "x" + +# src/prop_position.c:195 + + + +#~ msgid "y" +#~ msgstr "y" + +# src/media_select.c:462 + + + +#~ msgid "%.1f x %.1f" +#~ msgstr "%.1f x %.1f" + +# src/preferences.c:213 + + + +#~ msgid "Startup" +#~ msgstr "Démarrage" + +# src/preferences.c:215 + + + +#~ msgid "Under construction" +#~ msgstr "En construction" + +#, fuzzy +#~ msgid "Maintain original aspect ratio" +#~ msgstr "Conserver le rapport d'échelle d'origine" + +#~ msgid "Text color" +#~ msgstr "Couleur du texte" + +#~ msgid "Line Color" +#~ msgstr "Couleur de ligne" + +#~ msgid "Fill Color" +#~ msgstr "Couleur de remplissage" diff --git a/glabels2/po/glabels.pot b/glabels2/po/glabels.pot new file mode 100644 index 00000000..3cfbe2e8 --- /dev/null +++ b/glabels2/po/glabels.pot @@ -0,0 +1,709 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +#: src/commands.c:384 +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "sheets" +msgstr "" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +msgid "copies" +msgstr "" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, c-format +msgid "cannot open glabels file %s\n" +msgstr "" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +msgid "Do_n't save" +msgstr "" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +msgid "_Don't close" +msgstr "" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels 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 of the License, or (at your option) any later " +"version.\n" +" \n" +"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.\n" +msgstr "" + +#: src/commands.c:371 +msgid "Author:" +msgstr "" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +msgid "glabels" +msgstr "" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "" + +#: src/file.c:109 +msgid "Media Type" +msgstr "" + +#: src/file.c:119 +msgid "Label orientation" +msgstr "" + +#: src/file.c:248 +msgid "Open" +msgstr "" + +#: src/file.c:250 +msgid "Open label" +msgstr "" + +#: src/file.c:338 +#, c-format +msgid "Cannot open file '%s'" +msgstr "" + +#: src/file.c:429 +#, c-format +msgid "Error saving file '%s'" +msgstr "" + +#: src/file.c:468 +msgid "Save label as" +msgstr "" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "" + +#: src/file.c:569 +#, c-format +msgid "Error writing file '%s'" +msgstr "" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "" + +#: src/prefs.c:627 +msgid "inches" +msgstr "" + +#: src/prefs.c:629 +msgid "mm" +msgstr "" + +#: src/prefs-dialog.c:220 +msgid "Locale" +msgstr "" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +msgid "Preferences" +msgstr "" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "" + +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "" + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "" + +#: src/view-image.c:300 +msgid "Image" +msgstr "" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "" + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "" + +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "" + +#: src/view-barcode.c:318 +msgid "Barcode Properties" +msgstr "" + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "" + +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "" + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "" + +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +msgid "P_rinter" +msgstr "" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "" + +#: src/xml-label.c:174 +msgid "No document root" +msgstr "" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +msgid "bad document, unknown glabels Namespace" +msgstr "" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "" + +#: src/merge.c:80 +msgid "None" +msgstr "" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "" + +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "" + +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "" + +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "" + +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "" + +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "" + +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "" + +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, c-format +msgid "Open %s" +msgstr "" diff --git a/glabels2/po/ja.po b/glabels2/po/ja.po new file mode 100644 index 00000000..836c63d0 --- /dev/null +++ b/glabels2/po/ja.po @@ -0,0 +1,854 @@ +# glabels ja.po +# Copyright (C) 2001 Free Software Foundation, Inc. +# Takeshi Aihana , 2001, 2002. +# +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.4.1\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2002-01-15 22:34+0900\n" +"Last-Translator: Takeshi Aihana \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "用紙:" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "コピー" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "アウトラインを印刷する (印刷時の配置を確認するため)" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "反転して印刷 (i.e. 画像をミラーしたもの)" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "ファイルが開けません" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "保存しない" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "保存しない" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels 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 of the License, or (at your option) any later " +"version.\n" +" \n" +"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.\n" +msgstr "" +"GNOME 向けのラベル/ビジネスカードの作成プログラムです。\n" +"\n" +"Glabels はフリーソフトです。フリーソフトウェア財団が定める GNU 一般公有使用許" +"諾契約書の第2版もしくはそれ以降のバージョンの下で複製、改編、再配布が認められ" +"ています。\n" +"\n" +"このプログラムが役に立つことを望む中で配布されていますが、完全無保証です。販" +"売目的または商用目的の保証はありません。詳細については GNU 一般公有使用許諾契" +"約書を参照して下さい。\n" + +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "終了:" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "ラベル" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "新規ラベルまたはカード" + +#: src/file.c:109 +msgid "Media Type" +msgstr "メディアの種類" + +#: src/file.c:119 +msgid "Label orientation" +msgstr "ラベルの向き" + +#: src/file.c:248 +msgid "Open" +msgstr "開く" + +#: src/file.c:250 +msgid "Open label" +msgstr "ラベルを開きます" + +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "ファイルが開けません" + +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "ファイルの書き込みでエラー" + +#: src/file.c:468 +msgid "Save label as" +msgstr "ラベルに名前を付けて保存します" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "ファイル名を指定して下さい" + +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "ファイルの書き込みでエラー" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "ポイント" + +#: src/prefs.c:627 +msgid "inches" +msgstr "[インチ]" + +#: src/prefs.c:629 +msgid "mm" +msgstr "[ミリ]" + +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "寸法:" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels: 設定" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "表示する単位" + +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "ポイント" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "インチ" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "ミリ" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "デフォルトの用紙サイズ" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "直線" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "塗りつぶし" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "削除" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "前に持って来る" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "後ろにまわす" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "プロパティの編集..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "四角の編集" + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "外観" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "矩形" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "位置とサイズ" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "位置" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "サイズ" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "楕円の編集" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "直線の編集" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "画像の編集" + +#: src/view-image.c:300 +msgid "Image" +msgstr "画像" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "画像サイズのリセット" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "テキストの編集" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "テキスト" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "バーコードの編集" + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "データ" + +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "バーコード・データ" + +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "文字プロパティ..." + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "スタイル" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "おかしなバーコード" + +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "結合ドキュメント・プロパティの編集" + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "ソース" + +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "書式:" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "場所:" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "フィールド" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "印刷" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "印刷" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "コピー" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "ドキュメントをコントロールにマージする" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "オプション" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "印刷プレビュー" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "テンプレート・ファイルが見つかりません!" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "xmlParseFile エラー" + +#: src/xml-label.c:174 +msgid "No document root" +msgstr "root ドキュメントではありません" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "ドキュメントの種類が間違っています。Glabels 名前空間が見つかりません。" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "おかしな root のノード = \"%s\"" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "おかしなノード = \"%s\"" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "XML ファイルの保存で問題があります" + +#: src/merge.c:80 +msgid "None" +msgstr "なし" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "タブで区切ったテキスト" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "コンマで区切ったテキスト" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "コロンで区切ったテキスト" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "N/A" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "結合データベース・ソースの選択" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "列" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "カスタム・フィールド・キー" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "サンプルデータ" + +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "フォント:" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "色:" + +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "位置:" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "キー:" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "結合フィールドの挿入" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y:" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "幅:" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "高さ:" + +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "現在のアスペクト比率を維持する" + +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "長さ:" + +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "角度:" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "度" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "寸法:" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "バーコードを付けてテキストを表示する" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "リテラル:" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "用紙:" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "ラベル" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "開始:" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "終了:" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "ラベルの開始" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "(最初のシート)" + +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "製本" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "コピー:" + +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "説明:" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "用紙のサイズ:" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "ラベルの大きさ:" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "レイアウト:" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d 個/シート)" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "回転させる" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "開く" + +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "%s のコピーを反転しますか?" + +#~ msgid "Unknown media type. Using default." +#~ msgstr "メディアの種類が特定できません。デフォルトを使用します。" + +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "%s は編集されています。\n" +#~ "\n" +#~ "保存しますか?" + +#~ msgid "Cannot save file" +#~ msgstr "ファイルを保存することが出来ません" + +#~ msgid "Save As" +#~ msgstr "名前を付けて保存" + +#~ msgid "Close / Save label as" +#~ msgstr "ラベルに名前を付けて保存して閉じます" + +#~ msgid "Label no longer valid!" +#~ msgstr "ラベルは有効ではありません!" + +#~ msgid "Image format not currently supported" +#~ msgstr "画像フォーマットはサポートしていません" + +#~ msgid "General" +#~ msgstr "全般" + +#~ msgid "_New" +#~ msgstr "新規(_N)" + +#~ msgid "Make a new, empty label" +#~ msgstr "新規に空のラベルを作成します" + +#~ msgid "U_nselect All " +#~ msgstr "全て選択解除(_N)" + +#~ msgid "Remove all selections" +#~ msgstr "選択範囲を解除します" + +#~ msgid "Select" +#~ msgstr "選択" + +#~ msgid "Select, move and modify objects" +#~ msgstr "オブジェクトの選択、移動、編集を行います" + +#~ msgid "Create text object" +#~ msgstr "テキスト・オブジェクトを作成します" + +#~ msgid "Box" +#~ msgstr "四角" + +#~ msgid "Create box/rectangle object" +#~ msgstr "四角/三角のオブジェクトを作成します" + +#~ msgid "Create line object" +#~ msgstr "直線オブジェクトを作成します" + +#~ msgid "Ellipse" +#~ msgstr "楕円" + +#~ msgid "Create ellipse/circle object" +#~ msgstr "楕円/円オブジェクトを作成します" + +#~ msgid "Create image object" +#~ msgstr "画像オブジェクトを作成します" + +#~ msgid "Barcode" +#~ msgstr "バーコード" + +#~ msgid "Create barcode object" +#~ msgstr "バーコード・オブジェクトを作成します" + +#~ msgid "Zoom in" +#~ msgstr "拡大" + +#~ msgid "Zoom out" +#~ msgstr "縮小" + +#~ msgid "Zoom 1:1" +#~ msgstr "元のサイズへ" + +#~ msgid "Zoom to 1:1" +#~ msgstr "縦横比 1:1 のサイズにします" + +#~ msgid "Merge properties" +#~ msgstr "結合プロパティ" + +#~ msgid "Edit merge properties" +#~ msgstr "結合プロパティを編集します" + +#~ msgid "_Tools" +#~ msgstr "ツール(_T)" + +#~ msgid " New " +#~ msgstr " 新規 " + +#~ msgid "New Label/Card" +#~ msgstr "新規のラベル/カードを作成します" + +#~ msgid " Open " +#~ msgstr " 開く " + +#~ msgid "Open a file" +#~ msgstr "ファイルを開きます" + +#~ msgid " Save " +#~ msgstr " 保存 " + +#~ msgid "Save current file" +#~ msgstr "このファイルを保存します" + +#~ msgid " Print " +#~ msgstr " 印刷 " + +#~ msgid "Print current file" +#~ msgstr "このファイルを印刷します" + +#~ msgid "Function is not implemented!" +#~ msgstr "まだこの機能は実装されていません!" diff --git a/glabels2/po/pt_BR.po b/glabels2/po/pt_BR.po new file mode 100644 index 00000000..65628ec1 --- /dev/null +++ b/glabels2/po/pt_BR.po @@ -0,0 +1,861 @@ +# Brazilian Portuguese translation of Glabels. +# Copyright (C) 2001 Jim Evins +# Paulo R. Ormenese , 2001. +# +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.4.1\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2002-01-31 21:20+ZONE\n" +"Last-Translator: Paulo R. Ormenese \n" +"Language-Team: Brazilian portuguese <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "Páginas:" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "Cópias" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "imprimir contornos (testar alinhamento da impressora)" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "imprimir ao contrário (como uma imagem de espelho)" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "Impossível abrir o arquivo" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "Não salve" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "Não salve" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels 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 of the License, or (at your option) any later " +"version.\n" +" \n" +"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.\n" +msgstr "" +"Um programa para criação de etiquetas e cartões de negócios para o GNOME.\n" +"\n" +"Glabels é software livre; você pode redistribuí-lo e/ou modificá-lo sob os " +"termos da Licença Pública Geral GNU conforme publicada pela Free Software " +"Foundation; ou a versão 2 da Licença, ou (sob sua opção) qualquer versão " +"posterior.\n" +"\n" +"Este programa é distribuido na esperança de que seja útil, mas SEM QUALQUER " +"GARANTIA; sem mesmo as garantias implícitas de COMERCIALIZAÇÃO ou AJUSTES A " +"UM PROPÓSITO PARTICULAR. Veja a Licença Pública Geral GNU para mais " +"detalhes.\n" + +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "até:" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "Etiquetas" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "Nova Etiqueta ou Cartão" + +#: src/file.c:109 +msgid "Media Type" +msgstr "Tipo de mídia" + +#: src/file.c:119 +msgid "Label orientation" +msgstr "Orientação da etiqueta" + +#: src/file.c:248 +msgid "Open" +msgstr "Abrir" + +#: src/file.c:250 +msgid "Open label" +msgstr "Abrir etiqueta" + +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "Impossível abrir o arquivo" + +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "Erro gravando o arquivo" + +#: src/file.c:468 +msgid "Save label as" +msgstr "Salvar etiqueta como" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "Necessário informar nome do arquivo" + +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "Erro gravando o arquivo" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "pontos" + +#: src/prefs.c:627 +msgid "inches" +msgstr "poleg." + +#: src/prefs.c:629 +msgid "mm" +msgstr "mm" + +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "Escala:" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels: Preferências" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "Exibir unidades" + +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "Pontos" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "Polegadas" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "Milímetros" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "Tamanho de página padrão" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "Linha" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "Preencher" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "Apagar" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "Trazer para frente" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "Enviar para trás" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "Editar propriedades..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "Editar propriedades do objeto caixa" + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "Aparência" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "Contorno" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "Posição/Tamanho" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "Posição" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "Tamanho" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "Editar propriedades do objeto elipse" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "Editar propriedades do objeto linha" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "Editar propriedades do objeto imagem" + +#: src/view-image.c:300 +msgid "Image" +msgstr "Imagem" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "Redefinir tamanho da imagem" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "Editar propriedades do objeto texto" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "Texto" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "Editar propriedades do objeto código de barras" + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "Dado" + +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "Dado do Código de Barras:" + +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "Propriedades de Texto" + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "Estilo" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "Código de barras inválido" + +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "Editar propriedades de fusão do documento" + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "Fonte" + +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "Formato:" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "Localização" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "Campos" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "Imprimir" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "Imprimir" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "Cópias" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "Controle de fusão do documento" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "Opções" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "Visualizar impressão" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "Nenhum arquivo modelo encontrado!" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "erro: xmlParseFile" + +#: src/xml-label.c:174 +#, fuzzy +msgid "No document root" +msgstr "Sem raiz do documento" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "documento de tipo errado, espaço de nome glabels não encontrado" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Nó raiz ruim = \"%s\"" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "nó ruim = \"%s\"" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "Problema salvando arquivo xml." + +#: src/merge.c:80 +msgid "None" +msgstr "Nenhum" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "Texto separado com tab" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "Texto separado com vírgula" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "Texto separado com dois pontos" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "Não definido" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "Selecione a fonte da base de dados da fusão" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "Coluna" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "Chave do campo específico" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "Dado de amostra" + +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "Fonte:" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "Cor:" + +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "Alinhamento:" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "Chave:" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "Inserir campo de fusão" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y:" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "Largura:" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "Altura:" + +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "Manter taxa de aspecto atual" + +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "Comprimento:" + +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "Ângulo:" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "graus" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "Escala:" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "Exibir texto com código de barras" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "Literal:" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "Páginas:" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "Etiquetas" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "de:" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "até:" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "Iniciar na etiqueta" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "na primeira folha" + +#: src/wdgt-print-merge.c:197 +#, fuzzy +msgid "Collate" +msgstr "Montar" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "Cópias:" + +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "Descrição:" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "Tamanho da página:" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "Tamanho da etiqueta:" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "Disposição:" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d por página)" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "Girar" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "Abrir" + +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "Reverter para a cópia gravada de %s?" + +#~ msgid "Unknown media type. Using default." +#~ msgstr "Tipo de mídia desconhecido. Usando padrão." + +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "``%s'' foi modificado.\n" +#~ "\n" +#~ "Deseja salvá-lo?" + +#~ msgid "Cannot save file" +#~ msgstr "Não posso salvar o arquivo" + +#~ msgid "Save As" +#~ msgstr "Salvar como" + +#~ msgid "Close / Save label as" +#~ msgstr "Fechar / Salvar etiqueta como" + +#~ msgid "Label no longer valid!" +#~ msgstr "Etiqueta não é mais válida" + +#~ msgid "Image format not currently supported" +#~ msgstr "Formato de imagem não suportado atualmente" + +#~ msgid "General" +#~ msgstr "Geral" + +#~ msgid "_New" +#~ msgstr "_Novo" + +#~ msgid "Make a new, empty label" +#~ msgstr "Criar uma etiqueta nova, vazia" + +#~ msgid "U_nselect All " +#~ msgstr "D_esmarcar Tudo " + +#~ msgid "Remove all selections" +#~ msgstr "Remover todas as seleções" + +#~ msgid "Select" +#~ msgstr "Selecionar" + +#~ msgid "Select, move and modify objects" +#~ msgstr "Selecionar, movimentar e modificar objetos" + +#~ msgid "Create text object" +#~ msgstr "Criar objeto texto" + +#~ msgid "Box" +#~ msgstr "Caixa" + +#~ msgid "Create box/rectangle object" +#~ msgstr "Criar objeto caixa/retângulo" + +#~ msgid "Create line object" +#~ msgstr "Criar objeto linha" + +#~ msgid "Ellipse" +#~ msgstr "Elipse" + +#~ msgid "Create ellipse/circle object" +#~ msgstr "Criar objeto elipse/círculo" + +#~ msgid "Create image object" +#~ msgstr "Criar objeto imagem" + +#~ msgid "Barcode" +#~ msgstr "Código de Barras" + +#~ msgid "Create barcode object" +#~ msgstr "Criar objeto código de barras" + +#~ msgid "Zoom in" +#~ msgstr "Mais Zoom" + +#~ msgid "Zoom out" +#~ msgstr "Menos Zoom" + +#~ msgid "Zoom 1:1" +#~ msgstr "Zoom 1:1" + +#~ msgid "Zoom to 1:1" +#~ msgstr "Zoom para 1:1" + +#~ msgid "Merge properties" +#~ msgstr "Propriedades de Fusão" + +#~ msgid "Edit merge properties" +#~ msgstr "Editar propriedades de fusão" + +#~ msgid "_Tools" +#~ msgstr "_Ferramentas" + +#~ msgid " New " +#~ msgstr " Novo " + +#~ msgid "New Label/Card" +#~ msgstr "Nova Etiqueta/Cartão" + +#~ msgid " Open " +#~ msgstr " Abrir " + +#~ msgid "Open a file" +#~ msgstr "Abrir um arquivo" + +#~ msgid " Save " +#~ msgstr " Salvar " + +#~ msgid "Save current file" +#~ msgstr "Salvar arquivo atual" + +#~ msgid " Print " +#~ msgstr " Imprimir " + +#~ msgid "Print current file" +#~ msgstr "Imprimir arquivo atual" + +#~ msgid "Function is not implemented!" +#~ msgstr "Função não está implementada!" + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Função ainda não implementada!" diff --git a/glabels2/src/Makefile.am b/glabels2/src/Makefile.am new file mode 100644 index 00000000..69b4c966 --- /dev/null +++ b/glabels2/src/Makefile.am @@ -0,0 +1,260 @@ +LIB_BARCODE_DIR = ../barcode-0.98 + +SUBDIRS= pixmaps stock-pixmaps + +bin_PROGRAMS = glabels glabels-batch + +uidir = $(datadir)/glabels/ui/ + + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + $(GLABELS_CFLAGS) \ + -I$(LIB_BARCODE_DIR) \ + -DGNOME_ICONDIR=\""$(datadir)/pixmaps"\" \ + -DGLABELS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGLABELS_UI_DIR=\""$(datadir)/glabels/ui/"\" \ + -DGLABELS_GLADEDIR=\""$(datadir)/glabels/glade/"\" \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGNOME_DISABLE_DEPRECATED + +glabels_LDFLAGS = -export-dynamic + +glabels_LDADD = \ + $(GLABELS_LIBS) \ + -L$(LIB_BARCODE_DIR) -lbarcode + +glabels_batch_LDFLAGS = -export-dynamic + +glabels_batch_LDADD = \ + $(GLABELS_LIBS) \ + -L$(LIB_BARCODE_DIR) -lbarcode + +BUILT_SOURCES = \ + marshal.c \ + marshal.h \ + gnome-recent-marshal.c \ + gnome-recent-marshal.h + +glabels_SOURCES = \ + glabels.c \ + glabels.h \ + splash.c \ + splash.h \ + mdi.c \ + mdi.h \ + mdi-child.c \ + mdi-child.h \ + stock.c \ + stock.h \ + menus.h \ + menus.c \ + commands.h \ + commands.c \ + file.h \ + file.c \ + recent.h \ + recent.c \ + tools.h \ + tools.c \ + prefs.c \ + prefs.h \ + prefs-dialog.c \ + prefs-dialog.h \ + view.c \ + view.h \ + view-object.c \ + view-object.h \ + view-box.c \ + view-box.h \ + view-ellipse.c \ + view-ellipse.h \ + view-line.c \ + view-line.h \ + view-image.c \ + view-image.h \ + view-text.c \ + view-text.h \ + view-barcode.c \ + view-barcode.h \ + view-highlight.c \ + view-highlight.h \ + merge-properties.c \ + merge-properties.h \ + print.c \ + print.h \ + print-dialog.c \ + print-dialog.h \ + bc.c \ + bc.h \ + bc-gnubarcode.c \ + bc-gnubarcode.h \ + bc-postnet.c \ + bc-postnet.h \ + label.c \ + label.h \ + label-object.c \ + label-object.h \ + label-text.c \ + label-text.h \ + label-box.c \ + label-box.h \ + label-line.c \ + label-line.h \ + label-ellipse.c \ + label-ellipse.h \ + label-image.c \ + label-image.h \ + label-barcode.c \ + label-barcode.h \ + template.c \ + template.h \ + xml-label.c \ + xml-label.h \ + merge.c \ + merge.h \ + merge-text.c \ + merge-text.h \ + merge-ui.c \ + merge-ui.h \ + merge-ui-text.c \ + merge-ui-text.h \ + text-node.c \ + text-node.h \ + wdgt-text-props.c \ + wdgt-text-props.h \ + wdgt-text-entry.c \ + wdgt-text-entry.h \ + wdgt-position.c \ + wdgt-position.h \ + wdgt-size.c \ + wdgt-size.h \ + wdgt-line.c \ + wdgt-line.h \ + wdgt-fill.c \ + wdgt-fill.h \ + wdgt-vector.c \ + wdgt-vector.h \ + wdgt-bc-props.c \ + wdgt-bc-props.h \ + wdgt-bc-style.c \ + wdgt-bc-style.h \ + wdgt-bc-data.c \ + wdgt-bc-data.h \ + wdgt-print-copies.c \ + wdgt-print-copies.h \ + wdgt-print-merge.c \ + wdgt-print-merge.h \ + wdgt-media-select.c \ + wdgt-media-select.h \ + wdgt-mini-preview.c \ + wdgt-mini-preview.h \ + wdgt-rotate-label.c \ + wdgt-rotate-label.h \ + util.c \ + util.h \ + canvas-hacktext.c \ + canvas-hacktext.h \ + bonobo-mdi-child.c \ + bonobo-mdi-child.h \ + bonobo-mdi.c \ + bonobo-mdi.h \ + gnome-recent-model.c \ + gnome-recent-model.h \ + gnome-recent-util.c \ + gnome-recent-util.h \ + gnome-recent-view.c \ + gnome-recent-view.h \ + gnome-recent-view-bonobo.c \ + gnome-recent-view-bonobo.h \ + debug.c \ + debug.h \ + $(BUILT_SOURCES) + +glabels_batch_SOURCES = \ + glabels-batch.c \ + prefs.c \ + prefs.h \ + print.c \ + print.h \ + bc.c \ + bc.h \ + bc-gnubarcode.c \ + bc-gnubarcode.h \ + bc-postnet.c \ + bc-postnet.h \ + label.c \ + label.h \ + label-object.c \ + label-object.h \ + label-text.c \ + label-text.h \ + label-box.c \ + label-box.h \ + label-line.c \ + label-line.h \ + label-ellipse.c \ + label-ellipse.h \ + label-image.c \ + label-image.h \ + label-barcode.c \ + label-barcode.h \ + template.c \ + template.h \ + xml-label.c \ + xml-label.h \ + merge.c \ + merge.h \ + merge-text.c \ + merge-text.h \ + text-node.c \ + text-node.h \ + util.c \ + util.h \ + debug.c \ + debug.h \ + $(BUILT_SOURCES) + +marshal.h: marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gl_marshal > $@ + +marshal.c: marshal.list $(GLIB_GENMARSHAL) + echo "#include \"marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gl_marshal >> $@ + +gnome-recent-marshal.h: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gnome_recent > $@ + +gnome-recent-marshal.c: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + echo "#include \"gnome-recent-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gnome_recent >> $@ + + +ui_DATA = glabels-ui.xml + +EXTRA_DIST = \ + $(ui_DATA) \ + marshal.list \ + gnome-recent-marshal.list + +CLEANFILES = $(BUILT_SOURCES) + +$(bin_PROGRAMS): $(LIB_BARCODE_DIR)/libbarcode.a + +$(LIB_BARCODE_DIR)/libbarcode.a: + cd $(LIB_BARCODE_DIR); $(MAKE) + +clean: barcode_clean + +barcode_clean: + cd $(LIB_BARCODE_DIR); $(MAKE) clean + +distclean maintainer-clean: barcode_distclean + +barcode_distclean: + cd $(LIB_BARCODE_DIR); $(MAKE) distclean + diff --git a/glabels2/src/Makefile.in b/glabels2/src/Makefile.in new file mode 100644 index 00000000..2ec50818 --- /dev/null +++ b/glabels2/src/Makefile.in @@ -0,0 +1,478 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +LIB_BARCODE_DIR = ../barcode-0.98 + +SUBDIRS = pixmaps stock-pixmaps + +bin_PROGRAMS = glabels glabels-batch + +uidir = $(datadir)/glabels/ui/ + +INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/dialogs $(GLABELS_CFLAGS) -I$(LIB_BARCODE_DIR) -DGNOME_ICONDIR=\""$(datadir)/pixmaps"\" -DGLABELS_LOCALEDIR=\""$(datadir)/locale"\" -DGLABELS_UI_DIR=\""$(datadir)/glabels/ui/"\" -DGLABELS_GLADEDIR=\""$(datadir)/glabels/glade/"\" -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED + + +glabels_LDFLAGS = -export-dynamic + +glabels_LDADD = $(GLABELS_LIBS) -L$(LIB_BARCODE_DIR) -lbarcode + + +glabels_batch_LDFLAGS = -export-dynamic + +glabels_batch_LDADD = $(GLABELS_LIBS) -L$(LIB_BARCODE_DIR) -lbarcode + + +BUILT_SOURCES = marshal.c marshal.h gnome-recent-marshal.c gnome-recent-marshal.h + + +glabels_SOURCES = glabels.c glabels.h splash.c splash.h mdi.c mdi.h mdi-child.c mdi-child.h stock.c stock.h menus.h menus.c commands.h commands.c file.h file.c recent.h recent.c tools.h tools.c prefs.c prefs.h prefs-dialog.c prefs-dialog.h view.c view.h view-object.c view-object.h view-box.c view-box.h view-ellipse.c view-ellipse.h view-line.c view-line.h view-image.c view-image.h view-text.c view-text.h view-barcode.c view-barcode.h view-highlight.c view-highlight.h merge-properties.c merge-properties.h print.c print.h print-dialog.c print-dialog.h bc.c bc.h bc-gnubarcode.c bc-gnubarcode.h bc-postnet.c bc-postnet.h label.c label.h label-object.c label-object.h label-text.c label-text.h label-box.c label-box.h label-line.c label-line.h label-ellipse.c label-ellipse.h label-image.c label-image.h label-barcode.c label-barcode.h template.c template.h xml-label.c xml-label.h merge.c merge.h merge-text.c merge-text.h merge-ui.c merge-ui.h merge-ui-text.c merge-ui-text.h text-node.c text-node.h wdgt-text-props.c wdgt-text-props.h wdgt-text-entry.c wdgt-text-entry.h wdgt-position.c wdgt-position.h wdgt-size.c wdgt-size.h wdgt-line.c wdgt-line.h wdgt-fill.c wdgt-fill.h wdgt-vector.c wdgt-vector.h wdgt-bc-props.c wdgt-bc-props.h wdgt-bc-style.c wdgt-bc-style.h wdgt-bc-data.c wdgt-bc-data.h wdgt-print-copies.c wdgt-print-copies.h wdgt-print-merge.c wdgt-print-merge.h wdgt-media-select.c wdgt-media-select.h wdgt-mini-preview.c wdgt-mini-preview.h wdgt-rotate-label.c wdgt-rotate-label.h util.c util.h canvas-hacktext.c canvas-hacktext.h bonobo-mdi-child.c bonobo-mdi-child.h bonobo-mdi.c bonobo-mdi.h gnome-recent-model.c gnome-recent-model.h gnome-recent-util.c gnome-recent-util.h gnome-recent-view.c gnome-recent-view.h gnome-recent-view-bonobo.c gnome-recent-view-bonobo.h debug.c debug.h $(BUILT_SOURCES) + + +glabels_batch_SOURCES = glabels-batch.c prefs.c prefs.h print.c print.h bc.c bc.h bc-gnubarcode.c bc-gnubarcode.h bc-postnet.c bc-postnet.h label.c label.h label-object.c label-object.h label-text.c label-text.h label-box.c label-box.h label-line.c label-line.h label-ellipse.c label-ellipse.h label-image.c label-image.h label-barcode.c label-barcode.h template.c template.h xml-label.c xml-label.h merge.c merge.h merge-text.c merge-text.h text-node.c text-node.h util.c util.h debug.c debug.h $(BUILT_SOURCES) + + +ui_DATA = glabels-ui.xml + +EXTRA_DIST = $(ui_DATA) marshal.list gnome-recent-marshal.list + + +CLEANFILES = $(BUILT_SOURCES) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +glabels_OBJECTS = glabels.o splash.o mdi.o mdi-child.o stock.o menus.o \ +commands.o file.o recent.o tools.o prefs.o prefs-dialog.o view.o \ +view-object.o view-box.o view-ellipse.o view-line.o view-image.o \ +view-text.o view-barcode.o view-highlight.o merge-properties.o print.o \ +print-dialog.o bc.o bc-gnubarcode.o bc-postnet.o label.o label-object.o \ +label-text.o label-box.o label-line.o label-ellipse.o label-image.o \ +label-barcode.o template.o xml-label.o merge.o merge-text.o merge-ui.o \ +merge-ui-text.o text-node.o wdgt-text-props.o wdgt-text-entry.o \ +wdgt-position.o wdgt-size.o wdgt-line.o wdgt-fill.o wdgt-vector.o \ +wdgt-bc-props.o wdgt-bc-style.o wdgt-bc-data.o wdgt-print-copies.o \ +wdgt-print-merge.o wdgt-media-select.o wdgt-mini-preview.o \ +wdgt-rotate-label.o util.o canvas-hacktext.o bonobo-mdi-child.o \ +bonobo-mdi.o gnome-recent-model.o gnome-recent-util.o \ +gnome-recent-view.o gnome-recent-view-bonobo.o debug.o marshal.o \ +gnome-recent-marshal.o +glabels_DEPENDENCIES = +glabels_batch_OBJECTS = glabels-batch.o prefs.o print.o bc.o \ +bc-gnubarcode.o bc-postnet.o label.o label-object.o label-text.o \ +label-box.o label-line.o label-ellipse.o label-image.o label-barcode.o \ +template.o xml-label.o merge.o merge-text.o text-node.o util.o debug.o \ +marshal.o gnome-recent-marshal.o +glabels_batch_DEPENDENCIES = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(ui_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(glabels_SOURCES) $(glabels_batch_SOURCES) +OBJECTS = $(glabels_OBJECTS) $(glabels_batch_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +glabels: $(glabels_OBJECTS) $(glabels_DEPENDENCIES) + @rm -f glabels + $(LINK) $(glabels_LDFLAGS) $(glabels_OBJECTS) $(glabels_LDADD) $(LIBS) + +glabels-batch: $(glabels_batch_OBJECTS) $(glabels_batch_DEPENDENCIES) + @rm -f glabels-batch + $(LINK) $(glabels_batch_LDFLAGS) $(glabels_batch_OBJECTS) $(glabels_batch_LDADD) $(LIBS) + +install-uiDATA: $(ui_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(uidir) + @list='$(ui_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(uidir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(uidir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(uidir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(uidir)/$$p; \ + fi; fi; \ + done + +uninstall-uiDATA: + @$(NORMAL_UNINSTALL) + list='$(ui_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(uidir)/$$p; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" != "." || dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: install-binPROGRAMS +install-exec: install-exec-recursive + +install-data-am: install-uiDATA +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-binPROGRAMS uninstall-uiDATA +uninstall: uninstall-recursive +all-am: Makefile $(PROGRAMS) $(DATA) +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(uidir) + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \ + mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ + distclean-generic clean-am + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile uninstall-uiDATA install-uiDATA \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +marshal.h: marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gl_marshal > $@ + +marshal.c: marshal.list $(GLIB_GENMARSHAL) + echo "#include \"marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gl_marshal >> $@ + +gnome-recent-marshal.h: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gnome_recent > $@ + +gnome-recent-marshal.c: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + echo "#include \"gnome-recent-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gnome_recent >> $@ + +$(bin_PROGRAMS): $(LIB_BARCODE_DIR)/libbarcode.a + +$(LIB_BARCODE_DIR)/libbarcode.a: + cd $(LIB_BARCODE_DIR); $(MAKE) + +clean: barcode_clean + +barcode_clean: + cd $(LIB_BARCODE_DIR); $(MAKE) clean + +distclean maintainer-clean: barcode_distclean + +barcode_distclean: + cd $(LIB_BARCODE_DIR); $(MAKE) distclean + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/src/bc-gnubarcode.c b/glabels2/src/bc-gnubarcode.c new file mode 100644 index 00000000..8199ecf9 --- /dev/null +++ b/glabels2/src/bc-gnubarcode.c @@ -0,0 +1,239 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc-gnubarcode.c: front-end to GNU-barcode-library module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * Some of this code is borrowed from the postscript renderer (ps.c) + * from the GNU barcode library: + * + * Copyright (C) 1999 Alessaandro Rubini (rubini@gnu.org) + * Copyright (C) 1999 Prosa Srl. (prosa@prosa.it) + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "bc.h" +#include "bc-gnubarcode.h" + +#include "barcode.h" + +#include "debug.h" + +#define SHRINK_AMOUNT 0.15 /* shrink bars to account for ink spreading */ +#define FONT_SCALE 0.95 /* Shrink fonts just a hair */ + +static glBarcode *render_pass1 (struct Barcode_Item *bci, + gboolean text_flag, + gdouble scale); + +/*****************************************************************************/ +/* Generate intermediate representation of barcode. */ +/*****************************************************************************/ +glBarcode * +gl_barcode_gnubarcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits) +{ + glBarcode *gbc; + struct Barcode_Item *bci; + gint flags; + + bci = Barcode_Create (digits); + + /* First encode using GNU Barcode library */ + switch (style) { + case GL_BARCODE_STYLE_EAN: + flags = BARCODE_EAN; + break; + case GL_BARCODE_STYLE_UPC: + flags = BARCODE_UPC; + break; + case GL_BARCODE_STYLE_ISBN: + flags = BARCODE_ISBN; + break; + case GL_BARCODE_STYLE_39: + flags = BARCODE_39; + break; + case GL_BARCODE_STYLE_128: + flags = BARCODE_128; + break; + case GL_BARCODE_STYLE_128C: + flags = BARCODE_128C; + break; + case GL_BARCODE_STYLE_128B: + flags = BARCODE_128B; + break; + case GL_BARCODE_STYLE_I25: + flags = BARCODE_I25; + break; + case GL_BARCODE_STYLE_CBR: + flags = BARCODE_CBR; + break; + case GL_BARCODE_STYLE_MSI: + flags = BARCODE_MSI; + break; + case GL_BARCODE_STYLE_PLS: + flags = BARCODE_PLS; + break; + default: + g_warning( "Illegal barcode style %d", style ); + flags = BARCODE_ANY; + break; + } + Barcode_Encode (bci, flags); + if (!bci->partial || !bci->textinfo) { + g_warning ("Barcode Data Invalid"); + Barcode_Delete (bci); + return NULL; + } + + /* now render with our custom back-end, + to create appropriate intermdediate format */ + gbc = render_pass1 (bci, text_flag, scale); + + Barcode_Delete (bci); + return gbc; +} + +/*-------------------------------------------------------------------------- + * PRIVATE. Render to glBarcode intermediate representation of barcode. + * + * Some of this code is borrowed from the postscript renderer (ps.c) + * from the GNU barcode library: + * + * Copyright (C) 1999 Alessaandro Rubini (rubini@gnu.org) + * Copyright (C) 1999 Prosa Srl. (prosa@prosa.it) + * + *--------------------------------------------------------------------------*/ +static glBarcode * +render_pass1 (struct Barcode_Item *bci, + gboolean text_flag, + gdouble scale) +{ + glBarcode *gbc; + glBarcodeLine *line; + glBarcodeChar *bchar; + gdouble x; + gint i, j, barlen; + gdouble f1, f2; + gint mode = '-'; /* text below bars */ + gdouble x0, y0, yr; + guchar *p, c; + + /* First calculate barlen */ + barlen = bci->partial[0] - '0'; + for (p = bci->partial + 1; *p != 0; p++) { + if (isdigit (*p)) { + barlen += *p - '0'; + } else { + if ((*p != '+') && (*p != '-')) { + barlen += *p - 'a' + 1; + } + } + } + + /* The width defaults to "just enough" */ + bci->width = barlen * scale + 1; + + /* The height defaults to 80 points (rescaled) */ + if (!bci->height) + bci->height = 80 * scale; + + gbc = g_new0 (glBarcode, 1); + + /* Now traverse the code string and create a list of lines */ + x = bci->margin + (bci->partial[0] - '0') * scale; + for (p = bci->partial + 1, i = 1; *p != 0; p++, i++) { + /* special cases: '+' and '-' */ + if (*p == '+' || *p == '-') { + mode = *p; /* don't count it */ + i++; + continue; + } + /* j is the width of this bar/space */ + if (isdigit (*p)) + j = *p - '0'; + else + j = *p - 'a' + 1; + if (i % 2) { /* bar */ + x0 = x + (j * scale) / 2; + y0 = bci->margin; + yr = bci->height; + if (text_flag) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 or 5 points */ + yr -= (isdigit (*p) ? 10 : 5) * scale; + } else { /* '+' */ + /* above bars: 10 or 0 from bottom, + and 10 from top */ + y0 += 10 * scale; + yr -= (isdigit (*p) ? 20 : 10) * scale; + } + } + line = g_new0 (glBarcodeLine, 1); + line->x = x0; + line->y = y0; + line->length = yr; + line->width = (j * scale) - SHRINK_AMOUNT; + gbc->lines = g_list_append (gbc->lines, line); + } + x += j * scale; + + } + + /* Now the text */ + mode = '-'; /* reinstantiate default */ + if (text_flag) { + for (p = bci->textinfo; p; p = strchr (p, ' ')) { + while (*p == ' ') + p++; + if (!*p) + break; + if (*p == '+' || *p == '-') { + mode = *p; + continue; + } + if (sscanf (p, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + g_warning ("impossible data: %s", p); + continue; + } + bchar = g_new0 (glBarcodeChar, 1); + bchar->x = f1 * scale + bci->margin; + if (mode == '-') { + bchar->y = + bci->margin + bci->height - 8 * scale; + } else { + bchar->y = bci->margin; + } + bchar->fsize = f2 * FONT_SCALE * scale; + bchar->c = c; + gbc->chars = g_list_append (gbc->chars, bchar); + } + } + + /* Fill in other info */ + gbc->height = bci->height + 2.0 * bci->margin; + gbc->width = bci->width + 2.0 * bci->margin; + + return gbc; +} diff --git a/glabels2/src/bc-gnubarcode.h b/glabels2/src/bc-gnubarcode.h new file mode 100644 index 00000000..4cedd618 --- /dev/null +++ b/glabels2/src/bc-gnubarcode.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_gnubarcode.h: front-end to GNU-barcode-library module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_GNUBARCODE_H__ +#define __BC_GNUBARCODE_H__ + +#include "bc.h" + +extern glBarcode *gl_barcode_gnubarcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits); + +#endif diff --git a/glabels2/src/bc-postnet.c b/glabels2/src/bc-postnet.c new file mode 100644 index 00000000..90b463d2 --- /dev/null +++ b/glabels2/src/bc-postnet.c @@ -0,0 +1,150 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_postnet.c: GLabels POSTNET barcode module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This module implements the POSTNET barcode specified in the USPS + * publication 25, Mar 2001. + */ + +#include + +#include + +#include "bc.h" +#include "bc-postnet.h" + +#include "debug.h" + +static gchar *symbols[] = { + /* 0 */ "11000", + /* 1 */ "00011", + /* 2 */ "00101", + /* 3 */ "00110", + /* 4 */ "01001", + /* 5 */ "01010", + /* 6 */ "01100", + /* 7 */ "10001", + /* 8 */ "10010", + /* 9 */ "10100", +}; + +static gchar *frame_symbol = "1"; + +#define POSTNET_BAR_WIDTH 1.25 +#define POSTNET_FULLBAR_HEIGHT 9.00 +#define POSTNET_HALFBAR_HEIGHT 3.50 +#define POSTNET_BAR_PITCH 3.25 +#define POSTNET_HORIZ_MARGIN 9.00 +#define POSTNET_VERT_MARGIN 3.00 + +static gchar *postnet_code (gchar * digits); + +/****************************************************************************/ +/* Generate list of lines that form the barcode for the given digits. */ +/****************************************************************************/ +glBarcode * +gl_barcode_postnet_new (gchar * digits) +{ + gchar *code, *p; + glBarcode *gbc; + glBarcodeLine *line; + gdouble x; + + gbc = g_new0 (glBarcode, 1); + + /* First get code string */ + code = postnet_code (digits); + if (code == NULL) { + return NULL; + } + + /* Now traverse the code string and create a list of lines */ + x = POSTNET_HORIZ_MARGIN; + for (p = code; *p != 0; p++) { + line = g_new0 (glBarcodeLine, 1); + line->x = x; + line->y = POSTNET_VERT_MARGIN; + if (*p == '0') { + line->y += + POSTNET_FULLBAR_HEIGHT - POSTNET_HALFBAR_HEIGHT; + line->length = POSTNET_HALFBAR_HEIGHT; + } else { + line->length = POSTNET_FULLBAR_HEIGHT; + } + line->width = POSTNET_BAR_WIDTH; + + gbc->lines = g_list_append (gbc->lines, line); + + x += POSTNET_BAR_PITCH; + } + + g_free (code); + + gbc->width = x + POSTNET_HORIZ_MARGIN; + gbc->height = POSTNET_FULLBAR_HEIGHT + 2 * POSTNET_VERT_MARGIN; + + gbc->chars = NULL; + + return gbc; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Generate string of symbols, representing barcode. */ +/*--------------------------------------------------------------------------*/ +static gchar * +postnet_code (gchar * digits) +{ + gchar *p; + gint len; + gint d, sum; + GString *code; + gchar *ret; + + /* Left frame bar */ + code = g_string_new (frame_symbol); + + sum = 0; + for (p = digits, len = 0; (*p != 0) && (len < 11); p++) { + if (isdigit (*p)) { + /* Only translate valid characters (0-9) */ + d = (*p) - '0'; + sum += d; + code = g_string_append (code, symbols[d]); + len++; + } + } + if ((len != 5) && (len != 9) && (len != 11)) { + g_warning ("Invalid POSTNET length %d, should be 5(ZIP), 9(ZIP+4), or 11(DPBC)", len); + } + + /* Create correction character */ + d = (10 - (sum % 10)) % 10; + code = g_string_append (code, symbols[d]); + + /* Right frame bar */ + code = g_string_append (code, frame_symbol); + + ret = g_strdup (code->str); + g_string_free (code, TRUE); + + return ret; +} diff --git a/glabels2/src/bc-postnet.h b/glabels2/src/bc-postnet.h new file mode 100644 index 00000000..c54a31c0 --- /dev/null +++ b/glabels2/src/bc-postnet.h @@ -0,0 +1,29 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_postnet.h: GLabels POSTNET barcode module header file + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_POSTNET_H__ +#define __BC_POSTNET_H__ + +#include + +glBarcode *gl_barcode_postnet_new (gchar * digits); + +#endif diff --git a/glabels2/src/bc.c b/glabels2/src/bc.c new file mode 100644 index 00000000..a83a3336 --- /dev/null +++ b/glabels2/src/bc.c @@ -0,0 +1,201 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc.c: GLabels barcode module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "bc.h" +#include "bc-postnet.h" +#include "bc-gnubarcode.h" + +#include "debug.h" + +/*****************************************************************************/ +/* Call appropriate barcode backend to create barcode in intermediate format.*/ +/*****************************************************************************/ +glBarcode * +gl_barcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits) +{ + glBarcode *gbc; + + switch (style) { + + case GL_BARCODE_STYLE_POSTNET: + /* Use the POSTNET backend module */ + gbc = gl_barcode_postnet_new (digits); + break; + + default: + /* Use the GNU barcode library backend */ + gbc = gl_barcode_gnubarcode_new (style, text_flag, scale, digits); + break; + + } + return gbc; +} + +/*****************************************************************************/ +/* Free previously created barcode. */ +/*****************************************************************************/ +void +gl_barcode_free (glBarcode ** gbc) +{ + GList *p; + + if (*gbc != NULL) { + + for (p = (*gbc)->lines; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + g_list_free ((*gbc)->lines); + (*gbc)->lines = NULL; + + for (p = (*gbc)->chars; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + g_list_free ((*gbc)->chars); + (*gbc)->chars = NULL; + + g_free (*gbc); + *gbc = NULL; + } +} + +/*****************************************************************************/ +/* Return an appropriate set of digits for the given barcode style. */ +/*****************************************************************************/ +gchar * +gl_barcode_default_digits (glBarcodeStyle style) +{ + switch (style) { + + case GL_BARCODE_STYLE_POSTNET: + return g_strdup ("000000000"); + case GL_BARCODE_STYLE_EAN: + return g_strdup ("000000000000 00000"); + case GL_BARCODE_STYLE_UPC: + return g_strdup ("00000000000 00000"); + case GL_BARCODE_STYLE_ISBN: + return g_strdup ("0-00000-000-0 00000"); + case GL_BARCODE_STYLE_39: + case GL_BARCODE_STYLE_128: + case GL_BARCODE_STYLE_128C: + case GL_BARCODE_STYLE_128B: + case GL_BARCODE_STYLE_I25: + case GL_BARCODE_STYLE_CBR: + case GL_BARCODE_STYLE_MSI: + case GL_BARCODE_STYLE_PLS: + return g_strdup ("0000000000"); + default: + return g_strdup ("0"); + } + +} + +/*****************************************************************************/ +/* Convert style to text. */ +/*****************************************************************************/ +const gchar * +gl_barcode_style_to_text (glBarcodeStyle style) +{ + switch (style) { + case GL_BARCODE_STYLE_POSTNET: + return "POSTNET"; + case GL_BARCODE_STYLE_EAN: + return "EAN"; + case GL_BARCODE_STYLE_UPC: + return "UPC"; + case GL_BARCODE_STYLE_ISBN: + return "ISBN"; + case GL_BARCODE_STYLE_39: + return "Code39"; + case GL_BARCODE_STYLE_128: + return "Code128"; + case GL_BARCODE_STYLE_128C: + return "Code128C"; + case GL_BARCODE_STYLE_128B: + return "Code128B"; + case GL_BARCODE_STYLE_I25: + return "I25"; + case GL_BARCODE_STYLE_CBR: + return "CBR"; + case GL_BARCODE_STYLE_MSI: + return "MSI"; + case GL_BARCODE_STYLE_PLS: + return "PLS"; + default: + g_warning( "Illegal barcode style %d", style ); + return "?"; + } +} + +/*****************************************************************************/ +/* Convert text to style. */ +/*****************************************************************************/ +glBarcodeStyle +gl_barcode_text_to_style (const gchar * text) +{ + + if (g_strcasecmp (text, "POSTNET") == 0) { + return GL_BARCODE_STYLE_POSTNET; + } + if (g_strcasecmp (text, "EAN") == 0) { + return GL_BARCODE_STYLE_EAN; + } + if (g_strcasecmp (text, "UPC") == 0) { + return GL_BARCODE_STYLE_UPC; + } + if (g_strcasecmp (text, "ISBN") == 0) { + return GL_BARCODE_STYLE_ISBN; + } + if (g_strcasecmp (text, "Code39") == 0) { + return GL_BARCODE_STYLE_39; + } + if (g_strcasecmp (text, "Code128") == 0) { + return GL_BARCODE_STYLE_128; + } + if (g_strcasecmp (text, "Code128C") == 0) { + return GL_BARCODE_STYLE_128C; + } + if (g_strcasecmp (text, "Code128B") == 0) { + return GL_BARCODE_STYLE_128B; + } + if (g_strcasecmp (text, "I25") == 0) { + return GL_BARCODE_STYLE_I25; + } + if (g_strcasecmp (text, "CBR") == 0) { + return GL_BARCODE_STYLE_CBR; + } + if (g_strcasecmp (text, "MSI") == 0) { + return GL_BARCODE_STYLE_MSI; + } + if (g_strcasecmp (text, "PLS") == 0) { + return GL_BARCODE_STYLE_PLS; + } else { + g_warning( "Unknown barcode style text \"%s\"", text ); + return GL_BARCODE_STYLE_POSTNET; + } + +} diff --git a/glabels2/src/bc.h b/glabels2/src/bc.h new file mode 100644 index 00000000..01b3b890 --- /dev/null +++ b/glabels2/src/bc.h @@ -0,0 +1,73 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc.h: GLabels barcode module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_H__ +#define __BC_H__ + +#include + +typedef enum { + GL_BARCODE_STYLE_POSTNET, + GL_BARCODE_STYLE_EAN, + GL_BARCODE_STYLE_UPC, + GL_BARCODE_STYLE_ISBN, + GL_BARCODE_STYLE_39, + GL_BARCODE_STYLE_128, + GL_BARCODE_STYLE_128C, + GL_BARCODE_STYLE_128B, + GL_BARCODE_STYLE_I25, + GL_BARCODE_STYLE_128RAW, + GL_BARCODE_STYLE_CBR, + GL_BARCODE_STYLE_MSI, + GL_BARCODE_STYLE_PLS, +} glBarcodeStyle; + +typedef struct { + gdouble x, y, length, width; +} glBarcodeLine; + +typedef struct { + gdouble x, y, fsize; + gchar c; +} glBarcodeChar; + +typedef struct { + gdouble width, height; + GList *lines; /* List of glBarcodeLine */ + GList *chars; /* List of glBarcodeChar */ +} glBarcode; + +#define GL_BARCODE_FONT_FAMILY "Helvetica" +#define GL_BARCODE_FONT_WEIGHT GNOME_FONT_BOOK + +extern glBarcode *gl_barcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits); + +extern void + gl_barcode_free (glBarcode ** bc); + +extern gchar *gl_barcode_default_digits (glBarcodeStyle style); +extern const gchar *gl_barcode_style_to_text (glBarcodeStyle style); +extern glBarcodeStyle gl_barcode_text_to_style (const gchar * text); + +#endif diff --git a/glabels2/src/bonobo-mdi-child.c b/glabels2/src/bonobo-mdi-child.c new file mode 100644 index 00000000..09dd381d --- /dev/null +++ b/glabels2/src/bonobo-mdi-child.c @@ -0,0 +1,316 @@ +/* + * bonobo-mdi-child.c - implementation of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * 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 of the License, 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., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +#include "bonobo-mdi-child.h" + +struct _BonoboMDIChildPrivate +{ + GObject *parent; + + gchar *name; + GList *views; +}; + +enum { + NAME_CHANGED, + LAST_SIGNAL +}; + +static void bonobo_mdi_child_class_init (BonoboMDIChildClass *klass); +static void bonobo_mdi_child_instance_init (BonoboMDIChild *); +static void bonobo_mdi_child_finalize (GObject *); + +static GtkWidget *bonobo_mdi_child_set_label (BonoboMDIChild *, GtkWidget *, gpointer); +static GtkWidget *bonobo_mdi_child_create_view (BonoboMDIChild *); + +static void bonobo_mdi_child_real_name_changed (BonoboMDIChild *child, gchar* old_name); + +static GObjectClass *parent_class = NULL; +static guint mdi_child_signals [LAST_SIGNAL] = { 0 }; + +GType +bonobo_mdi_child_get_type (void) +{ + static GType bonobo_mdi_child_type = 0; + + if (bonobo_mdi_child_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (BonoboMDIChildClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) bonobo_mdi_child_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (BonoboMDIChild), + 0, /* n_preallocs */ + (GInstanceInitFunc) bonobo_mdi_child_instance_init + }; + + bonobo_mdi_child_type = g_type_register_static (G_TYPE_OBJECT, + "BonoboMDIChild", + &our_info, + 0); + } + + return bonobo_mdi_child_type; +} + +static void +bonobo_mdi_child_class_init (BonoboMDIChildClass *klass) +{ + GObjectClass *gobject_class; + + parent_class = g_type_class_peek_parent (klass); + + gobject_class = (GObjectClass*)klass; + + gobject_class->finalize = bonobo_mdi_child_finalize; + + klass->create_view = NULL; + klass->get_config_string = NULL; + klass->set_label = bonobo_mdi_child_set_label; + + klass->name_changed = bonobo_mdi_child_real_name_changed; + + mdi_child_signals[NAME_CHANGED] = + g_signal_new ("name_changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (BonoboMDIChildClass, name_changed), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, + G_TYPE_STRING); +} + +static void +bonobo_mdi_child_instance_init (BonoboMDIChild *mdi_child) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + + mdi_child->priv = g_new0 (BonoboMDIChildPrivate, 1); + + mdi_child->priv->name = NULL; + mdi_child->priv->parent = NULL; + mdi_child->priv->views = NULL; +} + + +/* the default set_label function: returns a GtkLabel with child->priv->name + * if you provide your own, it should return a new widget if its old_label + * parameter is NULL and modify and return the old widget otherwise. it + * should (obviously) NOT call the parent class handler! + */ +static GtkWidget * +bonobo_mdi_child_set_label (BonoboMDIChild *child, GtkWidget *old_label, gpointer data) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), NULL); + g_return_val_if_fail (child->priv != NULL, NULL); + + if (old_label != NULL) + { + gtk_label_set_text (GTK_LABEL (old_label), child->priv->name); + return old_label; + } + else + { + GtkWidget *label; + + label = gtk_label_new (child->priv->name); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + + return label; + } +} + +static void +bonobo_mdi_child_finalize (GObject *obj) +{ + BonoboMDIChild *mdi_child; + + g_return_if_fail (BONOBO_IS_MDI_CHILD (obj)); + + mdi_child = BONOBO_MDI_CHILD (obj); + g_return_if_fail (mdi_child->priv != NULL); + + while (mdi_child->priv->views) + bonobo_mdi_child_remove_view (mdi_child, + GTK_WIDGET (mdi_child->priv->views->data)); + + if (mdi_child->priv->name != NULL) + g_free (mdi_child->priv->name); + + if (mdi_child->priv != NULL) + g_free (mdi_child->priv); + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize)(obj); +} + +/** + * bonobo_mdi_child_add_view: + * @mdi_child: A pointer to a BonoboMDIChild object. + * + * Description: + * Creates a new view of a child (a GtkWidget) adds it to the list + * of the views and returns a pointer to it. Virtual function + * that has to be specified for classes derived from BonoboMDIChild + * is used to create the new view. + * + * Return value: + * A pointer to the new view. + **/ +GtkWidget * +bonobo_mdi_child_add_view (BonoboMDIChild *mdi_child) +{ + GtkWidget *view = NULL; + + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + view = bonobo_mdi_child_create_view (mdi_child); + + if (view) { + mdi_child->priv->views = g_list_append (mdi_child->priv->views, view); + + g_object_set_data (G_OBJECT (view), "BonoboMDIChild", mdi_child); + } + + return view; +} + +/** + * bonobo_mdi_child_remove_view: + * @mdi_child: A pointer to a BonoboMDIChild object. + * @view: View to be removed. + * + * Description: + * Removes view @view from the list of @mdi_child's views and + * unrefs it. + **/ +void +bonobo_mdi_child_remove_view (BonoboMDIChild *mdi_child, GtkWidget *view) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + g_return_if_fail (mdi_child->priv != NULL); + g_return_if_fail (GTK_IS_WIDGET (view)); + + mdi_child->priv->views = g_list_remove (mdi_child->priv->views, view); + + g_object_unref (G_OBJECT (view)); +} + +/** + * bonobo_mdi_child_set_name: + * @mdi_child: A pointer to a BonoboMDIChild object. + * @name: String containing the new name for the child. + * + * Description: + * Changes name of @mdi_child to @name. @name is duplicated and stored + * in @mdi_child. If @mdi_child has already been added to BonoboMDI, + * it also takes care of updating it. + **/ +void +bonobo_mdi_child_set_name (BonoboMDIChild *mdi_child, const gchar *name) +{ + gchar *old_name; + + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + g_return_if_fail (mdi_child->priv != NULL); + + old_name = mdi_child->priv->name; + + if (old_name == name) + return; + + mdi_child->priv->name = (gchar *)g_strdup (name); + + g_signal_emit (G_OBJECT (mdi_child), + mdi_child_signals [NAME_CHANGED], 0, + old_name); + + if (old_name) + g_free (old_name); +} + +static GtkWidget * +bonobo_mdi_child_create_view (BonoboMDIChild *child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), NULL); + + if (BONOBO_MDI_CHILD_GET_CLASS (child)->create_view) + return BONOBO_MDI_CHILD_GET_CLASS (child)->create_view (child, NULL); + + return NULL; +} + +static void +bonobo_mdi_child_real_name_changed (BonoboMDIChild *child, gchar* old_name) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (child)); + + return; +} + +gchar * +bonobo_mdi_child_get_name (const BonoboMDIChild *mdi_child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + if (mdi_child->priv->name) + return g_strdup (mdi_child->priv->name); + else + return NULL; +} + +GList * +bonobo_mdi_child_get_views (const BonoboMDIChild *mdi_child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + return mdi_child->priv->views; +} + +GObject * +bonobo_mdi_child_get_parent (const BonoboMDIChild *mdi_child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + return G_OBJECT (mdi_child->priv->parent); + +} + +void +bonobo_mdi_child_set_parent (BonoboMDIChild *mdi_child, GObject *parent) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + g_return_if_fail (mdi_child->priv != NULL); + + mdi_child->priv->parent = parent; +} diff --git a/glabels2/src/bonobo-mdi-child.h b/glabels2/src/bonobo-mdi-child.h new file mode 100644 index 00000000..49d9b66e --- /dev/null +++ b/glabels2/src/bonobo-mdi-child.h @@ -0,0 +1,101 @@ +/* + * bonobo-mdi-child.h - definition of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * 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 of the License, 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., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +#ifndef _BONOBO_MDI_CHILD_H_ +#define _BONOBO_MDI_CHILD_H_ + +#include +#include + +#define BONOBO_TYPE_MDI_CHILD (bonobo_mdi_child_get_type ()) +#define BONOBO_MDI_CHILD(obj) (GTK_CHECK_CAST ((obj), BONOBO_TYPE_MDI_CHILD, BonoboMDIChild)) +#define BONOBO_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_MDI_CHILD, BonoboMDIChildClass)) +#define BONOBO_IS_MDI_CHILD(obj) (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_MDI_CHILD)) +#define BONOBO_IS_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_MDI_CHILD)) +#define BONOBO_MDI_CHILD_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), BONOBO_TYPE_MDI_CHILD, BonoboMDIChildClass)) + +/* BonoboMDIChild + * is an abstract class. In order to use it, you have to either derive a + * new class from it and set the proper virtual functions in its parent + * BonoboMDIChildClass structure or use the BonoboMDIGenericChild class + * that allows to specify the relevant functions on a per-instance basis + * and can directly be used with BonoboMDI. + */ + +typedef struct _BonoboMDIChildPrivate BonoboMDIChildPrivate; + +typedef struct +{ + GObject object; + + BonoboMDIChildPrivate *priv; +} BonoboMDIChild; + + +typedef GtkWidget *(*BonoboMDIChildViewCreator) (BonoboMDIChild *, gpointer); +typedef GList *(*BonoboMDIChildMenuCreator) (BonoboMDIChild *, GtkWidget *, gpointer); +typedef gchar *(*BonoboMDIChildConfigFunc) (BonoboMDIChild *, gpointer); +typedef GtkWidget *(*BonoboMDIChildLabelFunc) (BonoboMDIChild *, GtkWidget *, gpointer); + +/* + * Note that if you override the set_label virtual function, it should return + * a new widget if its GtkWidget* parameter is NULL and modify and return the + * old widget otherwise. + * (see bonobo-mdi-child.c/bonobo_mdi_child_set_book_label() for an example). + */ + +typedef struct +{ + GObjectClass parent_class; + + /* Virtual functions */ + BonoboMDIChildViewCreator create_view; + BonoboMDIChildConfigFunc get_config_string; + BonoboMDIChildLabelFunc set_label; + + void (* name_changed) (BonoboMDIChild *mdi_child, gchar* old_name); + +} BonoboMDIChildClass; + +GType bonobo_mdi_child_get_type (void) G_GNUC_CONST; + +GtkWidget *bonobo_mdi_child_add_view (BonoboMDIChild *mdi_child); +void bonobo_mdi_child_remove_view (BonoboMDIChild *mdi_child, + GtkWidget *view); + +GList *bonobo_mdi_child_get_views (const BonoboMDIChild *mdi_child); + +void bonobo_mdi_child_set_name (BonoboMDIChild *mdi_child, + const gchar *name); +gchar *bonobo_mdi_child_get_name (const BonoboMDIChild *mdi_child); + +void bonobo_mdi_child_set_parent (BonoboMDIChild *mdi_child, + GObject *parent); +GObject *bonobo_mdi_child_get_parent (const BonoboMDIChild *mdi_child); + +G_END_DECLS + +#endif /* _BONOBO_MDI_CHILD_H_ */ + + + diff --git a/glabels2/src/bonobo-mdi.c b/glabels2/src/bonobo-mdi.c new file mode 100644 index 00000000..fb309695 --- /dev/null +++ b/glabels2/src/bonobo-mdi.c @@ -0,0 +1,2197 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * bonobo-mdi.c - implementation of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * 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 of the License, 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., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +/* + * Modified by the gedit Team, 2001-2002. See the AUTHORS file for a + * list of people on the gedit Team. + * See the ChangeLog files for a list of changes. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "bonobo-mdi.h" + +#include +#include +#include +#include + +#include "debug.h" + +#include +#include +#include + +#define BONOBO_MDI_KEY "BonoboMDI" +#define BONOBO_MDI_CHILD_KEY "BonoboMDIChild" +#define UI_COMPONENT_KEY "UIComponent" +#define BOOK_KEY "Book" +#define WINDOW_INFO_KEY "BonoboMDIWindowInfo" + +static void bonobo_mdi_class_init (BonoboMDIClass *); +static void bonobo_mdi_instance_init (BonoboMDI *); +static void bonobo_mdi_finalize (GObject *); +static void child_list_menu_create (BonoboMDI *, BonoboWindow *); + +static void child_list_activated_cb (BonoboUIComponent *uic, gpointer user_data, + const gchar* verbname); + +void child_list_menu_remove_item(BonoboMDI *, BonoboMDIChild *); +void child_list_menu_add_item (BonoboMDI *, BonoboMDIChild *); + +static void app_create (BonoboMDI *, gchar *, const char *); +static void app_clone (BonoboMDI *, BonoboWindow *, const char *); +static void app_destroy (BonoboWindow *, BonoboMDI *); +static void app_set_view (BonoboMDI *, BonoboWindow *, GtkWidget *); + +static gboolean app_close_book (BonoboWindow *, GdkEventAny *, BonoboMDI *); + +static GtkWidget *book_create (BonoboMDI *); +static void book_switch_page (GtkNotebook *, GtkNotebookPage *, + gint, BonoboMDI *); +static gboolean book_motion (GtkWidget *widget, GdkEventMotion *e, + gpointer data); +static gboolean book_button_press (GtkWidget *widget, GdkEventButton *e, + gpointer data); +static gboolean book_button_release (GtkWidget *widget, GdkEventButton *e, + gpointer data); +static void book_add_view (GtkNotebook *, GtkWidget *); +static void set_page_by_widget (GtkNotebook *, GtkWidget *); + +static gboolean toplevel_focus (BonoboWindow *, GdkEventFocus *, BonoboMDI *); + +static void set_active_view (BonoboMDI *, GtkWidget *); + +/* convenience functions that call child's "virtual" functions */ +static GtkWidget *child_set_label (BonoboMDIChild *, GtkWidget *); + +static void child_name_changed (BonoboMDIChild *mdi_child, + gchar* old_name, + BonoboMDI *mdi); +static void bonobo_mdi_update_child (BonoboMDI *mdi, BonoboMDIChild *child); + +static gchar* escape_underscores (const gchar* text); + +static GtkWidget* get_book_from_window (BonoboWindow *window); + +static GdkCursor *drag_cursor = NULL; + +enum { + ADD_CHILD, + REMOVE_CHILD, + ADD_VIEW, + REMOVE_VIEW, + CHILD_CHANGED, + VIEW_CHANGED, + TOP_WINDOW_CREATED, + TOP_WINDOW_DESTROY, + ALL_WINDOWS_DESTROYED, + LAST_SIGNAL +}; + + +struct _BonoboMDIPrivate +{ + GtkPositionType tab_pos; + + guint signal_id; + gint in_drag : 1; + + gchar *mdi_name; + gchar *title; + + gchar *ui_xml; + gchar *ui_file_name; + BonoboUIVerb *verbs; + + /* Probably only one of these would do, but... redundancy rules ;) */ + BonoboMDIChild *active_child; + GtkWidget *active_view; + BonoboWindow *active_window; + + GList *windows; /* toplevel windows - BonoboWindow widgets */ + GList *children; /* children - BonoboMDIChild objects*/ + + GSList *registered; /* see comment for bonobo_mdi_(un)register() functions + * below for an explanation. */ + + /* Paths for insertion of mdi-child list menu via */ + gchar *child_list_path; + + gint default_window_height; + gint default_window_width; +}; + +typedef gboolean (*BonoboMDISignal1) (GObject *, gpointer, gpointer); +typedef void (*BonoboMDISignal2) (GObject *, gpointer, gpointer); + +static GObjectClass *parent_class = NULL; +static guint mdi_signals [LAST_SIGNAL] = { 0 }; + +GType +bonobo_mdi_get_type (void) +{ + static GType bonobo_mdi_type = 0; + + if (bonobo_mdi_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (BonoboMDIClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) bonobo_mdi_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (BonoboMDI), + 0, /* n_preallocs */ + (GInstanceInitFunc) bonobo_mdi_instance_init + }; + + bonobo_mdi_type = g_type_register_static (G_TYPE_OBJECT, + "BonoboMDI", + &our_info, + 0); + } + + return bonobo_mdi_type; +} + +static void +bonobo_mdi_class_init (BonoboMDIClass *class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass*) class; + + object_class->finalize = bonobo_mdi_finalize; + + mdi_signals[ADD_CHILD] = + g_signal_new ("add_child", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, add_child), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + BONOBO_TYPE_MDI_CHILD); + + mdi_signals[REMOVE_CHILD] = + g_signal_new ("remove_child", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, remove_child), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + BONOBO_TYPE_MDI_CHILD); + + mdi_signals[ADD_VIEW] = + g_signal_new ("add_view", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, add_view), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + GTK_TYPE_WIDGET); + + mdi_signals[REMOVE_VIEW] = + g_signal_new ("remove_view", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, remove_view), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + GTK_TYPE_WIDGET); + + mdi_signals[CHILD_CHANGED] = + g_signal_new ("child_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, child_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + BONOBO_TYPE_MDI_CHILD); + + mdi_signals[VIEW_CHANGED] = + g_signal_new ("view_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BonoboMDIClass, view_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + GTK_TYPE_WIDGET); + + mdi_signals[TOP_WINDOW_CREATED] = + g_signal_new ("top_window_created", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, top_window_created), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + BONOBO_TYPE_WINDOW); + + mdi_signals[TOP_WINDOW_DESTROY] = + g_signal_new ("top_window_destroy", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, top_window_destroy), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + BONOBO_TYPE_WINDOW); + + mdi_signals[ALL_WINDOWS_DESTROYED] = + g_signal_new ("all_windows_destroyed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, all_windows_destroyed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + + class->add_child = NULL; + class->remove_child = NULL; + class->add_view = NULL; + class->remove_view = NULL; + class->child_changed = NULL; + class->view_changed = NULL; + class->top_window_created = NULL; + + parent_class = gtk_type_class (G_TYPE_OBJECT); +} + +static void +bonobo_mdi_finalize (GObject *object) +{ + BonoboMDI *mdi; + + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (BONOBO_IS_MDI (object)); + + mdi = BONOBO_MDI (object); + g_return_if_fail (mdi->priv != NULL); + + bonobo_mdi_remove_all (mdi, TRUE); + + if (mdi->priv->child_list_path != NULL) + g_free (mdi->priv->child_list_path); + + if (mdi->priv->mdi_name != NULL) + g_free (mdi->priv->mdi_name); + + if (mdi->priv->title != NULL) + g_free (mdi->priv->title); + + if (mdi->priv->ui_xml != NULL) + g_free (mdi->priv->ui_xml); + + if (mdi->priv->ui_file_name != NULL) + g_free (mdi->priv->ui_file_name); + + g_free (mdi->priv); + mdi->priv = NULL; + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize)(object); + + gl_debug (DEBUG_MDI, "END"); +} + + +static void +bonobo_mdi_instance_init (BonoboMDI *mdi) +{ + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (BONOBO_IS_MDI (mdi)); + + mdi->priv = g_new0 (BonoboMDIPrivate, 1); + g_return_if_fail (mdi->priv != NULL); + + mdi->priv->tab_pos = GTK_POS_TOP; + + mdi->priv->signal_id = 0; + mdi->priv->in_drag = FALSE; + + mdi->priv->children = NULL; + mdi->priv->windows = NULL; + mdi->priv->registered = NULL; + + mdi->priv->active_child = NULL; + mdi->priv->active_window = NULL; + mdi->priv->active_view = NULL; + + mdi->priv->ui_xml = NULL; + mdi->priv->ui_file_name = NULL; + mdi->priv->verbs = NULL; + + mdi->priv->child_list_path = NULL; + + gl_debug (DEBUG_MDI, "END"); +} + + +/** + * bonobo_mdi_new: + * @mdi_name: Application name as used in filenames and paths. + * @title: Title of the application windows. + * + * Description: + * Creates a new MDI object. @mdi_name and @title are used for + * MDI's calling bonobo_window_new (). + * + * Return value: + * A pointer to a new BonoboMDI object. + **/ +GObject* +bonobo_mdi_new (const gchar *mdi_name, const gchar *title, + gint default_window_width, gint default_window_height) +{ + BonoboMDI *mdi; + + gl_debug (DEBUG_MDI, ""); + + mdi = g_object_new (BONOBO_TYPE_MDI, NULL); + + mdi->priv->mdi_name = g_strdup (mdi_name); + mdi->priv->title = g_strdup (title); + + mdi->priv->default_window_width = default_window_width; + mdi->priv->default_window_height = default_window_height; + + gl_debug (DEBUG_MDI, "END"); + + return G_OBJECT (mdi); +} + +static GtkWidget * +child_set_label (BonoboMDIChild *child, GtkWidget *label) +{ + GtkWidget *w; + w = BONOBO_MDI_CHILD_GET_CLASS (child)->set_label (child, label, NULL); + + return w; +} + +static void +set_page_by_widget (GtkNotebook *book, GtkWidget *view) +{ + gint i; + + i = gtk_notebook_page_num (book, view); + + if (gtk_notebook_get_current_page (book) != i) + gtk_notebook_set_current_page (book, i); +} + +static void +child_list_activated_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname) +{ + BonoboMDI* mdi; + BonoboMDIChild *child = BONOBO_MDI_CHILD (user_data); + g_return_if_fail (child != NULL); + + gl_debug (DEBUG_MDI, ""); + + mdi = BONOBO_MDI (g_object_get_data (G_OBJECT (child), BONOBO_MDI_KEY)); + g_return_if_fail (mdi != NULL); + + if (child && (child != mdi->priv->active_child)) + { + GList *views = bonobo_mdi_child_get_views (child); + + if (views) + bonobo_mdi_set_active_view (mdi, views->data); + else + bonobo_mdi_add_view (mdi, child); + } + + gl_debug (DEBUG_MDI, "END"); +} + +static gchar* +escape_underscores (const gchar* text) +{ + GString *str; + gint length; + const gchar *p; + const gchar *end; + + g_return_val_if_fail (text != NULL, NULL); + + length = strlen (text); + + str = g_string_new (""); + + p = text; + end = text + length; + + while (p != end) + { + const gchar *next; + next = g_utf8_next_char (p); + + switch (*p) + { + case '_': + g_string_append (str, "__"); + break; + default: + g_string_append_len (str, p, next - p); + break; + } + + p = next; + } + + return g_string_free (str, FALSE); +} + +static void +child_list_menu_create (BonoboMDI *mdi, BonoboWindow *win) +{ + GList *child; + BonoboUIComponent *ui_component; + + if (mdi->priv->child_list_path == NULL) + return; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win), UI_COMPONENT_KEY)); + + child = mdi->priv->children; + + bonobo_ui_component_freeze (ui_component, NULL); + + while (child) + { + gchar *xml = NULL; + gchar *cmd = NULL; + gchar *verb_name = NULL; + gchar *tip; + gchar *escaped_name; + gchar *safe_name; + gchar *child_name = bonobo_mdi_child_get_name (BONOBO_MDI_CHILD (child->data)); + + safe_name = g_markup_escape_text (child_name, strlen (child_name)); + g_return_if_fail (safe_name != NULL); + + escaped_name = escape_underscores (safe_name); + g_return_if_fail (escaped_name != NULL); + + tip = g_strdup_printf (_("Activate %s"), safe_name); + verb_name = g_strdup_printf ("Child_%p", child->data); + xml = g_strdup_printf ("", verb_name, verb_name, escaped_name); + cmd = g_strdup_printf ("", verb_name, escaped_name, tip); + + g_free (tip); + g_free (child_name); + g_free (safe_name); + g_free (escaped_name); + + bonobo_ui_component_set_translate (ui_component, mdi->priv->child_list_path, xml, NULL); + bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL); + bonobo_ui_component_add_verb (ui_component, verb_name, child_list_activated_cb, child->data); + + g_free (xml); + g_free (cmd); + g_free (verb_name); + + child = g_list_next (child); + } + + bonobo_ui_component_thaw (ui_component, NULL); +} + + +void +child_list_menu_remove_item (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GList *win_node; + gchar *path, *cmd, *verb_name; + + gl_debug (DEBUG_MDI, ""); + + if(mdi->priv->child_list_path == NULL) + return; + + win_node = mdi->priv->windows; + + verb_name = g_strdup_printf ("Child_%p", child); + path = g_strdup_printf ("%s%s", mdi->priv->child_list_path, verb_name); + cmd = g_strdup_printf ("/commands/%s", verb_name); + + while (win_node) + { + BonoboUIComponent *ui_component; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win_node->data), UI_COMPONENT_KEY)); + + bonobo_ui_component_remove_verb (ui_component, verb_name); + bonobo_ui_component_rm (ui_component, path, NULL); + bonobo_ui_component_rm (ui_component, cmd, NULL); + win_node = g_list_next (win_node); + } + + g_free (path); + g_free (cmd); + g_free (verb_name); + + gl_debug (DEBUG_MDI, "END"); +} + + +void +child_list_menu_add_item (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GList *win_node; + gchar *child_name, *escaped_name, *safe_name; + gchar* xml, *cmd, *verb_name, *tip; + int accel_num; + + if(mdi->priv->child_list_path == NULL) + return; + + accel_num = g_list_length (mdi->priv->children); + + win_node = mdi->priv->windows; + + child_name = bonobo_mdi_child_get_name (child); + + safe_name = g_markup_escape_text (child_name, strlen (child_name)); + g_return_if_fail (safe_name != NULL); + + escaped_name = escape_underscores (safe_name); + g_return_if_fail (escaped_name != NULL); + + verb_name = g_strdup_printf ("Child_%p", child); + + tip = g_strdup_printf (_("Activate %s"), safe_name); + xml = g_strdup_printf ("", verb_name, verb_name, escaped_name); + + if (accel_num > 9) + cmd = g_strdup_printf ("", verb_name, escaped_name, tip); + else + cmd = g_strdup_printf ("", verb_name, + escaped_name, tip, accel_num); + + + while (win_node) + { + BonoboUIComponent *ui_component; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win_node->data), UI_COMPONENT_KEY)); + + + bonobo_ui_component_set_translate (ui_component, mdi->priv->child_list_path, xml, NULL); + bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL); + bonobo_ui_component_add_verb (ui_component, verb_name, child_list_activated_cb, child); + + win_node = g_list_next (win_node); + } + + g_free (tip); + g_free (escaped_name); + g_free (child_name); + g_free (xml); + g_free (cmd); + g_free (verb_name); + g_free (safe_name); +} + +static gboolean +book_motion (GtkWidget *widget, GdkEventMotion *e, gpointer data) +{ + BonoboMDI *mdi; + + mdi = BONOBO_MDI (data); + + if (!drag_cursor) + drag_cursor = gdk_cursor_new (GDK_HAND2); + + if (e->window == GTK_NOTEBOOK (widget)->event_window) + { + mdi->priv->in_drag = TRUE; + gtk_grab_add (widget); + gdk_pointer_grab (widget->window, FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK, NULL, + drag_cursor, GDK_CURRENT_TIME); + if (mdi->priv->signal_id) + { + g_signal_handler_disconnect (G_OBJECT (widget), + mdi->priv->signal_id); + mdi->priv->signal_id = 0; + } + } + + return FALSE; +} + +static gboolean +book_button_press (GtkWidget *widget, GdkEventButton *e, gpointer data) +{ + BonoboMDI *mdi; + + mdi = BONOBO_MDI (data); + + if ((e->button == 1) && (e->window == GTK_NOTEBOOK (widget)->event_window)) + mdi->priv->signal_id = g_signal_connect ( + G_OBJECT (widget), + "motion_notify_event", + G_CALLBACK (book_motion), + mdi); + + return FALSE; +} + +static gboolean +book_button_release (GtkWidget *widget, GdkEventButton *e, gpointer data) +{ + gint x = e->x_root, y = e->y_root; + BonoboMDI *mdi; + + mdi = BONOBO_MDI(data); + + if (mdi->priv->signal_id) + { + g_signal_handler_disconnect (G_OBJECT (widget), mdi->priv->signal_id); + mdi->priv->signal_id = 0; + } + + if ((e->button == 1) && mdi->priv->in_drag) + { + GdkWindow *window; + GList *child; + BonoboWindow *win; + GtkWidget *view, *new_book; + GtkNotebook *old_book = GTK_NOTEBOOK (widget); + + mdi->priv->in_drag = FALSE; + gdk_pointer_ungrab (GDK_CURRENT_TIME); + gtk_grab_remove (widget); + + window = gdk_window_at_pointer (&x, &y); + if (window) + window = gdk_window_get_toplevel (window); + + child = mdi->priv->windows; + + while (child) + { + if (window == GTK_WIDGET (child->data)->window) + { + int cur_page; + + /* page was dragged to another notebook */ + + old_book = GTK_NOTEBOOK(widget); + new_book = get_book_from_window (BONOBO_WINDOW (child->data)); + + if (old_book == (GtkNotebook *) new_book) + /* page has been dropped on the source notebook */ + return FALSE; + + cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (old_book)); + + if (cur_page >= 0) + { + view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (old_book), cur_page); + gtk_container_remove (GTK_CONTAINER(old_book), view); + + book_add_view (GTK_NOTEBOOK (new_book), view); + + win = bonobo_mdi_get_window_from_view (view); + gdk_window_raise (GTK_WIDGET(win)->window); + + mdi->priv->active_window = win; + + cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (old_book)); + + if (cur_page < 0) + { + mdi->priv->active_window = win; + win = BONOBO_WINDOW (gtk_widget_get_toplevel ( + GTK_WIDGET (old_book))); + mdi->priv->windows = g_list_remove(mdi->priv->windows, win); + gtk_widget_destroy (GTK_WIDGET (win)); + } + + g_signal_emit (G_OBJECT (mdi), + mdi_signals [CHILD_CHANGED], + 0, + NULL); + + g_signal_emit (G_OBJECT (mdi), + mdi_signals [VIEW_CHANGED], + 0, + view); + } + + return FALSE; + } + + child = child->next; + } + + if (g_list_length (old_book->children) == 1) + return FALSE; + + /* create a new toplevel */ + if (old_book->cur_page) + { + gint width, height; + int cur_page = gtk_notebook_get_current_page (old_book); + + view = gtk_notebook_get_nth_page (old_book, cur_page); + + win = bonobo_mdi_get_window_from_view (view); + + gtk_window_get_size (GTK_WINDOW (win), &width, &height); + + gtk_container_remove (GTK_CONTAINER (old_book), view); + + app_clone (mdi, win, NULL); + + new_book = book_create (mdi); + + book_add_view (GTK_NOTEBOOK (new_book), view); + + gtk_window_set_position (GTK_WINDOW (mdi->priv->active_window), GTK_WIN_POS_MOUSE); + + gtk_window_set_default_size (GTK_WINDOW (mdi->priv->active_window), width, height); + + if (!GTK_WIDGET_VISIBLE (mdi->priv->active_window)) + gtk_widget_show (GTK_WIDGET (mdi->priv->active_window)); + } + } + + return FALSE; +} + +static GtkWidget * +book_create (BonoboMDI *mdi) +{ + GtkWidget *us; + GtkWidget *vbox; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi->priv->active_window != NULL, NULL); + + vbox = gtk_vbox_new (FALSE, 0); + us = gtk_notebook_new (); + + gtk_notebook_set_tab_pos (GTK_NOTEBOOK (us), mdi->priv->tab_pos); + + gtk_box_pack_start (GTK_BOX (vbox), us, TRUE, TRUE, 0); + + gtk_widget_show_all (vbox); + + bonobo_window_set_contents (mdi->priv->active_window, vbox); + g_object_set_data (G_OBJECT (mdi->priv->active_window), BOOK_KEY, us); + + gtk_widget_add_events (us, GDK_BUTTON1_MOTION_MASK); + + g_signal_connect (G_OBJECT (us), "switch_page", + G_CALLBACK (book_switch_page), mdi); + + g_signal_connect (G_OBJECT (us), "button_press_event", + G_CALLBACK (book_button_press), mdi); + g_signal_connect (G_OBJECT (us), "button_release_event", + G_CALLBACK (book_button_release), mdi); + + gtk_notebook_set_scrollable (GTK_NOTEBOOK (us), TRUE); + + gl_debug (DEBUG_MDI, "END"); + + return us; +} + +static void +book_add_view (GtkNotebook *book, GtkWidget *view) +{ + BonoboMDIChild *child; + GtkWidget *title; + + gl_debug (DEBUG_MDI, ""); + + child = bonobo_mdi_get_child_from_view (view); + + title = child_set_label (child, NULL); + + gtk_notebook_append_page (book, view, title); + + if (g_list_length (book->children) > 1) + set_page_by_widget (book, view); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +book_switch_page (GtkNotebook *book, GtkNotebookPage *pg, gint page_num, BonoboMDI *mdi) +{ + BonoboWindow *win; + GtkWidget *page; + + gl_debug (DEBUG_MDI, ""); + + win = BONOBO_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (book))); + + page = gtk_notebook_get_nth_page (book, page_num); + + if (page != NULL) + { + if (page != mdi->priv->active_view) + app_set_view (mdi, win, page); + } + else + app_set_view (mdi, win, NULL); + + gl_debug (DEBUG_MDI, "END"); + +} + +static GtkWidget* +get_book_from_window (BonoboWindow *window) +{ + gpointer *book; + + g_return_val_if_fail (window != NULL, NULL); + + book = g_object_get_data (G_OBJECT (window), BOOK_KEY); + + return (book != NULL) ? GTK_WIDGET (book) : NULL; +} + +static gboolean +toplevel_focus (BonoboWindow *win, GdkEventFocus *event, BonoboMDI *mdi) +{ + GtkWidget *contents; + + gl_debug (DEBUG_MDI, ""); + + /* updates active_view and active_child when a new toplevel receives focus */ + g_return_val_if_fail (BONOBO_IS_WINDOW (win), FALSE); + + mdi->priv->active_window = win; + + contents = get_book_from_window (win); + + if (GTK_NOTEBOOK (contents)->cur_page) + { + int cur_page; + GtkWidget *child; + + cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (contents)); + child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (contents), cur_page); + set_active_view (mdi, child); + } + else + set_active_view (mdi, NULL); + + gl_debug (DEBUG_MDI, "END"); + + return FALSE; +} + +static gboolean +app_configure_event_handler (GtkWidget *widget, GdkEventConfigure *event) +{ + BonoboMDIWindowInfo *window_info; + + g_return_val_if_fail (BONOBO_IS_WINDOW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + window_info = (BonoboMDIWindowInfo*) + g_object_get_data (G_OBJECT (widget), WINDOW_INFO_KEY); + g_return_val_if_fail (window_info != NULL, FALSE); + + window_info->width = event->width; + window_info->height = event->height; + + return FALSE; +} + +static gboolean +app_window_state_event_handler (GtkWidget *widget, GdkEventWindowState *event) +{ + BonoboMDIWindowInfo *window_info; + + g_return_val_if_fail (BONOBO_IS_WINDOW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + window_info = (BonoboMDIWindowInfo*) + g_object_get_data (G_OBJECT (widget), WINDOW_INFO_KEY); + g_return_val_if_fail (window_info != NULL, FALSE); + + window_info->state = event->new_window_state; + + return FALSE; +} + + +static void +app_clone (BonoboMDI *mdi, BonoboWindow *win, const char *window_role) +{ + gl_debug (DEBUG_MDI, ""); + + app_create (mdi, NULL, window_role); + + if (win != NULL) + { + const BonoboMDIWindowInfo *window_info = bonobo_mdi_get_window_info (win); + g_return_if_fail (window_info != NULL); + + if ((window_info->state & GDK_WINDOW_STATE_MAXIMIZED) != 0) + gtk_window_maximize (GTK_WINDOW (mdi->priv->active_window)); + else + { + gtk_window_set_default_size (GTK_WINDOW (mdi->priv->active_window), + window_info->width, + window_info->height); + + gtk_window_unmaximize (GTK_WINDOW (mdi->priv->active_window)); + } + + if ((window_info->state & GDK_WINDOW_STATE_STICKY ) != 0) + gtk_window_stick (GTK_WINDOW (mdi->priv->active_window)); + else + gtk_window_unstick (GTK_WINDOW (mdi->priv->active_window)); + } + + gl_debug (DEBUG_MDI, "END"); +} + + +static gboolean +app_close_book (BonoboWindow *win, GdkEventAny *event, BonoboMDI *mdi) +{ + BonoboMDIChild *child; + GtkWidget *view; + gint handler_ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + if (g_list_length (mdi->priv->windows) == 1) + { + if (!bonobo_mdi_remove_all (mdi, FALSE)) + { + gl_debug (DEBUG_MDI, "END1"); + + return TRUE; + } + + mdi->priv->windows = g_list_remove (mdi->priv->windows, win); + gtk_widget_destroy (GTK_WIDGET (win)); + + /* only emit al_windows_destroyed signal if there are no non-MDI windows registered + with it. */ + if (mdi->priv->registered == NULL) + g_signal_emit (G_OBJECT (mdi), mdi_signals [ALL_WINDOWS_DESTROYED], 0); + } + else + { + GList *children = gtk_container_get_children ( + GTK_CONTAINER (get_book_from_window (win))); + GList *li; + + if (children == NULL) + { + mdi->priv->windows = g_list_remove (mdi->priv->windows, win); + gtk_widget_destroy (GTK_WIDGET (win)); + + gl_debug (DEBUG_MDI, "END2"); + + return FALSE; + } + + /* first check if all the children in this notebook can be removed */ + for (li = children; li != NULL; li = li->next) + { + GList *node; + view = li->data; + + child = bonobo_mdi_get_child_from_view (view); + + node = bonobo_mdi_child_get_views (child); + + while (node) + { + if (bonobo_mdi_get_window_from_view (node->data) != win) + break; + + node = node->next; + } + + if (node == NULL) + { + /* all the views reside in this BonoboWindow */ + g_signal_emit (G_OBJECT(mdi), + mdi_signals [REMOVE_CHILD], + 0, + child, + &handler_ret); + + if (handler_ret == FALSE) + { + g_list_free (children); + + gl_debug (DEBUG_MDI, "END3"); + + return TRUE; + } + } + } + + /* now actually remove all children/views! */ + for (li = children; li != NULL; li = li->next) + { + view = li->data; + + child = bonobo_mdi_get_child_from_view (view); + + /* if this is the last view, remove the child */ + if (g_list_length (bonobo_mdi_child_get_views (child)) == 1) + bonobo_mdi_remove_child (mdi, child, TRUE); + else + bonobo_mdi_remove_view (mdi, view, TRUE); + } + + g_list_free (children); + } + + gl_debug (DEBUG_MDI, "END"); + + return FALSE; +} + +static void +app_set_view (BonoboMDI *mdi, BonoboWindow *win, GtkWidget *view) +{ + gl_debug (DEBUG_MDI, ""); + + gtk_window_set_title (GTK_WINDOW (win), mdi->priv->title); + + set_active_view (mdi, view); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +app_destroy (BonoboWindow *win, BonoboMDI *mdi) +{ + gl_debug (DEBUG_MDI, ""); + + if (mdi->priv->active_window == win) + mdi->priv->active_window = + (mdi->priv->windows != NULL) ? BONOBO_WINDOW (mdi->priv->windows->data) : NULL; + + g_signal_emit (G_OBJECT (mdi), mdi_signals [TOP_WINDOW_DESTROY], 0, win); + + gl_debug (DEBUG_MDI, "END"); +} + +/* Generates a unique string for a window role. + * + * Taken from EOG. + */ +static char * +gen_role (void) +{ + char *ret; + static char *hostname; + time_t t; + static int serial; + + t = time (NULL); + + if (!hostname) { + static char buffer [512]; + + if ((gethostname (buffer, sizeof (buffer) - 1) == 0) && + (buffer [0] != 0)) + hostname = buffer; + else + hostname = "localhost"; + } + + ret = g_strdup_printf ("bonobo-mdi-window-%d-%d-%d-%ld-%d@%s", + getpid (), + getgid (), + getppid (), + (long) t, + serial++, + hostname); + + return ret; +} + +static void +app_create (BonoboMDI *mdi, gchar *layout_string, const char *window_role) +{ + GtkWidget *window; + BonoboWindow *bw; + gchar* config_path; + BonoboUIContainer *ui_container = NULL; + BonoboUIComponent *ui_component = NULL; + BonoboMDIWindowInfo *window_info = NULL; + + gl_debug (DEBUG_MDI, ""); + + window = bonobo_window_new (mdi->priv->mdi_name, mdi->priv->title); + g_return_if_fail (window != NULL); + + gtk_window_set_default_size (GTK_WINDOW (window), + mdi->priv->default_window_width, + mdi->priv->default_window_height); + + if (window_role) + gtk_window_set_role (GTK_WINDOW (window), window_role); + else { + char *role; + + role = gen_role (); + gtk_window_set_role (GTK_WINDOW (window), role); + g_free (role); + } + + bw = BONOBO_WINDOW (window); + + mdi->priv->windows = g_list_append (mdi->priv->windows, window); + + g_signal_connect (G_OBJECT (window), "delete_event", + G_CALLBACK (app_close_book), mdi); + g_signal_connect (G_OBJECT (window), "focus_in_event", + G_CALLBACK (toplevel_focus), mdi); + g_signal_connect (G_OBJECT (window), "destroy", + G_CALLBACK (app_destroy), mdi); + g_signal_connect (G_OBJECT (window), "configure_event", + G_CALLBACK (app_configure_event_handler), NULL); + g_signal_connect (G_OBJECT (window), "window_state_event", + G_CALLBACK (app_window_state_event_handler), NULL); + + /* Create Container: */ + ui_container = bonobo_window_get_ui_container (bw); + + config_path = g_strdup_printf ("/%s/UIConfig/kvps", mdi->priv->mdi_name); + + bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (bw), + config_path); + g_free (config_path); + + /* Create a UI component with which to communicate with the window */ + ui_component = bonobo_ui_component_new_default (); + + /* Associate the BonoboUIComponent with the container */ + bonobo_ui_component_set_container ( + ui_component, BONOBO_OBJREF (ui_container), NULL); + + /* set up UI */ + if (mdi->priv->ui_xml != NULL) + { + bonobo_ui_component_set_translate (ui_component, + "/", mdi->priv->ui_xml, NULL); + } + else + if (mdi->priv->ui_file_name) + { + bonobo_ui_util_set_ui (ui_component, "", mdi->priv->ui_file_name, + mdi->priv->mdi_name, NULL); + } + + if (mdi->priv->verbs) + bonobo_ui_component_add_verb_list_with_data (ui_component, + mdi->priv->verbs, mdi); + + mdi->priv->active_window = bw; + mdi->priv->active_child = NULL; + mdi->priv->active_view = NULL; + + window_info = g_new0 (BonoboMDIWindowInfo, 1); + + g_object_set_data (G_OBJECT (bw), UI_COMPONENT_KEY, ui_component); + g_object_set_data_full (G_OBJECT (bw), WINDOW_INFO_KEY, window_info, g_free); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [TOP_WINDOW_CREATED], 0, window); + + child_list_menu_create (mdi, bw); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +set_active_view (BonoboMDI *mdi, GtkWidget *view) +{ + BonoboMDIChild *old_child; + GtkWidget *old_view; + + gl_debug (DEBUG_MDI, ""); + + old_child = mdi->priv->active_child; + old_view = mdi->priv->active_view; + + mdi->priv->active_view = view; + + if (!view) + mdi->priv->active_child = NULL; + else + { + + mdi->priv->active_child = bonobo_mdi_get_child_from_view (view); + mdi->priv->active_window = bonobo_mdi_get_window_from_view (view); + + gtk_widget_grab_focus (GTK_WIDGET (view)); + } + + if (view == old_view) + { + gl_debug (DEBUG_MDI, "END1"); + + return; + } + + if (mdi->priv->active_child != old_child) + { + gl_debug (DEBUG_MDI, "Emit child_changed"); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [CHILD_CHANGED], 0, old_child); + } + + gl_debug (DEBUG_MDI, "Emit view_changed"); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [VIEW_CHANGED], 0, old_view); + + gl_debug (DEBUG_MDI, "END2"); +} + +/** + * bonobo_mdi_set_active_view: + * @mdi: A pointer to an MDI object. + * @view: A pointer to the view that is to become the active one. + * + * Description: + * Sets the active view to @view. It also raises the window containing it + * and gives it focus. + **/ +void +bonobo_mdi_set_active_view (BonoboMDI *mdi, GtkWidget *view) +{ + GtkWindow *window; + + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (view != NULL); + g_return_if_fail (GTK_IS_WIDGET (view)); + + set_page_by_widget (GTK_NOTEBOOK (view->parent), view); + + window = GTK_WINDOW (bonobo_mdi_get_window_from_view (view)); + + gtk_window_present (window); + + set_active_view (mdi, view); + + gl_debug (DEBUG_MDI, "END"); +} + +/** + * bonobo_mdi_add_view: + * @mdi: A pointer to a BonoboMDI object. + * @child: A pointer to a child. + * + * Description: + * Creates a new view of the child and adds it to the MDI. BonoboMDIChild + * @child has to be added to the MDI with a call to bonobo_mdi_add_child + * before its views are added to the MDI. + * An "add_view" signal is emitted to the MDI after the view has been + * created, but before it is shown and added to the MDI, with a pointer to + * the created view as its parameter. The view is added to the MDI only if + * the signal handler (if it exists) returns %TRUE. If the handler returns + * %FALSE, the created view is destroyed and not added to the MDI. + * + * Return value: + * %TRUE if adding the view succeeded and %FALSE otherwise. + **/ +gboolean +bonobo_mdi_add_view (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GtkWidget *view; + GtkWidget *book; + gint ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + view = bonobo_mdi_child_add_view (child); + + g_return_val_if_fail (view != NULL, FALSE); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [ADD_VIEW], 0, view, &ret); + + if (!ret) + { + bonobo_mdi_child_remove_view (child, view); + + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + if (mdi->priv->active_window == NULL) + { + app_create (mdi, NULL, NULL); + gtk_widget_show (GTK_WIDGET (mdi->priv->active_window)); + } + + + if (!GTK_WIDGET_VISIBLE (view)) + gtk_widget_show (view); + + book = get_book_from_window (mdi->priv->active_window); + + if (book == NULL) + book = book_create (mdi); + + book_add_view (GTK_NOTEBOOK (book), view); + + /* this reference will compensate the view's unrefing + when removed from its parent later, as we want it to + stay valid until removed from the child with a call + to bonobo_mdi_child_remove_view() */ + g_object_ref (G_OBJECT (view)); + gtk_object_sink (GTK_OBJECT (view)); + + g_object_set_data (G_OBJECT (view), BONOBO_MDI_CHILD_KEY, child); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_add_toplevel_view: + * @mdi: A pointer to a BonoboMDI object. + * @child: A pointer to a BonoboMDIChild object to be added to the MDI. + * @window_role: X window role to use for the window, for session-management + * purposes. If this is %NULL, a unique role string will be automatically + * generated. + * + * Description: + * Creates a new view of the child and adds it to the MDI; it behaves the + * same way as bonobo_mdi_add_view in %BONOBO_MDI_MODAL and %BONOBO_MDI_TOPLEVEL + * modes, but in %BONOBO_MDI_NOTEBOOK mode, the view is added in a new + * toplevel window unless the active one has no views in it. + * + * Return value: + * %TRUE if adding the view succeeded and %FALSE otherwise. + **/ +gboolean +bonobo_mdi_add_toplevel_view (BonoboMDI *mdi, BonoboMDIChild *child, const char *window_role) +{ + GtkWidget *view; + gint ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + view = bonobo_mdi_child_add_view (child); + + g_return_val_if_fail (view != NULL, FALSE); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [ADD_VIEW], 0, view, &ret); + + if (ret == FALSE) + { + bonobo_mdi_child_remove_view (child, view); + + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + bonobo_mdi_open_toplevel (mdi, window_role); + + if (!GTK_WIDGET_VISIBLE (view)) + gtk_widget_show (view); + + book_add_view (GTK_NOTEBOOK (get_book_from_window (mdi->priv->active_window)), view); + + /* this reference will compensate the view's unrefing + when removed from its parent later, as we want it to + stay valid until removed from the child with a call + to bonobo_mdi_child_remove_view() */ + g_object_ref (G_OBJECT (view)); + gtk_object_sink (GTK_OBJECT (view)); + + g_object_set_data (G_OBJECT (view), BONOBO_MDI_CHILD_KEY, child); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_remove_view: + * @mdi: A pointer to a BonoboMDI object. + * @view: View to remove. + * @force: If TRUE, the "remove_view" signal is not emitted. + * + * Description: + * Removes a view from an MDI. + * A "remove_view" signal is emitted to the MDI before actually removing + * view. The view is removed only if the signal handler (if it exists and + * the @force is set to %FALSE) returns %TRUE. + * + * Return value: + * %TRUE if the view was removed and %FALSE otherwise. + **/ +gboolean +bonobo_mdi_remove_view (BonoboMDI *mdi, GtkWidget *view, gint force) +{ + GtkWidget *book; + BonoboWindow *window; + BonoboMDIChild *child; + gint ret = TRUE; + gint pn; + gboolean was_active_window = FALSE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (view != NULL, FALSE); + g_return_val_if_fail (GTK_IS_WIDGET (view), FALSE); + + if (!force) + g_signal_emit (G_OBJECT (mdi), mdi_signals [REMOVE_VIEW], 0, view, &ret); + + if (ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + was_active_window = (view == mdi->priv->active_view); + + child = bonobo_mdi_get_child_from_view (view); + window = bonobo_mdi_get_window_from_view (view); + + book = get_book_from_window (window); + g_return_val_if_fail (book != NULL, TRUE); + + if (g_list_length (GTK_NOTEBOOK (book)->children) == 1) + app_set_view (mdi, window, NULL); + + bonobo_mdi_child_remove_view (child, view); + + pn = gtk_notebook_page_num (GTK_NOTEBOOK (book), view); + gtk_notebook_remove_page (GTK_NOTEBOOK (book), pn); + + if (GTK_NOTEBOOK (book)->cur_page == NULL) + { + if ((g_list_length (mdi->priv->windows) > 1) || + (mdi->priv->registered != NULL)) + { + gl_debug (DEBUG_VIEW, "Destroy window"); + + /* if this is NOT the last toplevel or a registered object + exists, destroy the toplevel */ + mdi->priv->windows = g_list_remove (mdi->priv->windows, window); + gtk_widget_destroy (GTK_WIDGET (window)); + + if (mdi->priv->active_window && was_active_window) + mdi->priv->active_view = bonobo_mdi_get_view_from_window ( + mdi, + mdi->priv->active_window); + } + } + else + { + pn = gtk_notebook_get_current_page (GTK_NOTEBOOK (book)); + app_set_view (mdi, window, gtk_notebook_get_nth_page (GTK_NOTEBOOK (book), pn)); + } + + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +static void +child_name_changed (BonoboMDIChild *mdi_child, gchar* old_name, BonoboMDI *mdi) +{ + bonobo_mdi_update_child (mdi, mdi_child); +} + +/** + * bonobo_mdi_add_child: + * @mdi: A pointer to a BonoboMDI object. + * @child: A pointer to a BonoboMDIChild to add to the MDI. + * + * Description: + * Adds a new child to the MDI. No views are added: this has to be done with + * a call to bonobo_mdi_add_view. + * First an "add_child" signal is emitted to the MDI with a pointer to the + * child as its parameter. The child is added to the MDI only if the signal + * handler (if it exists) returns %TRUE. If the handler returns %FALSE, the + * child is not added to the MDI. + * + * Return value: + * %TRUE if the child was added successfully and %FALSE otherwise. + **/ +gint +bonobo_mdi_add_child (BonoboMDI *mdi, BonoboMDIChild *child) +{ + gint ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [ADD_CHILD], 0, child, &ret); + + if (ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + bonobo_mdi_child_set_parent (child, G_OBJECT (mdi)); + + mdi->priv->children = g_list_append (mdi->priv->children, child); + + g_signal_connect (G_OBJECT (child), "name_changed", + G_CALLBACK (child_name_changed), mdi); + + child_list_menu_add_item (mdi, child); + + g_object_set_data (G_OBJECT (child), BONOBO_MDI_KEY, mdi); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_remove_child: + * @mdi: A pointer to a BonoboMDI object. + * @child: Child to remove. + * @force: If TRUE, the "remove_child" signal is not emitted + * + * Description: + * Removes a child and all of its views from the MDI. + * A "remove_child" signal is emitted to the MDI with @child as its parameter + * before actually removing the child. The child is removed only if the signal + * handler (if it exists and the @force is set to %FALSE) returns %TRUE. + * + * Return value: + * %TRUE if the removal was successful and %FALSE otherwise. + **/ +gint +bonobo_mdi_remove_child (BonoboMDI *mdi, BonoboMDIChild *child, gint force) +{ + gint ret = TRUE; + GList *view_node; + GtkWidget *view; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + /* if force is set to TRUE, don't call the remove_child handler (ie there is no way for the + user to stop removal of the child) */ + + if (!force) + g_signal_emit (G_OBJECT (mdi), mdi_signals [REMOVE_CHILD], 0, child, &ret); + + if (ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + view_node = bonobo_mdi_child_get_views (child); + + while (view_node) + { + view = GTK_WIDGET (view_node->data); + view_node = view_node->next; + bonobo_mdi_remove_view (mdi, GTK_WIDGET (view), TRUE); + } + + mdi->priv->children = g_list_remove (mdi->priv->children, child); + + child_list_menu_remove_item (mdi, child); + + if (child == mdi->priv->active_child) + mdi->priv->active_child = NULL; + + bonobo_mdi_child_set_parent (child, NULL); + + g_signal_handlers_disconnect_by_func (G_OBJECT (child), G_CALLBACK (child_name_changed), mdi); + + g_object_unref (G_OBJECT (child)); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_remove_all: + * @mdi: A pointer to a BonoboMDI object. + * @force: If TRUE, the "remove_child" signal is not emitted + * + * Description: + * Removes all children and all views from the MDI. + * A "remove_child" signal is emitted to the MDI for each child before + * actually trying to remove any. If signal handlers for all children (if + * they exist and the @force is set to %FALSE) return %TRUE, all children + * and their views are removed and none otherwise. + * + * Return value: + * %TRUE if the removal was successful and %FALSE otherwise. + **/ +gint +bonobo_mdi_remove_all (BonoboMDI *mdi, gint force) +{ + GList *child_node; + gint handler_ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + + /* first check if removal of any child will be prevented by the + remove_child signal handler */ + if (!force) + { + child_node = mdi->priv->children; + while (child_node) + { + g_signal_emit (G_OBJECT (mdi), + mdi_signals [REMOVE_CHILD], + 0, + child_node->data, + &handler_ret); + + /* if any of the children may not be removed, none will be */ + if (handler_ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + child_node = child_node->next; + } + } + + /* remove all the children with force arg set to true so that remove_child + handlers are not called again */ + while (mdi->priv->children) + bonobo_mdi_remove_child (mdi, BONOBO_MDI_CHILD (mdi->priv->children->data), TRUE); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_open_toplevel: + * @mdi: A pointer to a BonoboMDI object. + * @window_role: X window role to use for the window, for session-management + * purposes. If this is %NULL, a unique role string will be automatically + * generated. + * + * Description: + * Opens a new toplevel window. This is usually used only for opening + * the initial window on startup (just before calling gtkmain()) if no + * windows were open because a session was restored or children were added + * because of command line args). + **/ +void +bonobo_mdi_open_toplevel (BonoboMDI *mdi, const char *window_role) +{ + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + + app_clone (mdi, mdi->priv->active_window, window_role); + + book_create (mdi); + + gtk_widget_show (GTK_WIDGET (mdi->priv->active_window)); + + gl_debug (DEBUG_MDI, "END1"); +} + +/** + * bonobo_mdi_update_child: + * @mdi: A pointer to a BonoboMDI object. + * @child: Child to update. + * + * Description: + * Updates all notebook labels of @child's views and their window titles + * after its name changes. It is not required if bonobo_mdi_child_set_name() + * is used for setting the child's name. + **/ +static void +bonobo_mdi_update_child (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GtkWidget *view, *title; + GList *view_node; + GList *win_node; + gchar* child_name, *path, *path_cmd, *tip, *escaped_name; + + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (child != NULL); + g_return_if_fail (BONOBO_IS_MDI_CHILD (child)); + + view_node = bonobo_mdi_child_get_views (child); + + while (view_node) + { + view = GTK_WIDGET (view_node->data); + + title = child_set_label (child, NULL); + + gtk_notebook_set_tab_label (GTK_NOTEBOOK (view->parent), view, title); + + view_node = g_list_next (view_node); + } + + /* Update child list menus */ + if(mdi->priv->child_list_path == NULL) + { + gl_debug (DEBUG_MDI, "END1"); + + return; + } + + win_node = mdi->priv->windows; + + child_name = bonobo_mdi_child_get_name (child); + escaped_name = escape_underscores (child_name); + path = g_strdup_printf ("%sChild_%p", mdi->priv->child_list_path, child); + path_cmd = g_strdup_printf ("/commands/Child_%p", child); + tip = g_strdup_printf (_("Activate %s"), child_name); + + while (win_node) + { + BonoboUIComponent *ui_component; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win_node->data), UI_COMPONENT_KEY)); + + bonobo_ui_component_set_prop (ui_component, path, "label", escaped_name, NULL); + bonobo_ui_component_set_prop (ui_component, path, "tip", tip, NULL); + + win_node = g_list_next (win_node); + } + + g_free (escaped_name); + g_free (path); + g_free (path_cmd); + g_free (tip); + g_free (child_name); + + gl_debug (DEBUG_MDI, "END2"); +} + +/** + * bonobo_mdi_find_child: + * @mdi: A pointer to a BonoboMDI object. + * @name: A string with a name of the child to find. + * + * Description: + * Finds a child named @name. + * + * Return value: + * A pointer to the BonoboMDIChild object if the child was found and NULL + * otherwise. + **/ +BonoboMDIChild * +bonobo_mdi_find_child (BonoboMDI *mdi, const gchar *name) +{ + GList *child_node; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + child_node = mdi->priv->children; + while (child_node) + { + gchar* child_name = bonobo_mdi_child_get_name (BONOBO_MDI_CHILD (child_node->data)); + + if (strcmp (child_name, name) == 0) + { + g_free (child_name); + + gl_debug (DEBUG_MDI, "END1"); + + return BONOBO_MDI_CHILD (child_node->data); + } + + g_free (child_name); + + child_node = g_list_next (child_node); + } + + gl_debug (DEBUG_MDI, "END2"); + + return NULL; +} + +/** + * bonobo_mdi_get_active_child: + * @mdi: A pointer to a BonoboMDI object. + * + * Description: + * Returns a pointer to the active BonoboMDIChild object. + * + * Return value: + * A pointer to the active BonoboMDIChild object. %NULL, if there is none. + **/ +BonoboMDIChild * +bonobo_mdi_get_active_child (BonoboMDI *mdi) +{ + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + if (mdi->priv->active_view) + return (bonobo_mdi_get_child_from_view (mdi->priv->active_view)); + + return NULL; +} + +/** + * bonobo_mdi_get_active_view: + * @mdi: A pointer to a BonoboMDI object. + * + * Description: + * Returns a pointer to the active view (the one with the focus). + * + * Return value: + * A pointer to a GtkWidget *. + **/ +GtkWidget * +bonobo_mdi_get_active_view (BonoboMDI *mdi) +{ + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + return mdi->priv->active_view; +} + +/** + * bonobo_mdi_get_active_window: + * @mdi: A pointer to a BonoboMDI object. + * + * Description: + * Returns a pointer to the toplevel window containing the active view. + * + * Return value: + * A pointer to a BonoboWindow that has the focus. + **/ +BonoboWindow * +bonobo_mdi_get_active_window (BonoboMDI *mdi) +{ + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + return mdi->priv->active_window; +} + +void +bonobo_mdi_set_ui_template (BonoboMDI *mdi, const gchar *xml, BonoboUIVerb verbs[]) +{ + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (xml != NULL); + + if (mdi->priv->ui_xml != NULL) + g_free (mdi->priv->ui_xml); + + mdi->priv->ui_xml = g_strdup (xml); + + /* FIXME */ + mdi->priv->verbs = verbs; +} + +void +bonobo_mdi_set_ui_template_file (BonoboMDI *mdi, const gchar *file_name, BonoboUIVerb verbs[]) +{ + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (file_name != NULL); + + if (mdi->priv->ui_file_name != NULL) + g_free (mdi->priv->ui_file_name); + + mdi->priv->ui_file_name = g_strdup (file_name); + + /* FIXME */ + mdi->priv->verbs = verbs; +} + +/** + * bonobo_mdi_set_child_list_path: + * @mdi: A pointer to a BonoboMDI object. + * @path: A menu path where the child list menu should be inserted + * + * Description: + * Sets the position for insertion of menu items used to activate the MDI + * children that were added to the MDI. See gnome_app_find_menu_pos for + * details on menu paths. If the path is not set or set to %NULL, these menu + * items aren't going to be inserted in the MDI menu structure. Note that if + * you want all menu items to be inserted in their own submenu, you have to + * create that submenu (and leave it empty, of course). + **/ +void +bonobo_mdi_set_child_list_path (BonoboMDI *mdi, const gchar *path) +{ + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + + if (mdi->priv->child_list_path) + g_free (mdi->priv->child_list_path); + + mdi->priv->child_list_path = g_strdup (path); +} + +/** + * bonobo_mdi_register: + * @mdi: A pointer to a BonoboMDI object. + * @object: Object to register. + * + * Description: + * Registers GObject @object with MDI. + * This is mostly intended for applications that open other windows besides + * those opened by the MDI and want to continue to run even when no MDI + * windows exist (an example of this would be GIMP's window with tools, if + * the pictures were MDI children). As long as there is an object registered + * with the MDI, the MDI will not destroy itself when the last of its windows + * is closed. If no objects are registered, closing the last MDI window + * results in MDI being destroyed. + **/ +void +bonobo_mdi_register (BonoboMDI *mdi, GObject *object) +{ + if (!g_slist_find (mdi->priv->registered, object)) + mdi->priv->registered = g_slist_append (mdi->priv->registered, object); +} + +/** + * bonobo_mdi_unregister: + * @mdi: A pointer to a BonoboMDI object. + * @object: Object to unregister. + * + * Description: + * Removes GObject @object from the list of registered objects. + **/ +void +bonobo_mdi_unregister (BonoboMDI *mdi, GObject *object) +{ + mdi->priv->registered = g_slist_remove (mdi->priv->registered, object); +} + +/** + * bonobo_mdi_get_child_from_view: + * @view: A pointer to a GtkWidget. + * + * Description: + * Returns a child that @view is a view of. + * + * Return value: + * A pointer to the BonoboMDIChild the view belongs to. + **/ +BonoboMDIChild * +bonobo_mdi_get_child_from_view (GtkWidget *view) +{ + return BONOBO_MDI_CHILD (g_object_get_data (G_OBJECT(view), BONOBO_MDI_CHILD_KEY)); +} + +/** + * bonobo_mdi_get_window_from_view: + * @view: A pointer to a GtkWidget. + * + * Description: + * Returns the toplevel window for this view. + * + * Return value: + * A pointer to the BonoboWindow containg the specified view. + **/ +BonoboWindow * +bonobo_mdi_get_window_from_view (GtkWidget *view) +{ + return BONOBO_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))); +} + +/** + * bonobo_mdi_get_view_from_window: + * @mdi: A pointer to a BonoboMDI object. + * @win: A pointer to a BonoboWindow widget. + * + * Description: + * Returns the pointer to the view in the MDI toplevel window @win. + * If the mode is set to %GNOME_MDI_NOTEBOOK, the view in the current + * page is returned. + * + * Return value: + * A pointer to a view. + **/ +GtkWidget * +bonobo_mdi_get_view_from_window (BonoboMDI *mdi, BonoboWindow *win) +{ + GtkWidget *book; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + g_return_val_if_fail (win != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_WINDOW (win), NULL); + + book = get_book_from_window (win); + g_return_val_if_fail (book != NULL, NULL); + + if (GTK_NOTEBOOK (book)->cur_page) + { + int cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (book)); + + gl_debug (DEBUG_MDI, "END1"); + + return gtk_notebook_get_nth_page (GTK_NOTEBOOK (book), cur_page); + } + else + { + gl_debug (DEBUG_MDI, "END2"); + + return NULL; + } +} + +void +bonobo_mdi_construct (BonoboMDI *mdi, const gchar* name, const gchar* title, + gint default_window_width, gint default_window_height) +{ + g_return_if_fail (mdi->priv->mdi_name == NULL); + g_return_if_fail (mdi->priv->title == NULL); + + g_return_if_fail (name != NULL); + g_return_if_fail (title != NULL); + + mdi->priv->mdi_name = g_strdup (name); + mdi->priv->title = g_strdup (title); + + mdi->priv->default_window_width = default_window_width; + mdi->priv->default_window_height = default_window_height; + +} + +GList * +bonobo_mdi_get_children (BonoboMDI *mdi) +{ + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + + return mdi->priv->children; +} + +GList * +bonobo_mdi_get_windows (BonoboMDI *mdi) +{ + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + + return mdi->priv->windows; +} + + + +BonoboUIComponent* +bonobo_mdi_get_ui_component_from_window (BonoboWindow* win) +{ + return BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win), UI_COMPONENT_KEY)); +} + +const BonoboMDIWindowInfo * +bonobo_mdi_get_window_info (BonoboWindow *win) +{ + return (const BonoboMDIWindowInfo *) + g_object_get_data (G_OBJECT (win), WINDOW_INFO_KEY); +} diff --git a/glabels2/src/bonobo-mdi.h b/glabels2/src/bonobo-mdi.h new file mode 100644 index 00000000..93556879 --- /dev/null +++ b/glabels2/src/bonobo-mdi.h @@ -0,0 +1,204 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * bonobo-mdi.h - definition of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * 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 of the License, 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., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +/* + * Modified by the gedit Team, 2001-2002. See the AUTHORS file for a + * list of people on the gedit Team. + * See the ChangeLog files for a list of changes. + */ + +#ifndef _BONOBO_MDI_H_ +#define _BONOBO_MDI_H_ + +#include +#include +#include + + +#include "bonobo-mdi-child.h" + +#define BONOBO_TYPE_MDI (bonobo_mdi_get_type ()) +#define BONOBO_MDI(obj) (GTK_CHECK_CAST ((obj), BONOBO_TYPE_MDI, BonoboMDI)) +#define BONOBO_MDI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_MDI, BonoboMDIClass)) +#define BONOBO_IS_MDI(obj) (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_MDI)) +#define BONOBO_IS_MDI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_MDI)) +#define BONOBO_MDI_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), BONOBO_TYPE_MDI, BonoboMDIClass)) + +typedef struct _BonoboMDIPrivate BonoboMDIPrivate; + +typedef struct { + GObject object; + + BonoboMDIPrivate *priv; +} BonoboMDI; + +typedef struct { + GObjectClass parent_class; + + /* Signals */ + gboolean (*add_child) (BonoboMDI *mdi, BonoboMDIChild *child); + gboolean (*remove_child) (BonoboMDI *mdi, BonoboMDIChild *child); + gboolean (*add_view) (BonoboMDI *mdi, GtkWidget *view); + gboolean (*remove_view) (BonoboMDI *mdi, GtkWidget *view); + void (*child_changed) (BonoboMDI *mdi, BonoboMDIChild *child); + void (*view_changed) (BonoboMDI *mdi, GtkWidget *view); + void (*top_window_created) (BonoboMDI *mdi, BonoboWindow *window); + void (*top_window_destroy) (BonoboMDI *mdi, BonoboWindow *window); + void (*all_windows_destroyed)(BonoboMDI *mdi); +} BonoboMDIClass; + +typedef struct _BonoboMDIWindowInfo BonoboMDIWindowInfo; + +struct _BonoboMDIWindowInfo { + gint width; + gint height; + + GdkWindowState state; +}; + +/* + * description of BonoboMDI signals: + * + * gboolean add_child(BonoboMDI *, BonoboMDIChild *) + * gboolean add_view(BonoboMDI *, GtkWidget *) + * are called before actually adding a mdi_child or a view to the MDI. if the handler returns + * TRUE, the action proceeds otherwise the mdi_child or view are not added. + * + * gboolean remove_child(BonoboMDI *, BonoboMDIChild *) + * gboolean remove_view(BonoboMDI *, GtkWidget *) + * are called before removing mdi_child or view. the handler should return true if the object + * is to be removed from MDI + * + * void child_changed(BonoboMDI *, BonoboMDIChild *) + * gets called each time when active child is changed with the second argument + * pointing to the old child. mdi->active_view and mdi->active_child still already + * hold the new values + * + * void view_changed(BonoboMDI *, GtkWidget *) + * is emitted whenever a view is changed, regardless of it being the view of the same child as + * the old view or not. the second argument points to the old view, mdi->active_view and + * mdi->active_child hold the new values. if the child has also been changed, this signal is + * emitted after the child_changed signal. + * + * void top_window_created(BonoboMDI *, BonoboWindow *) + * is called with each newly created BonoboWindow to allow the MDI user to customize it (add a + * statusbar, toolbars or menubar if the method with ui templates is not sufficient, + * etc.). + * no contents may be set since BonoboMDI uses them for storing either a view of a child + * or a notebook + */ + +GType bonobo_mdi_get_type (void); + +GObject *bonobo_mdi_new (const gchar *mdi_name, + const gchar *title, + gint default_window_width, + gint default_window_height); + +void bonobo_mdi_construct (BonoboMDI *mdi, + const gchar *name, + const gchar *title, + gint default_window_width, + gint default_window_height); + +/* setting the ui template*/ +void bonobo_mdi_set_ui_template (BonoboMDI *mdi, + const gchar *xml, + BonoboUIVerb verbs[]); +void bonobo_mdi_set_ui_template_file (BonoboMDI *mdi, + const gchar *file_name, + BonoboUIVerb verbs[]); + +void bonobo_mdi_set_child_list_path (BonoboMDI *mdi, + const gchar *path); + +/* manipulating views */ +gboolean bonobo_mdi_add_view (BonoboMDI *mdi, + BonoboMDIChild *child); +gboolean bonobo_mdi_add_toplevel_view (BonoboMDI *mdi, + BonoboMDIChild *child, + const char *window_role); +gboolean bonobo_mdi_remove_view (BonoboMDI *mdi, + GtkWidget *view, + gboolean force); + +GtkWidget *bonobo_mdi_get_active_view (BonoboMDI *mdi); +void bonobo_mdi_set_active_view (BonoboMDI *mdi, + GtkWidget *view); + +/* manipulating children */ +gint bonobo_mdi_add_child (BonoboMDI *mdi, + BonoboMDIChild *child); +gint bonobo_mdi_remove_child (BonoboMDI *mdi, + BonoboMDIChild *child, + gboolean force); +gint bonobo_mdi_remove_all (BonoboMDI *mdi, + gboolean force); + +void bonobo_mdi_open_toplevel (BonoboMDI *mdi, + const char *window_role); + +BonoboMDIChild *bonobo_mdi_get_active_child (BonoboMDI *mdi); +BonoboMDIChild *bonobo_mdi_find_child (BonoboMDI *mdi, + const gchar *name); + +BonoboWindow *bonobo_mdi_get_active_window (BonoboMDI *mdi); + +/* + * the following two functions are here to make life easier if an application + * creates objects (like opening a window) that should "keep the application + * alive" even if there are no MDI windows open. any such windows should be + * registered with the MDI: as long as there is a window registered, the MDI + * will not destroy itself (even if the last of its windows is closed). on the + * other hand, closing the last MDI window when no objects are registered + * with the MDI will result in MDI being gtk_object_destroy()ed. + */ +void bonobo_mdi_register (BonoboMDI *mdi, + GObject *object); +void bonobo_mdi_unregister (BonoboMDI *mdi, + GObject *object); + +/* + * convenience functions for retrieveing BonoboMDIChild and BonoboApp + * objects associated with a particular view and for retrieveing the + * visible view of a certain BonoboWindow. + */ +BonoboWindow *bonobo_mdi_get_window_from_view (GtkWidget *view); +BonoboMDIChild *bonobo_mdi_get_child_from_view (GtkWidget *view); +GtkWidget *bonobo_mdi_get_view_from_window (BonoboMDI *mdi, + BonoboWindow *window); + +GList *bonobo_mdi_get_children (BonoboMDI *mdi); +GList *bonobo_mdi_get_windows (BonoboMDI *mdi); + +BonoboUIComponent *bonobo_mdi_get_ui_component_from_window (BonoboWindow *win); + +/* Utility function to generate unique window roles */ +char *bonobo_mdi_generate_window_role (void); + +const BonoboMDIWindowInfo *bonobo_mdi_get_window_info (BonoboWindow *win); + +#endif /* _BONOBO_MDI_H_ */ + + diff --git a/glabels2/src/canvas-hacktext.c b/glabels2/src/canvas-hacktext.c new file mode 100644 index 00000000..75ccd4f0 --- /dev/null +++ b/glabels2/src/canvas-hacktext.c @@ -0,0 +1,587 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * gnome-canvas-hacktext.c: Hacktext item type for GnomeCanvas widget + * This is mainly used for gnome-print preview context + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, 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 Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Authors: + * Federico Mena + * Raph Levien + * Lauris Kaplinski + * + * Copyright (C) 1998-1999 The Free Software Foundation + * Copyright (C) 2000-2002 Ximian Inc. + * + */ + +/* + * TODO: + * - Clipping + */ + +#include + +#include +#include +#include +#include +#include +#include "canvas-hacktext.h" + +enum { + ARG_0, + ARG_TEXT, + ARG_GLYPHLIST, + ARG_FILL_COLOR, + ARG_FILL_COLOR_RGBA, + ARG_FONT, + ARG_X, + ARG_Y +}; + + +static void gl_canvas_hacktext_class_init (glCanvasHacktextClass *class); +static void gl_canvas_hacktext_init (glCanvasHacktext *hacktext); +static void gl_canvas_hacktext_destroy (GtkObject *object); +static void gl_canvas_hacktext_set_arg (GObject *object, + guint arg_id, + const GValue *value, + GParamSpec *pspec); +static void gl_canvas_hacktext_get_arg (GObject *object, + guint arg_id, + GValue *value, + GParamSpec *pspec); + +static void gl_canvas_hacktext_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gl_canvas_hacktext_realize (GnomeCanvasItem *item); +static void gl_canvas_hacktext_unrealize (GnomeCanvasItem *item); +static double gl_canvas_hacktext_point (GnomeCanvasItem *item, double x, double y, + int cx, int cy, GnomeCanvasItem **actual_item); +static void gl_canvas_hacktext_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); +static void gl_canvas_hacktext_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); +static void gl_canvas_hacktext_req_repaint (glCanvasHacktext *hacktext, ArtIRect *bbox); + + +static GnomeCanvasItemClass *parent_class; + +struct _glCanvasHacktextPriv { + GnomeFont * font; + + GnomeGlyphList * glyphlist; + GnomePosGlyphList * pgl; + double affine[6]; /* the text to world transform (NB! mirrored Y) */ +}; + +GType +gl_canvas_hacktext_get_type (void) +{ + static GType hacktext_type = 0; + + if (!hacktext_type) { + static const GTypeInfo hacktext_info = { + sizeof (glCanvasHacktextClass), + NULL, + NULL, + (GClassInitFunc) gl_canvas_hacktext_class_init, + NULL, + NULL, + sizeof (glCanvasHacktext), + 0, + (GInstanceInitFunc) gl_canvas_hacktext_init, + NULL + }; + + hacktext_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, + "glCanvasHacktext", + &hacktext_info, 0); + } + + return hacktext_type; +} + +static void +gl_canvas_hacktext_class_init (glCanvasHacktextClass *class) +{ + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GnomeCanvasItemClass *item_class; + + gobject_class = (GObjectClass *) class; + object_class = (GtkObjectClass *) class; + item_class = (GnomeCanvasItemClass *) class; + + parent_class = g_type_class_peek_parent (class); + + gobject_class->set_property = gl_canvas_hacktext_set_arg; + gobject_class->get_property = gl_canvas_hacktext_get_arg; + + g_object_class_install_property + (gobject_class, + ARG_TEXT, + g_param_spec_string ("text", NULL, NULL, + NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_GLYPHLIST, + g_param_spec_pointer ("glyphlist", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_FILL_COLOR, + g_param_spec_string ("fill_color", NULL, NULL, + NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_FILL_COLOR_RGBA, + g_param_spec_uint ("fill_color_rgba", NULL, NULL, + 0, G_MAXUINT, 0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_FONT, + g_param_spec_pointer ("font", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_X, + g_param_spec_double ("x", NULL, NULL, + -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_Y, + g_param_spec_double ("y", NULL, NULL, + -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + + object_class->destroy = gl_canvas_hacktext_destroy; + + item_class->update = gl_canvas_hacktext_update; + item_class->realize = gl_canvas_hacktext_realize; + item_class->unrealize = gl_canvas_hacktext_unrealize; + item_class->point = gl_canvas_hacktext_point; + item_class->bounds = gl_canvas_hacktext_bounds; + item_class->render = gl_canvas_hacktext_render; +} + +static void +gl_canvas_hacktext_init (glCanvasHacktext *hacktext) +{ + hacktext->text = NULL; + hacktext->priv = g_new (glCanvasHacktextPriv, 1); + hacktext->priv->font = NULL; + hacktext->priv->glyphlist = NULL; + hacktext->priv->pgl = NULL; + + art_affine_identity (hacktext->priv->affine); +} + +static void +gl_canvas_hacktext_destroy (GtkObject *object) +{ + glCanvasHacktext *hacktext; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_CANVAS_HACKTEXT (object)); + + hacktext = GL_CANVAS_HACKTEXT (object); + + if (hacktext->text) { + g_free (hacktext->text); + hacktext->text = NULL; + } + + if (hacktext->priv) { + if (hacktext->priv->font) gnome_font_unref (hacktext->priv->font); + if (hacktext->priv->glyphlist) gnome_glyphlist_unref (hacktext->priv->glyphlist); + if (hacktext->priv->pgl) gnome_pgl_destroy (hacktext->priv->pgl); + g_free (hacktext->priv); + hacktext->priv = NULL; + } + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void +art_drect_hacktext (ArtDRect *bbox, glCanvasHacktext *hacktext) +{ + g_assert (bbox != NULL); + g_assert (hacktext != NULL); + + g_return_if_fail (hacktext->priv); + + if (GTK_OBJECT_FLAGS (hacktext) & GNOME_CANVAS_UPDATE_REQUESTED) { + gnome_canvas_update_now (GNOME_CANVAS_ITEM (hacktext)->canvas); + } + + if (!hacktext->priv->pgl) return; + + gnome_pgl_bbox (hacktext->priv->pgl, bbox); +} + +/* Computes the bounding box of the hacktext. Assumes that the number of points in the hacktext is + * not zero. + */ +static void +get_bounds (glCanvasHacktext *hacktext, double *bx1, double *by1, double *bx2, double *by2) +{ + ArtDRect bbox; + + /* Compute bounds of hacktext */ + art_drect_hacktext (&bbox, hacktext); + + /* Done */ + + *bx1 = bbox.x0; + *by1 = bbox.y0; + *bx2 = bbox.x1; + *by2 = bbox.y1; +} + +#ifdef IFED_OUT_BY_CHEMA_TO_KILL_COMPILE_WARNING +/* Convenience function to set a GC's foreground color to the specified pixel value */ +static void +set_gc_foreground (GdkGC *gc, gulong pixel) +{ + GdkColor c; + + if (!gc) + return; + + c.pixel = pixel; + gdk_gc_set_foreground (gc, &c); +} +#endif + +static void +gl_canvas_hacktext_set_arg (GObject *object, + guint arg_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeCanvasItem *item; + glCanvasHacktext *bp; + char *text; + GnomeGlyphList * gl; + GdkColor color; + GnomeFont * font; + + item = GNOME_CANVAS_ITEM (object); + bp = GL_CANVAS_HACKTEXT (object); + + switch (arg_id) { + case ARG_TEXT: + if (bp->text) { + g_free (bp->text); + bp->text = NULL; + } + + if (bp->priv->glyphlist) { + gnome_glyphlist_unref (bp->priv->glyphlist); + bp->priv->glyphlist = NULL; + } + + if (text) bp->text = g_value_dup_string (value); + + gnome_canvas_item_request_update (item); + break; + + case ARG_GLYPHLIST: + gl = g_value_get_pointer (value); + + if (bp->text) { + g_free (bp->text); + bp->text = NULL; + } + + if (bp->priv->glyphlist) { + gnome_glyphlist_unref (bp->priv->glyphlist); + bp->priv->glyphlist = NULL; + } + + /* fixme: should be duplicate() */ + + if (gl) gnome_glyphlist_ref (gl); + + bp->priv->glyphlist = gl; + + gnome_canvas_item_request_update (item); + + break; + + case ARG_FILL_COLOR: + if (gnome_canvas_get_color (item->canvas, g_value_get_string(value), &color)) { + bp->fill_set = TRUE; + bp->fill_pixel = color.pixel; + bp->fill_rgba = + ((color.red & 0xff00) << 16) | + ((color.green & 0xff00) << 8) | + (color.blue & 0xff00) | + 0xff; + } else { + bp->fill_set = FALSE; + bp->fill_rgba = 0; + } + + gnome_canvas_item_request_update (item); + break; + + case ARG_FILL_COLOR_RGBA: + bp->fill_set = TRUE; + bp->fill_rgba = g_value_get_uint (value); + + /* should probably request repaint on the fill_svp */ + gnome_canvas_item_request_update (item); + + break; + + case ARG_FONT: + font = g_value_get_pointer (value); + if (font) gnome_font_ref (font); + if (bp->priv->font) gnome_font_unref (bp->priv->font); + bp->priv->font = font; + bp->size = gnome_font_get_size (bp->priv->font); + gnome_canvas_item_request_update (item); + break; + + case ARG_X: + bp->x = g_value_get_double (value); + gnome_canvas_item_request_update (item); + break; + + case ARG_Y: + bp->y = g_value_get_double (value); + gnome_canvas_item_request_update (item); + break; + + default: + break; + } +} + +static void +gl_canvas_hacktext_get_arg (GObject *object, + guint arg_id, + GValue *value, + GParamSpec *pspec) +{ + glCanvasHacktext *bp; + + bp = GL_CANVAS_HACKTEXT (object); + + switch (arg_id) { + case ARG_TEXT: + if (bp->text) { + g_value_set_string (value, g_strdup (bp->text)); + } else + g_value_set_string (value, NULL); + break; + case ARG_FILL_COLOR_RGBA: + g_value_set_uint (value, bp->fill_color); + break; + + case ARG_FONT: + g_value_set_pointer (value, bp->priv->font); + break; + + case ARG_X: + g_value_set_double (value, bp->x); + break; + + case ARG_Y: + g_value_set_double (value, bp->y); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, arg_id, pspec); + break; + } +} + +static void +gl_canvas_hacktext_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +{ + glCanvasHacktext *hacktext; + ArtIRect ibbox = {0, 0, 0, 0}; + + hacktext = (glCanvasHacktext *) item; + + if (parent_class->update) + (* parent_class->update) (item, affine, clip_path, flags); + + if (hacktext->priv->pgl) gl_canvas_hacktext_req_repaint (hacktext, NULL); + + gnome_canvas_item_reset_bounds (item); + + hacktext->priv->affine[0] = affine[0]; + hacktext->priv->affine[1] = affine[1]; + hacktext->priv->affine[2] = -affine[2]; + hacktext->priv->affine[3] = -affine[3]; + hacktext->priv->affine[4] = affine[4] + hacktext->x * affine[0] + hacktext->y * affine[2]; + hacktext->priv->affine[5] = affine[5] + hacktext->x * affine[1] + hacktext->y * affine[3]; + + if (hacktext->text) { + if (hacktext->priv->glyphlist) { + gnome_glyphlist_unref (hacktext->priv->glyphlist); + hacktext->priv->glyphlist = NULL; + } + + if (!hacktext->priv->font) return; + + hacktext->priv->glyphlist = gnome_glyphlist_from_text_dumb (hacktext->priv->font, hacktext->fill_rgba, + 0.0, 0.0, + hacktext->text); + } + + if (hacktext->priv->glyphlist) { + GnomePosGlyphList * pgl; + + pgl = gnome_pgl_from_gl (hacktext->priv->glyphlist, hacktext->priv->affine, GNOME_PGL_RENDER_DEFAULT); + + if (hacktext->priv->pgl) gnome_pgl_destroy (hacktext->priv->pgl); + + hacktext->priv->pgl = pgl; + } + + gl_canvas_hacktext_req_repaint (hacktext, &ibbox); + + hacktext->item.x1 = ibbox.x0; + hacktext->item.y1 = ibbox.y0; + hacktext->item.x2 = ibbox.x1; + hacktext->item.y2 = ibbox.y1; +} + +static void +gl_canvas_hacktext_realize (GnomeCanvasItem *item) +{ + glCanvasHacktext *hacktext; + + hacktext = (glCanvasHacktext *) item; + + if (parent_class->realize) + (* parent_class->realize) (item); +} + +static void +gl_canvas_hacktext_unrealize (GnomeCanvasItem *item) +{ + glCanvasHacktext *hacktext; + + hacktext = (glCanvasHacktext *) item; + + if (parent_class->unrealize) + (* parent_class->unrealize) (item); +} + +static double +gl_canvas_hacktext_point (GnomeCanvasItem *item, double mx, double my, + int cx, int cy, GnomeCanvasItem **actual_item) +{ + glCanvasHacktext * hacktext; + + hacktext = (glCanvasHacktext *) item; + + if (!hacktext->priv->pgl) return 1e18; + + *actual_item = item; + + if (gnome_pgl_test_point (hacktext->priv->pgl, cx, cy)) return 0.0; + + return 1e18; +} + +static void +gl_canvas_hacktext_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +{ + glCanvasHacktext *hacktext; + + g_return_if_fail (item != NULL); + g_return_if_fail (GL_IS_CANVAS_HACKTEXT (item)); + + hacktext = GL_CANVAS_HACKTEXT (item); + + if (hacktext->text == NULL) { + *x1 = *y1 = *x2 = *y2 = 0.0; + return; + } + + get_bounds (hacktext, x1, y1, x2, y2); +} + +static void +gl_canvas_hacktext_req_repaint (glCanvasHacktext *hacktext, + ArtIRect *bbox) +{ + ArtDRect gbbox; + + g_return_if_fail (hacktext->priv); + + if (!hacktext->priv->pgl) return; + + if (gnome_pgl_bbox (hacktext->priv->pgl, &gbbox)) { + ArtIRect ibox; + art_drect_to_irect (&ibox, &gbbox); + gnome_canvas_request_redraw (hacktext->item.canvas, ibox.x0, ibox.y0, ibox.x1, ibox.y1); + if (bbox) art_irect_union (bbox, bbox, &ibox); + } +} + +static void +gl_canvas_hacktext_render (GnomeCanvasItem *item, + GnomeCanvasBuf *buf) +{ + glCanvasHacktext * hacktext; + + hacktext = (glCanvasHacktext *) item; + + g_return_if_fail (hacktext->priv); + + if (!hacktext->priv->pgl) return; + + gnome_canvas_buf_ensure_buf (buf); + buf->is_buf = TRUE; + buf->is_bg = FALSE; + + gnome_rfont_render_pgl_rgb8 (hacktext->priv->pgl, + -buf->rect.x0, -buf->rect.y0, + buf->buf, + buf->rect.x1 - buf->rect.x0, + buf->rect.y1 - buf->rect.y0, + buf->buf_rowstride, + GNOME_RFONT_RENDER_DEFAULT); +} + + + + + + + + + + + + diff --git a/glabels2/src/canvas-hacktext.h b/glabels2/src/canvas-hacktext.h new file mode 100644 index 00000000..fcb4d5a1 --- /dev/null +++ b/glabels2/src/canvas-hacktext.h @@ -0,0 +1,71 @@ +#ifndef __GL_CANVAS_HACKTEXT_H__ +#define __GL_CANVAS_HACKTEXT_H__ + +/* Hacktext item type for GnomeCanvas widget + * + * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is + * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. + * + * Copyright (C) 1998,1999 The Free Software Foundation + * + * Authors: Federico Mena + * Raph Levien + */ + +#include + +G_BEGIN_DECLS + +/* Hacktext item for the canvas. The API is totally unstable - it needs to be replaced with one + * that supports Unicode and the merged GnomeText/GScript API. However, I need a text item now, + * and the GnomeText/GScript integration is going to take a bit more effort. + * + * The following object arguments are available: + * + * name type read/write description + * ------------------------------------------------------------------------------------------ + * text char * RW The string of the text item. + * glyphlist GnomeGlyphList * W Glyphlist + * fill_color string W X color specification for fill color, + * or NULL pointer for no color (transparent). + * fill_color_gdk GdkColor* RW Allocated GdkColor for fill. + */ + +#define GL_TYPE_CANVAS_HACKTEXT (gl_canvas_hacktext_get_type ()) +#define GL_CANVAS_HACKTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_CANVAS_HACKTEXT, glCanvasHacktext)) +#define GL_CANVAS_HACKTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_CANVAS_HACKTEXT, glCanvasHacktextClass)) +#define GL_IS_CANVAS_HACKTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_CANVAS_HACKTEXT)) +#define GL_IS_CANVAS_HACKTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_CANVAS_HACKTEXT)) + +typedef struct _glCanvasHacktext glCanvasHacktext; +typedef struct _glCanvasHacktextPriv glCanvasHacktextPriv; +typedef struct _glCanvasHacktextClass glCanvasHacktextClass; + +#include + +struct _glCanvasHacktext { + GnomeCanvasItem item; + + char *text; /* String of the text item */ + guint fill_color; /* Fill color, RGBA */ + gulong fill_pixel; /* Color for fill */ + guint fill_set : 1; /* Is fill color set? */ + + double size; /* size in user units */ + double x, y; /* x, y coords of text origin */ + /* Antialiased specific stuff follows */ + guint32 fill_rgba; /* RGBA color for filling */ + glCanvasHacktextPriv *priv; /* Private data */ +}; + +struct _glCanvasHacktextClass { + GnomeCanvasItemClass parent_class; +}; + + +GType gl_canvas_hacktext_get_type (void); + + +G_END_DECLS + +#endif diff --git a/glabels2/src/commands.c b/glabels2/src/commands.c new file mode 100644 index 00000000..cd83667b --- /dev/null +++ b/glabels2/src/commands.c @@ -0,0 +1,419 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * commands.c: GLabels commands module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include +#include + +#include "commands.h" +#include "glabels.h" +#include "mdi-child.h" +#include "view.h" +#include "file.h" +#include "print.h" +#include "prefs.h" +#include "prefs-dialog.h" +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define LOGO_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-about-logo.png") +#else +#define LOGO_PIXMAP gnome_pixmap_file("glabels/glabels-about-logo.png") +#endif + + +/****************************************************************************/ +/* File->New command. */ +/****************************************************************************/ +void +gl_cmd_file_new (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + gl_debug (DEBUG_COMMANDS, "verbname: %s", verbname); + + gl_file_new (); +} + +/****************************************************************************/ +/* File->Open command. */ +/****************************************************************************/ +void +gl_cmd_file_open (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + BonoboMDIChild *active_child; + + gl_debug (DEBUG_COMMANDS, ""); + + active_child = bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)); + + gl_file_open ((glMDIChild*) active_child); +} + +/****************************************************************************/ +/* File->Save command. */ +/****************************************************************************/ +void +gl_cmd_file_save (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glMDIChild *active_child; + + gl_debug (DEBUG_COMMANDS, ""); + + active_child = GL_MDI_CHILD (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi))); + if (active_child == NULL) + return; + + gl_file_save (active_child); +} + +/****************************************************************************/ +/* File->Save_as command. */ +/****************************************************************************/ +void +gl_cmd_file_save_as (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glMDIChild *active_child; + + gl_debug (DEBUG_COMMANDS, ""); + + active_child = GL_MDI_CHILD (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi))); + if (active_child == NULL) + return; + + gl_file_save_as (active_child); +} + +/****************************************************************************/ +/* File->Print command. */ +/****************************************************************************/ +void +gl_cmd_file_print (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glLabel *label = glabels_get_active_label (); + BonoboWindow *win = glabels_get_active_window (); + + gl_debug (DEBUG_COMMANDS, ""); + + g_return_if_fail (label != NULL); + g_return_if_fail (win != NULL); + + gl_print_dialog (label, win); + +} + +/****************************************************************************/ +/* File->Close command. */ +/****************************************************************************/ +void +gl_cmd_file_close (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + GtkWidget *active_view; + + gl_debug (DEBUG_COMMANDS, ""); + + active_view = bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi)); + + if (active_view == NULL) + return; + + glabels_close_x_button_pressed = TRUE; + + gl_file_close (active_view); + + glabels_close_x_button_pressed = FALSE; +} + +/****************************************************************************/ +/* File->Close_all command. */ +/****************************************************************************/ +void +gl_cmd_file_close_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + gl_debug (DEBUG_COMMANDS, ""); + + glabels_close_x_button_pressed = TRUE; + + gl_file_close_all (); + + glabels_close_x_button_pressed = FALSE; +} + +/****************************************************************************/ +/* File->Exit command. */ +/****************************************************************************/ +void +gl_cmd_file_exit (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + gl_debug (DEBUG_COMMANDS, ""); + + glabels_exit_button_pressed = TRUE; + + gl_file_exit (); + + glabels_exit_button_pressed = FALSE; +} + + +/****************************************************************************/ +/* Edit->Cut command. */ +/****************************************************************************/ +void +gl_cmd_edit_cut (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_cut (active_view); +} + +/****************************************************************************/ +/* Edit->Copy command. */ +/****************************************************************************/ +void +gl_cmd_edit_copy (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_copy (active_view); +} + +/****************************************************************************/ +/* Edit->Paste command. */ +/****************************************************************************/ +void +gl_cmd_edit_paste (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_paste (active_view); +} + + +/****************************************************************************/ +/* Edit->Delete command. */ +/****************************************************************************/ +void +gl_cmd_edit_delete (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_delete_selection (active_view); +} + + +/****************************************************************************/ +/* Edit->Select_all command. */ +/****************************************************************************/ +void +gl_cmd_edit_select_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = + GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI(glabels_mdi))); + + g_return_if_fail (active_view); + + gl_view_select_all (active_view); +} + +/****************************************************************************/ +/* Edit->Select_all command. */ +/****************************************************************************/ +void +gl_cmd_edit_unselect_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = + GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI(glabels_mdi))); + + g_return_if_fail (active_view); + + gl_view_unselect_all (active_view); +} + +/****************************************************************************/ +/* Settings->Preferences command. */ +/****************************************************************************/ +void +gl_cmd_settings_preferences (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + static GtkWidget *dlg = NULL; + + gl_debug (DEBUG_COMMANDS, ""); + + if (dlg != NULL) + { + gtk_window_present (GTK_WINDOW (dlg)); + gtk_window_set_transient_for (GTK_WINDOW (dlg), + GTK_WINDOW (glabels_get_active_window ())); + + return; + } + + dlg = gl_prefs_dialog_new (GTK_WINDOW (glabels_get_active_window ())); + + g_signal_connect (G_OBJECT (dlg), "destroy", + G_CALLBACK (gtk_widget_destroyed), &dlg); + + gtk_widget_show (dlg); +} + +/****************************************************************************/ +/* Help->Contents command. */ +/****************************************************************************/ +void +gl_cmd_help_contents (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + GError *error = NULL; + + gl_debug (DEBUG_COMMANDS, ""); + + gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error); + + if (error != NULL) + { + g_warning (error->message); + + g_error_free (error); + } +} + +/****************************************************************************/ +/* Help->About command. */ +/****************************************************************************/ +void +gl_cmd_help_about (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + static GtkWidget *about = NULL; + GdkPixbuf* pixbuf = NULL; + + gchar *copy_text = "Copyright 2001-2002 Jim Evins"; + gchar *about_text = + _("A label and business card creation program for GNOME.\n" + " \n" + "Glabels 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 of the License, or " + "(at your option) any later version.\n" " \n" + "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.\n"); + + gchar *authors[] = { + _("Author:"), + "\tJim Evins ", + "", + _("See the file AUTHORS for additional acknowledgments,"), + _("or visit http://snaught.com/glabels"), + NULL + }; + + gchar *documenters[] = { + "", + NULL + }; + + gchar *translator_credits = _(""); + + gl_debug (DEBUG_COMMANDS, ""); + + if (about != NULL) + { + gdk_window_show (about->window); + gdk_window_raise (about->window); + return; + } + + pixbuf = gdk_pixbuf_new_from_file ( LOGO_PIXMAP, NULL); + + about = gnome_about_new (_("glabels"), VERSION, + copy_text, + about_text, + (const char **)authors, + (const char **)documenters, + (const char *)translator_credits, + pixbuf); + + gtk_window_set_transient_for (GTK_WINDOW (about), + GTK_WINDOW (glabels_get_active_window ())); + + gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE); + + if (pixbuf != NULL) + g_object_unref (pixbuf); + + g_signal_connect (G_OBJECT (about), "destroy", + G_CALLBACK (gtk_widget_destroyed), &about); + + gtk_widget_show (about); +} + + diff --git a/glabels2/src/commands.h b/glabels2/src/commands.h new file mode 100644 index 00000000..8bc19c75 --- /dev/null +++ b/glabels2/src/commands.h @@ -0,0 +1,111 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * commands.h: GLabels commands module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __COMMANDS_H__ +#define __COMMANDS_H__ + +#include + +extern void gl_cmd_file_new (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_open (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_save (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_save_as (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_print (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_print_preview (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_close (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_close_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_exit (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + + +extern void gl_cmd_edit_undo (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_redo (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_cut (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_copy (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_paste (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_delete (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_select_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_unselect_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + + +extern void gl_cmd_settings_preferences (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + + +extern void gl_cmd_help_contents (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_help_about (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +#endif /* __COMMANDS_H__ */ diff --git a/glabels2/src/debug.c b/glabels2/src/debug.c new file mode 100644 index 00000000..de92feac --- /dev/null +++ b/glabels2/src/debug.c @@ -0,0 +1,93 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * debug.c: GLabels debug module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-debug.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#include + +#include "debug.h" + +/* External debug options, used here and in glabels.c */ +gint gl_debug_all = 0; +gint gl_debug_view = 0; +gint gl_debug_item = 0; +gint gl_debug_prefs = 0; +gint gl_debug_print = 0; +gint gl_debug_file = 0; +gint gl_debug_label = 0; +gint gl_debug_template = 0; +gint gl_debug_xml = 0; +gint gl_debug_merge = 0; +gint gl_debug_commands = 0; +gint gl_debug_undo = 0; +gint gl_debug_recent = 0; +gint gl_debug_mdi = 0; +gint gl_debug_media_select = 0; +gint gl_debug_mini_preview = 0; +gint gl_debug_wdgt = 0; + +/****************************************************************************/ +/* Print debugging information. */ +/****************************************************************************/ +void +gl_debug (gint section, + gchar *file, + gint line, + gchar* function, + gchar* format, + ...) +{ + va_list args; + gchar *msg; + + g_return_if_fail (format != NULL); + + va_start (args, format); + msg = g_strdup_vprintf (format, args); + va_end (args); + + if (gl_debug_all || + (gl_debug_view && section == GL_DEBUG_VIEW) || + (gl_debug_item && section == GL_DEBUG_ITEM) || + (gl_debug_print && section == GL_DEBUG_PRINT) || + (gl_debug_prefs && section == GL_DEBUG_PREFS) || + (gl_debug_file && section == GL_DEBUG_FILE) || + (gl_debug_label && section == GL_DEBUG_LABEL) || + (gl_debug_template && section == GL_DEBUG_TEMPLATE) || + (gl_debug_xml && section == GL_DEBUG_XML) || + (gl_debug_merge && section == GL_DEBUG_MERGE) || + (gl_debug_commands && section == GL_DEBUG_COMMANDS) || + (gl_debug_undo && section == GL_DEBUG_UNDO) || + (gl_debug_recent && section == GL_DEBUG_RECENT) || + (gl_debug_mdi && section == GL_DEBUG_MDI) || + (gl_debug_media_select && section == GL_DEBUG_MEDIA_SELECT) || + (gl_debug_mini_preview && section == GL_DEBUG_MINI_PREVIEW) || + (gl_debug_wdgt && section == GL_DEBUG_WDGT) ) + g_print ("%s:%d (%s) %s\n", file, line, function, msg); + + g_free (msg); +} diff --git a/glabels2/src/debug.h b/glabels2/src/debug.h new file mode 100644 index 00000000..b9023cff --- /dev/null +++ b/glabels2/src/debug.h @@ -0,0 +1,94 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * debug.h: GLabels debug module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-debug.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +typedef enum { + GL_DEBUG_VIEW, + GL_DEBUG_ITEM, + GL_DEBUG_PRINT, + GL_DEBUG_PREFS, + GL_DEBUG_FILE, + GL_DEBUG_LABEL, + GL_DEBUG_TEMPLATE, + GL_DEBUG_XML, + GL_DEBUG_MERGE, + GL_DEBUG_UNDO, + GL_DEBUG_RECENT, + GL_DEBUG_COMMANDS, + GL_DEBUG_MDI, + GL_DEBUG_MEDIA_SELECT, + GL_DEBUG_MINI_PREVIEW, + GL_DEBUG_WDGT, +} glDebugSection; + +extern gint gl_debug_all; +extern gint gl_debug_view; +extern gint gl_debug_item; +extern gint gl_debug_print; +extern gint gl_debug_prefs; +extern gint gl_debug_file; +extern gint gl_debug_label; +extern gint gl_debug_template; +extern gint gl_debug_xml; +extern gint gl_debug_merge; +extern gint gl_debug_commands; +extern gint gl_debug_undo; +extern gint gl_debug_recent; +extern gint gl_debug_mdi; +extern gint gl_debug_media_select; +extern gint gl_debug_mini_preview; +extern gint gl_debug_wdgt; + +#ifndef __GNUC__ +#define __FUNCTION__ "" +#endif + +#define DEBUG_VIEW GL_DEBUG_VIEW, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_ITEM GL_DEBUG_ITEM, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_PRINT GL_DEBUG_PRINT, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_PREFS GL_DEBUG_PREFS, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_FILE GL_DEBUG_FILE, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_LABEL GL_DEBUG_LABEL, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_TEMPLATE GL_DEBUG_TEMPLATE,__FILE__, __LINE__, __FUNCTION__ +#define DEBUG_XML GL_DEBUG_XML, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MERGE GL_DEBUG_MERGE, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_UNDO GL_DEBUG_UNDO, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_RECENT GL_DEBUG_RECENT, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_COMMANDS GL_DEBUG_COMMANDS,__FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MDI GL_DEBUG_MDI, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MEDIA_SELECT GL_DEBUG_MEDIA_SELECT, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MINI_PREVIEW GL_DEBUG_MINI_PREVIEW, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_WDGT GL_DEBUG_WDGT, __FILE__, __LINE__, __FUNCTION__ + +extern void gl_debug (gint section, gchar *file, + gint line, gchar* function, gchar* format, ...); + +#endif /* __DEBUG_H__ */ diff --git a/glabels2/src/file.c b/glabels2/src/file.c new file mode 100644 index 00000000..f607b0a2 --- /dev/null +++ b/glabels2/src/file.c @@ -0,0 +1,715 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * file.c: FILE menu dialog module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "glabels.h" +#include "xml-label.h" +#include "file.h" +#include "mdi.h" +#include "recent.h" +#include "util.h" +#include "wdgt-media-select.h" +#include "wdgt-rotate-label.h" +#include "debug.h" + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/* Saved state for new dialog */ +static gchar *page_size = NULL; +static gchar *sheet_name = NULL; +static gboolean rotate_flag = FALSE; + +/* Saved state of file selectors */ +static gchar *open_path = NULL; +static gchar *save_path = NULL; + +/*===========================================*/ +/* Local function prototypes. */ +/*===========================================*/ +static void create_new_dialog_widgets (GtkDialog *dlg); +static void new_template_changed (glWdgtMediaSelect *select, + gpointer data); +static void new_response (GtkDialog *dlg, + gint response, + gpointer user_data); +static void open_ok (GtkWidget * widget, + GtkFileSelection * fsel); + +static void save_as_ok_cb (GtkWidget * widget, GtkFileSelection * fsel); +static void save_as_cancel_cb (GtkWidget * widget, GtkFileSelection * fsel); +static void save_as_destroy_cb (GtkWidget * widget, gboolean * destroy_flag); + + +/*****************************************************************************/ +/* "New" menu callback. */ +/*****************************************************************************/ +void +gl_file_new (void) +{ + GtkWidget *dlg; + BonoboWindow *win = glabels_get_active_window (); + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (glabels_mdi != NULL); + g_return_if_fail (win != NULL); + + dlg = gtk_dialog_new_with_buttons (_("New Label or Card"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); + + create_new_dialog_widgets (GTK_DIALOG (dlg)); + + g_signal_connect (G_OBJECT(dlg), "response", + G_CALLBACK (new_response), dlg); + + gtk_widget_show_all (GTK_WIDGET (dlg)); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create widgets. */ +/*---------------------------------------------------------------------------*/ +static void +create_new_dialog_widgets (GtkDialog * dlg) +{ + GtkWidget *wframe, *wvbox, *template_entry, *rotate_sel; + + gl_debug (DEBUG_FILE, "START"); + + wframe = gtk_frame_new (_("Media Type")); + gtk_box_pack_start (GTK_BOX (dlg->vbox), wframe, FALSE, FALSE, 0); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox); + + template_entry = gl_wdgt_media_select_new (); + gtk_container_add (GTK_CONTAINER (wvbox), template_entry); + + wframe = gtk_frame_new (_("Label orientation")); + gtk_box_pack_start (GTK_BOX (dlg->vbox), wframe, FALSE, FALSE, 0); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox); + + rotate_sel = gl_wdgt_rotate_label_new (); + gtk_box_pack_start (GTK_BOX (wvbox), rotate_sel, FALSE, FALSE, 0); + + g_object_set_data (G_OBJECT (dlg), "template_entry", + template_entry); + g_object_set_data (G_OBJECT (dlg), "rotate_sel", rotate_sel); + + g_signal_connect (G_OBJECT (template_entry), "changed", + G_CALLBACK (new_template_changed), rotate_sel); + + if (page_size != NULL) { + gl_wdgt_media_select_set_page_size (GL_WDGT_MEDIA_SELECT (template_entry), + page_size); + } + if (sheet_name != NULL) { + gl_wdgt_media_select_set_name (GL_WDGT_MEDIA_SELECT (template_entry), + sheet_name); + gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL + (rotate_sel), sheet_name); + } else { + sheet_name = + gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry)); + gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL + (rotate_sel), sheet_name); + } + gl_wdgt_rotate_label_set_state (GL_WDGT_ROTATE_LABEL (rotate_sel), rotate_flag); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. New template changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +new_template_changed (glWdgtMediaSelect * select, + gpointer data) +{ + glWdgtRotateLabel *rotate_sel = GL_WDGT_ROTATE_LABEL (data); + gchar *name; + + gl_debug (DEBUG_FILE, "START"); + + name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select)); + + gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (rotate_sel), + name); + + g_free (name); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. New "ok" button callback. */ +/*---------------------------------------------------------------------------*/ +static void +new_response (GtkDialog *dlg, + gint response, + gpointer user_data) +{ + GtkWidget *template_entry, *rotate_sel; + glMDIChild *new_child = NULL; + gint ret; + + gl_debug (DEBUG_FILE, "START"); + + switch (response) { + case GTK_RESPONSE_OK: + template_entry = + GTK_WIDGET (g_object_get_data (G_OBJECT (dlg), + "template_entry")); + rotate_sel = GTK_WIDGET (g_object_get_data (G_OBJECT (dlg), + "rotate_sel")); + + if (page_size != NULL) + g_free (page_size); + page_size = + gl_wdgt_media_select_get_page_size (GL_WDGT_MEDIA_SELECT (template_entry)); + + if (sheet_name != NULL) + g_free (sheet_name); + sheet_name = + gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry)); + + rotate_flag = + gl_wdgt_rotate_label_get_state (GL_WDGT_ROTATE_LABEL (rotate_sel)); + + new_child = gl_mdi_child_new (sheet_name, rotate_flag); + gl_debug (DEBUG_FILE, "template set."); + + ret = bonobo_mdi_add_child (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "Child added."); + + ret = bonobo_mdi_add_view (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "View added."); + + gtk_widget_grab_focus (GTK_WIDGET (glabels_get_active_view ())); + break; + } + + gtk_widget_destroy (GTK_WIDGET (dlg)); + + gl_debug (DEBUG_FILE, "END"); +} + +/*****************************************************************************/ +/* "Open" menu callback. */ +/*****************************************************************************/ +void +gl_file_open (glMDIChild *active_child) +{ + GtkFileSelection *fsel; + BonoboWindow *app = glabels_get_active_window (); + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (app != NULL); + + fsel = GTK_FILE_SELECTION (gtk_file_selection_new (_("Open"))); + gtk_window_set_transient_for (GTK_WINDOW (fsel), GTK_WINDOW (app)); + gtk_window_set_title (GTK_WINDOW (fsel), _("Open label")); + + g_signal_connect (G_OBJECT (fsel->ok_button), "clicked", + G_CALLBACK (open_ok), fsel); + + g_signal_connect_swapped (G_OBJECT (fsel->cancel_button), "clicked", + G_CALLBACK (gtk_widget_destroy), + G_OBJECT (fsel)); + + /* Recover state of open dialog */ + if (open_path != NULL) { + gtk_file_selection_set_filename (fsel, open_path); + } + + /* show the dialog */ + gtk_widget_show (GTK_WIDGET (fsel)); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Open "O.K." button callback. */ +/*---------------------------------------------------------------------------*/ +static void +open_ok (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *filename; + GtkWidget *dlg; + glMDIChild *new_child = NULL; + gint ret; + GnomeRecentModel *recent; + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + /* get the filename */ + filename = g_strdup (gtk_file_selection_get_filename (fsel)); + if (filename) { + if ( gl_file_open_real (filename, GTK_WINDOW(fsel)) ) { + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + } + + g_free (filename); + + gl_debug (DEBUG_FILE, "END"); +} + +/*****************************************************************************/ +/* "Open recent" menu callback. */ +/*****************************************************************************/ +gboolean +gl_file_open_recent (GnomeRecentView *view, + const gchar *filename, + BonoboWindow *win) +{ + gl_debug (DEBUG_FILE, ""); + + return gl_file_open_real (filename, GTK_WINDOW(win)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Open a file. */ +/*---------------------------------------------------------------------------*/ +gboolean +gl_file_open_real (const gchar *filename, + GtkWindow *win) +{ + gchar *abs_filename; + glMDIChild *new_child = NULL; + GtkWidget *dlg; + GnomeRecentModel *recent; + gint ret; + + gl_debug (DEBUG_FILE, "START"); + + abs_filename = gl_util_make_absolute (filename); + new_child = gl_mdi_child_new_with_uri (filename, NULL); + if (!new_child) { + + gl_debug (DEBUG_FILE, "couldn't open file"); + + dlg = gtk_message_dialog_new (GTK_WINDOW(win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Cannot open file '%s'"), + filename); + gtk_dialog_run (GTK_DIALOG (dlg)); + gtk_widget_destroy (dlg); + + g_free (abs_filename); + + gl_debug (DEBUG_FILE, "END false"); + + return FALSE; + + } else { + + ret = bonobo_mdi_add_child (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "Child added."); + + ret = bonobo_mdi_add_view (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "View added."); + + gtk_widget_grab_focus (GTK_WIDGET (glabels_get_active_view ())); + + recent = gl_recent_get_model (); + gnome_recent_model_add (recent, abs_filename); + + if (open_path != NULL) + g_free (open_path); + open_path = g_path_get_dirname (abs_filename); + if (open_path != NULL) + open_path = g_strconcat (open_path, "/", NULL); + + g_free (abs_filename); + + gl_debug (DEBUG_FILE, "END true"); + + return TRUE; + + } +} + +/*****************************************************************************/ +/* "Save" menu callback. */ +/*****************************************************************************/ +gboolean +gl_file_save (glMDIChild *child) +{ + glXMLLabelStatus status; + glLabel *label = NULL; + GError *error = NULL; + gchar *filename = NULL; + GnomeRecentModel *recent; + + gl_debug (DEBUG_FILE, ""); + + g_return_val_if_fail (child != NULL, FALSE); + + label = child->label; + g_return_val_if_fail (label != NULL, FALSE); + + if (gl_label_is_untitled (label)) + { + gl_debug (DEBUG_FILE, "Untitled"); + + return gl_file_save_as (child); + } + + if (!gl_label_is_modified (label)) + { + gl_debug (DEBUG_FILE, "Not modified"); + + return TRUE; + } + + filename = gl_label_get_filename (label); + g_return_val_if_fail (filename != NULL, FALSE); + + gl_xml_label_save (label, filename, &status); + + if (status != XML_LABEL_OK) + { + GtkWidget *dialog; + + gl_debug (DEBUG_FILE, "FAILED"); + + dialog = gtk_message_dialog_new (GTK_WINDOW(glabels_get_active_window()), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Error saving file '%s'"), + filename); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + g_free (filename); + + return FALSE; + } + else + { + gl_debug (DEBUG_FILE, "OK"); + + recent = gl_recent_get_model (); + gnome_recent_model_add (recent, filename); + + g_free (filename); + + return TRUE; + } +} + +/*****************************************************************************/ +/* "Save As" menu callback. */ +/*****************************************************************************/ +gboolean +gl_file_save_as (glMDIChild *child) +{ + GtkFileSelection *fsel; + BonoboWindow *app = glabels_get_active_window (); + gboolean saved_flag = FALSE; + gboolean destroy_flag = FALSE; + + gl_debug (DEBUG_FILE, "START"); + + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (app != NULL, FALSE); + + + fsel = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save label as"))); + gtk_window_set_modal (GTK_WINDOW (fsel), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (fsel), GTK_WINDOW (app)); + + g_object_set_data (G_OBJECT (fsel), "child", child); + g_object_set_data (G_OBJECT (fsel), "saved_flag", &saved_flag); + + g_signal_connect (G_OBJECT (fsel->ok_button), "clicked", + G_CALLBACK (save_as_ok_cb), fsel); + + g_signal_connect (G_OBJECT (fsel->cancel_button), "clicked", + G_CALLBACK (save_as_cancel_cb), fsel); + + g_signal_connect (G_OBJECT (fsel), "destroy", + G_CALLBACK (save_as_destroy_cb), &destroy_flag); + + /* Recover proper state of save-as dialog */ + if (save_path != NULL) { + gtk_file_selection_set_filename (fsel, save_path); + } + + /* show the dialog */ + gtk_widget_show (GTK_WIDGET (fsel)); + + /* Hold here and process events until we are done with this dialog. */ + gtk_main (); + + /* Destroy dialog if not already destroyed. */ + if (!destroy_flag) { + /* Disconnect our destroy callback first, so that we don't kill the + * current gtk_main() loop. */ + g_signal_handlers_disconnect_by_func (GTK_OBJECT (fsel), + G_CALLBACK (save_as_destroy_cb), + &destroy_flag); + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + + gl_debug (DEBUG_FILE, "END"); + + /* Return flag as set by one of the above callbacks, TRUE = saved */ + return saved_flag; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" ok button callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_ok_cb (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *raw_filename, *filename; + GtkWidget *dlg; + glMDIChild *child; + glLabel *label; + glXMLLabelStatus status; + GnomeRecentModel *recent; + gboolean *saved_flag; + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + child = g_object_get_data (G_OBJECT(fsel), "child"); + saved_flag = g_object_get_data (G_OBJECT(fsel), "saved_flag"); + + g_return_if_fail (child != NULL); + g_return_if_fail (GL_IS_MDI_CHILD (child)); + gl_debug (DEBUG_FILE, "Got child"); + + label = child->label; + + /* get the filename */ + raw_filename = g_strdup (gtk_file_selection_get_filename (fsel)); + + gl_debug (DEBUG_FILE, "raw_filename = \"%s\"", raw_filename); + + if (!raw_filename || (raw_filename[strlen (raw_filename) - 1] == '/')) { + + dlg = gtk_message_dialog_new (GTK_WINDOW(fsel), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_CLOSE, + _("Must supply file name")); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + filename = gl_util_add_extension (raw_filename); + + gl_debug (DEBUG_FILE, "filename = \"%s\"", filename); + + gl_xml_label_save (label, filename, &status); + + gl_debug (DEBUG_FILE, "status of save = %d", status); + + if ( status != XML_LABEL_OK ) { + + dlg = gtk_message_dialog_new (GTK_WINDOW(fsel), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Error writing file '%s'"), + filename); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + *saved_flag = TRUE; + + recent = gl_recent_get_model (); + gnome_recent_model_add (recent, filename); + + if (save_path != NULL) + g_free (save_path); + save_path = g_path_get_dirname (filename); + if (save_path != NULL) + save_path = g_strconcat (save_path, "/", NULL); + + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + + g_free (filename); + } + + g_free (raw_filename); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" cancel button callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_cancel_cb (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gboolean *saved_flag = g_object_get_data (G_OBJECT (fsel), "saved_flag"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + *saved_flag = FALSE; + gtk_widget_hide (GTK_WIDGET (fsel)); + gtk_main_quit (); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" destroy callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_destroy_cb (GtkWidget * widget, + gboolean * destroy_flag) +{ + *destroy_flag = TRUE; + gtk_main_quit (); +} + + +/*****************************************************************************/ +/* "Close" menu callback. */ +/*****************************************************************************/ +void +gl_file_close (GtkWidget * view) +{ + gint ret; + BonoboMDIChild* child; + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (view != NULL); + + child = bonobo_mdi_get_child_from_view (view); + g_return_if_fail (child != NULL); + + if (g_list_length (bonobo_mdi_child_get_views (child)) > 1) + { + ret = bonobo_mdi_remove_view (BONOBO_MDI (glabels_mdi), view, FALSE); + gl_debug (DEBUG_FILE, "View removed."); + } + else + { + ret = bonobo_mdi_remove_child (BONOBO_MDI (glabels_mdi), child, FALSE); + gl_debug (DEBUG_FILE, "Child removed."); + } + + if (ret) + gl_mdi_set_active_window_title (BONOBO_MDI (glabels_mdi)); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) == NULL) + { + gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + } + + gl_debug (DEBUG_FILE, "END"); +} + +/*****************************************************************************/ +/* "Close all" */ +/*****************************************************************************/ +gboolean +gl_file_close_all (void) +{ + gboolean ret; + gl_debug (DEBUG_FILE, ""); + + gl_debug (DEBUG_FILE, "START"); + + ret = bonobo_mdi_remove_all (BONOBO_MDI (glabels_mdi), FALSE); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) == NULL) + { + gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + } + + gl_debug (DEBUG_FILE, "END"); + + return ret; +} + +/*****************************************************************************/ +/* "Exit" menu callback. */ +/*****************************************************************************/ +void +gl_file_exit (void) +{ + gl_debug (DEBUG_FILE, ""); + + if (!gl_file_close_all ()) + return; + + gl_debug (DEBUG_FILE, "All files closed."); + + /* We need to disconnect the signal because mdi "destroy" event + is connected to gl_file_exit ( i.e. this function ). */ + g_signal_handlers_disconnect_by_func (G_OBJECT (glabels_mdi), + G_CALLBACK (gl_file_exit), NULL); + + gl_prefs_save_settings (); + + gl_debug (DEBUG_FILE, "Unref glabels_mdi."); + + g_object_unref (G_OBJECT (glabels_mdi)); + + gl_debug (DEBUG_FILE, "Unref glabels_mdi: DONE"); + + gtk_main_quit (); + + gl_debug (DEBUG_FILE, "END"); +} diff --git a/glabels2/src/file.h b/glabels2/src/file.h new file mode 100644 index 00000000..4d3709cb --- /dev/null +++ b/glabels2/src/file.h @@ -0,0 +1,45 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * file.h: FILE menu dialog module header file + * + * Copyright (C) 2000 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __FILE_H__ +#define __FILE_H__ + +#include "mdi-child.h" +#include "gnome-recent-view.h" + +extern void gl_file_new (void); + +extern void gl_file_open (glMDIChild *active_child); +extern gboolean gl_file_open_recent (GnomeRecentView *view, + const gchar *filename, + BonoboWindow *win); +extern gboolean gl_file_open_real (const gchar *filename, + GtkWindow *win); + +extern gboolean gl_file_save (glMDIChild *child); +extern gboolean gl_file_save_as (glMDIChild *child); + +extern void gl_file_close (GtkWidget *view); +extern gboolean gl_file_close_all (void); +extern void gl_file_exit (void); + +#endif /* __FILE_H__ */ diff --git a/glabels2/src/glabels-batch.c b/glabels2/src/glabels-batch.c new file mode 100644 index 00000000..68bfaf8d --- /dev/null +++ b/glabels2/src/glabels-batch.c @@ -0,0 +1,152 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.c: main program module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "merge.h" +#include "xml-label.h" +#include "template.h" +#include "print.h" +#include "util.h" + +/*============================================*/ +/* Private globals */ +/*============================================*/ +static gboolean help_flag = FALSE; +static gboolean version_flag = FALSE; +static gchar *output = "output.ps"; +static gint n_copies = 1; +static gint n_sheets = 1; +static gboolean outline_flag = FALSE; +static gboolean reverse_flag = FALSE; + +static struct poptOption options[] = { + {"help", 'h', POPT_ARG_NONE, &help_flag, 1, + N_("print this message"), NULL}, + {"version", 'v', POPT_ARG_NONE, &version_flag, 0, + N_("print the version of glabels-batch being used"), NULL}, + {"output", 'o', POPT_ARG_STRING, &output, 0, + N_("set output filename (default=\"output.ps\")"), N_("filename")}, + {"sheets", 's', POPT_ARG_INT, &n_sheets, 0, + N_("number of sheets (default=1)"), N_("sheets")}, + {"copies", 'c', POPT_ARG_INT, &n_copies, 0, + N_("number of copies (default=1)"), N_("copies")}, + {"outline", 'l', POPT_ARG_NONE, &outline_flag, 0, + N_("print outlines (to test printer alignment)"), NULL}, + {"reverse", 'r', POPT_ARG_NONE, &reverse_flag, 0, + N_("print in reverse (i.e. a mirror image)"), NULL}, + {NULL, '\0', 0, NULL, 0, NULL, NULL} +}; + + + +/*****************************************************************************/ +/* Main */ +/*****************************************************************************/ +int +main (int argc, + char *argv[]) +{ + poptContext pctx; + gchar **args; + gint rc; + GSList *p, *file_list = NULL; + gint n_files; + GnomePrintMaster *master = NULL; + gchar *abs_fn; + GnomePrintConfig *config = NULL; + glLabel *label = NULL; + glXMLLabelStatus status; + + bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR); + textdomain (PACKAGE); + + gtk_type_init (); + + /* argument parsing */ + pctx = poptGetContext (NULL, argc, argv, options, 0); + poptSetOtherOptionHelp (pctx, _("[OPTION...] GLABELS_FILE...") ); + if ( (rc = poptGetNextOpt(pctx)) < -1 ) { + fprintf (stderr, "%s: %s\n", + poptBadOption (pctx,0), poptStrerror(rc)); + poptPrintUsage (pctx, stderr, 0); + return -1; + } + if ( version_flag ) { + fprintf ( stderr, "glabels-batch %s\n", VERSION ); + } + if ( help_flag ) { + poptPrintHelp (pctx, stderr, 0); + return -1; + } + args = (char **) poptGetArgs (pctx); + for (n_files = 0; args && args[n_files]; n_files++) { + file_list = g_slist_append (file_list, args[n_files]); + } + if ( !n_files ) { + fprintf ( stderr, _("missing glabels file\n") ); + poptPrintHelp (pctx, stderr, 0); + return -1; + } + poptFreeContext (pctx); + + /* initialize components */ + gl_merge_init (); + gl_template_init (); + + /* now print the files */ + for (p = file_list; p; p = p->next) { + gl_xml_label_open (p->data, &status); + if ( status == XML_LABEL_OK ) { + + if ( master == NULL ) { + master = gnome_print_master_new (); + config = gnome_print_master_get_config (master); + abs_fn = gl_util_make_absolute ( output ); + gnome_print_config_set (config, + GNOME_PRINT_KEY_OUTPUT_FILENAME, + abs_fn); + g_free( abs_fn ); + } + + gl_print_batch( master, label, n_sheets, n_copies, + outline_flag, reverse_flag ); + + g_object_unref( label ); + } + else { + fprintf ( stderr, _("cannot open glabels file %s\n"), + (char *)p->data ); + } + } + if ( master != NULL ) { + gnome_print_master_print (master); + } + + g_slist_free (file_list); + + return 0; +} + diff --git a/glabels2/src/glabels-ui.xml b/glabels2/src/glabels-ui.xml new file mode 100644 index 00000000..836a082b --- /dev/null +++ b/glabels2/src/glabels-ui.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/glabels2/src/glabels.c b/glabels2/src/glabels.c new file mode 100644 index 00000000..c402fc61 --- /dev/null +++ b/glabels2/src/glabels.c @@ -0,0 +1,230 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.c: GLabels main module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit2.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#include + +#include +#include +#include + +#include "glabels.h" +#include "splash.h" +#include "stock.h" +#include "merge.h" +#include "template.h" +#include "mdi.h" +#include "prefs.h" +#include "file.h" +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define ICON_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-icon.png") +#else +#define ICON_PIXMAP gnome_pixmap_file("glabels/glabels-icon.png") +#endif + +glMDI *glabels_mdi = NULL; +gboolean glabels_close_x_button_pressed = FALSE; +gboolean glabels_exit_button_pressed = FALSE; + +static const struct poptOption options [] = +{ + { "debug-view", '\0', POPT_ARG_NONE, &gl_debug_view, 0, + N_("Show view debugging messages."), NULL }, + + { "debug-item", '\0', POPT_ARG_NONE, &gl_debug_item, 0, + N_("Show item debugging messages."), NULL }, + + { "debug-print", '\0', POPT_ARG_NONE, &gl_debug_print, 0, + N_("Show printing debugging messages."), NULL }, + + { "debug-prefs", '\0', POPT_ARG_NONE, &gl_debug_prefs, 0, + N_("Show prefs debugging messages."), NULL }, + + { "debug-file", '\0', POPT_ARG_NONE, &gl_debug_file, 0, + N_("Show file debugging messages."), NULL }, + + { "debug-label", '\0', POPT_ARG_NONE, &gl_debug_label, 0, + N_("Show document debugging messages."), NULL }, + + { "debug-template", '\0', POPT_ARG_NONE, &gl_debug_template, 0, + N_("Show template debugging messages."), NULL }, + + { "debug-xml", '\0', POPT_ARG_NONE, &gl_debug_xml, 0, + N_("Show xml debugging messages."), NULL }, + + { "debug-merge", '\0', POPT_ARG_NONE, &gl_debug_merge, 0, + N_("Show document merge debugging messages."), NULL }, + + { "debug-commands", '\0', POPT_ARG_NONE, &gl_debug_commands, 0, + N_("Show commands debugging messages."), NULL }, + + { "debug-undo", '\0', POPT_ARG_NONE, &gl_debug_undo, 0, + N_("Show undo debugging messages."), NULL }, + + { "debug-recent", '\0', POPT_ARG_NONE, &gl_debug_recent, 0, + N_("Show recent debugging messages."), NULL }, + + { "debug-mdi", '\0', POPT_ARG_NONE, &gl_debug_mdi, 0, + N_("Show mdi debugging messages."), NULL }, + + { "debug-media-select", '\0', POPT_ARG_NONE, &gl_debug_media_select, 0, + N_("Show media select widget debugging messages."), NULL }, + + { "debug-mini-preview", '\0', POPT_ARG_NONE, &gl_debug_mini_preview, 0, + N_("Show mini preview widget debugging messages."), NULL }, + + { "debug-wdgt", '\0', POPT_ARG_NONE, &gl_debug_wdgt, 0, + N_("Show widget debugging messages."), NULL }, + + { "debug", '\0', POPT_ARG_NONE, &gl_debug_all, 0, + N_("Turn on all debugging messages."), NULL }, + + {NULL, '\0', 0, NULL, 0} +}; + + +int +main (int argc, char **argv) +{ + GValue value = { 0, }; + GnomeProgram *program; + poptContext ctx; + char **args; + GList *file_list = NULL, *p; + gint i; + + bindtextdomain (GETTEXT_PACKAGE, GLABELS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + /* Initialize gnome program */ + program = gnome_program_init ("glabels", VERSION, + LIBGNOMEUI_MODULE, argc, argv, + GNOME_PARAM_POPT_TABLE, options, + NULL); + + /* Splash screen */ + gl_splash (); + + gl_stock_init(); + + /* Set default icon */ + if (!g_file_test (ICON_PIXMAP, G_FILE_TEST_EXISTS)) + { + g_warning ("Could not find %s", ICON_PIXMAP); + } + else + { + gnome_window_icon_set_default_from_file (ICON_PIXMAP); + } + + /* Load user preferences */ + gl_prefs_init (); + gl_prefs_load_settings (); + + gl_template_init(); + gl_merge_init(); + gl_merge_ui_init(); + gl_recent_init(); + + /* Parse args and build the list of files to be loaded at startup */ + g_value_init (&value, G_TYPE_POINTER); + g_object_get_property (G_OBJECT (program), + GNOME_PARAM_POPT_CONTEXT, &value); + ctx = g_value_get_pointer (&value); + g_value_unset (&value); + args = (char**) poptGetArgs(ctx); + for (i = 0; args && args[i]; i++) + { + file_list = g_list_append (file_list, args[i]); + } + + /* Create glabels_mdi and open the first top level window */ + glabels_mdi = gl_mdi_new (); + bonobo_mdi_open_toplevel (BONOBO_MDI (glabels_mdi), NULL); + + for (p = file_list; p; p = p->next) { + gl_file_open_real (p->data, + GTK_WINDOW(glabels_get_active_window())); + } + g_list_free (file_list); + + gtk_main(); + + return 0; +} + + +BonoboWindow* +glabels_get_active_window (void) +{ + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + return bonobo_mdi_get_active_window (BONOBO_MDI (glabels_mdi)); +} + +glLabel* +glabels_get_active_label (void) +{ + BonoboMDIChild *active_child; + + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + active_child = bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)); + + if (active_child == NULL) + return NULL; + + return GL_MDI_CHILD (active_child)->label; +} + +glView* +glabels_get_active_view (void) +{ + GtkWidget *active_view; + + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + active_view = bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi)); + + if (active_view == NULL) + return NULL; + + return GL_VIEW (active_view); +} + +GList* +glabels_get_top_windows (void) +{ + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + return bonobo_mdi_get_windows (BONOBO_MDI (glabels_mdi)); +} + diff --git a/glabels2/src/glabels.h b/glabels2/src/glabels.h new file mode 100644 index 00000000..2d633c5b --- /dev/null +++ b/glabels2/src/glabels.h @@ -0,0 +1,54 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.h: GLabels main module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#ifndef __GLABELS_H__ +#define __GLABELS_H__ + +#include +#include +#include + +#include "mdi.h" +#include "label.h" +#include "view.h" + +extern glMDI* glabels_mdi; +extern gboolean glabels_close_x_button_pressed; +extern gboolean glabels_exit_button_pressed; + +BonoboWindow* glabels_get_active_window (void); +glLabel* glabels_get_active_label (void); +glView* glabels_get_active_view (void); +GList* glabels_get_top_windows (void); + + +#endif /* __GLABELS_H__ */ + + + diff --git a/glabels2/src/gnome-recent-marshal.list b/glabels2/src/gnome-recent-marshal.list new file mode 100644 index 00000000..1e99a95a --- /dev/null +++ b/glabels2/src/gnome-recent-marshal.list @@ -0,0 +1 @@ +BOOL:STRING diff --git a/glabels2/src/gnome-recent-model.c b/glabels2/src/gnome-recent-model.c new file mode 100644 index 00000000..9c02705e --- /dev/null +++ b/glabels2/src/gnome-recent-model.c @@ -0,0 +1,771 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/** + * 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 of the + * License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: + * James Willcox + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include "gnome-recent-model.h" +#include "gnome-recent-view.h" + +#define GNOME_RECENT_MODEL_BASE_KEY "/desktop/gnome/recent_files" +#define GNOME_RECENT_MODEL_GLOBAL_LIMIT_KEY "global_limit" +#define GNOME_RECENT_MODEL_GLOBAL_LIMIT_ENV "GNOME_RECENT_MODEL_GLOBAL_LIMIT" +#define GNOME_RECENT_MODEL_GLOBAL_LIST "gnome-recent-global" + +static void gnome_recent_model_class_init (GnomeRecentModelClass * klass); +static void gnome_recent_model_init (GnomeRecentModel * recent); +static gchar *gnome_recent_model_gconf_key (GnomeRecentModel * recent); +static void gnome_recent_model_notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data); +static GSList * gnome_recent_model_delete_from_list (GnomeRecentModel *recent, + GSList *list, + const gchar *uri); +static GSList * gnome_recent_model_gconf_to_list (GConfValue* value); +static void gnome_recent_model_g_slist_deep_free (GSList *list); +static void gnome_recent_model_set_appname (GnomeRecentModel *recent, gchar *appname); + +struct _GnomeRecentModel { + GObject parent_instance; /* We emit signals */ + + gchar *appname; /* the app that owns this object */ + GConfClient *gconf_client; /* we use GConf to store stuff */ + unsigned int limit; /* maximum number of items to store */ + + GnomeRecentModel *global; /* Another GnomeRecentModel object, + * representing the global + * recent uri list + */ + + GHashTable *monitors; /* A hash table holding + * GnomeVfsMonitorHandle objects. + */ +}; + +struct _GnomeRecentModelClass { + GObjectClass parent_class; + + void (*changed) (GnomeRecentModel *recent, const GSList *list); +}; + +struct _GnomeRecentModelMenuData { + GnomeRecentModel *recent; + gchar *uri; +}; + +typedef struct _GnomeRecentModelMenuData GnomeRecentModelMenuData; + +enum { + CHANGED, + LAST_SIGNAL +}; + +/* GObject properties */ +enum { + PROP_BOGUS, + PROP_APPNAME, + PROP_LIMIT, +}; + +static GType model_signals[LAST_SIGNAL] = { 0 }; +static GObjectClass *parent_class = NULL; + +/** + * gnome_recent_model_get_type: + * @: + * + * This returns a GType representing a GnomeRecentModel object. + * + * Returns: a GType + */ +GType +gnome_recent_model_get_type (void) +{ + static GType gnome_recent_model_type = 0; + + if(!gnome_recent_model_type) { + static const GTypeInfo gnome_recent_model_info = { + sizeof (GnomeRecentModelClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc)gnome_recent_model_class_init, /* class init */ + NULL, /* class finalize */ + NULL, /* class data */ + sizeof (GnomeRecentModel), + 0, + (GInstanceInitFunc) gnome_recent_model_init + }; + + gnome_recent_model_type = g_type_register_static (G_TYPE_OBJECT, + "GnomeRecentModel", + &gnome_recent_model_info, 0); + } + + return gnome_recent_model_type; +} + +static void +gnome_recent_model_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeRecentModel *recent = GNOME_RECENT_MODEL (object); + gchar *appname; + + switch (prop_id) + { + case PROP_APPNAME: + appname = g_strdup (g_value_get_string (value)); + gnome_recent_model_set_appname (recent, appname); + break; + case PROP_LIMIT: + gnome_recent_model_set_limit (GNOME_RECENT_MODEL (recent), + g_value_get_int (value)); + break; + default: + break; + } +} + +static void +gnome_recent_model_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GnomeRecentModel *recent = GNOME_RECENT_MODEL (object); + + switch (prop_id) + { + case PROP_APPNAME: + g_value_set_string (value, recent->appname); + break; + case PROP_LIMIT: + g_value_set_int (value, recent->limit); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gnome_recent_model_class_init (GnomeRecentModelClass * klass) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->set_property = gnome_recent_model_set_property; + object_class->get_property = gnome_recent_model_get_property; + + model_signals[CHANGED] = g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeRecentModelClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + + g_object_class_install_property (object_class, + PROP_APPNAME, + g_param_spec_string ("appname", + "Application Name", + "The name of the application using this object.", + "gnome-app", + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_LIMIT, + g_param_spec_int ("limit", + "Limit", + "The maximum number of items to be allowed in the list.", + 1, + 1000, + 10, + G_PARAM_READWRITE)); + + klass->changed = NULL; +} + + +static void +gnome_recent_model_init (GnomeRecentModel * recent) +{ + int argc=0; + char **argv=NULL; + + if (!gconf_init (argc, argv, NULL)) + { + g_warning ("GConf Initialization failed."); + return; + } + + if (!gnome_vfs_init ()) { + g_warning ("gnome-vfs initialization failed."); + return; + } + + recent->gconf_client = gconf_client_get_default (); + recent->monitors = g_hash_table_new (g_str_hash, g_str_equal); +} + +static gint +gnome_recent_model_get_global_limit (GnomeRecentModel *model) +{ + char *key; + gint limit; + + key = g_strdup_printf ("%s/%s", GNOME_RECENT_MODEL_BASE_KEY, + GNOME_RECENT_MODEL_GLOBAL_LIMIT_KEY); + + + limit = gconf_client_get_int (model->gconf_client, + key, NULL); + + if (limit <= 0) { + /* ok, gconf schemas are not functioning, so assign a sane value */ + limit = 10; + } + + g_free (key); + + return limit; +} + + +/** + * gnome_recent_model_new: + * @appname: The name of your application. + * @limit: The maximum number of items allowed. + * + * This creates a new GnomeRecentModel object. + * + * Returns: a GnomeRecentModel object + */ +GnomeRecentModel * +gnome_recent_model_new (const gchar *appname, gint limit) +{ + GnomeRecentModel *model; + + g_return_val_if_fail (appname, NULL); + g_return_val_if_fail (limit > 0, NULL); + + model = GNOME_RECENT_MODEL (g_object_new (gnome_recent_model_get_type (), + "appname", + appname, + "limit", + limit, NULL)); + + g_return_val_if_fail (model, NULL); + + return model; +} + +/** + * gnome_recent_model_new_global: + * @ + * + * This creates a new GnomeRecentModel object, with the global history list. + * + * Returns: a GnomeRecentModel object + */ +GnomeRecentModel * +gnome_recent_model_new_global (void) +{ + GnomeRecentModel *model; + gint limit; + + model = GNOME_RECENT_MODEL (g_object_new(gnome_recent_model_get_type (), + "appname", + GNOME_RECENT_MODEL_GLOBAL_LIST, + NULL)); + + g_return_val_if_fail (model, NULL); + + limit = gnome_recent_model_get_global_limit (model); + gnome_recent_model_set_limit (model, limit); + + return model; +} + + + +static void +gnome_recent_model_monitor_cb (GnomeVFSMonitorHandle *handle, + const gchar *monitor_uri, + const gchar *info_uri, + GnomeVFSMonitorEventType event_type, + gpointer data) +{ + GnomeRecentModel *recent= GNOME_RECENT_MODEL (data); + + g_return_if_fail (recent); + + /* if a file was deleted, we just remove it from our list */ + switch (event_type) { + case GNOME_VFS_MONITOR_EVENT_DELETED: + gnome_recent_model_delete (recent, monitor_uri); + g_hash_table_remove (recent->monitors, monitor_uri); + break; + default: + break; + } + +} + +static void +gnome_recent_model_monitor_uri (GnomeRecentModel *recent, const gchar *uri) +{ + GnomeVFSMonitorHandle *handle=NULL; + GnomeVFSResult result; + + g_return_if_fail (recent); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + g_return_if_fail (uri); + + handle = g_hash_table_lookup (recent->monitors, uri); + if (handle == NULL) { + + /* this is a new uri, so we need to monitor it */ + result = gnome_vfs_monitor_add (&handle, + uri, + GNOME_VFS_MONITOR_FILE, + gnome_recent_model_monitor_cb, + recent); + if (result == GNOME_VFS_OK) { + g_hash_table_insert (recent->monitors, + g_strdup (uri), + handle); + } + } +} + +static void +gnome_recent_model_monitor_uri_list (GnomeRecentModel *recent, + GSList *list) +{ + GSList *p; + const gchar *uri; + + p = list; + while (p != NULL) { + uri = (const gchar *)p->data; + + gnome_recent_model_monitor_uri (recent, uri); + + p = p->next; + } +} + +#if 0 +static void +gnome_recent_model_monitor_cancel (GnomeRecentModel *recent, const gchar *uri) +{ + g_return_if_fail (recent); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + g_return_if_fail (uri); + + g_hash_table_remove (recent->monitors, uri); +} +#endif + +/** + * gnome_recent_model_add: + * @recent: A GnomeRecentModel object. + * @uri: The URI you want to add to the list. + * + * This function adds a URI to the list of recently used URIs. + * + * Returns: a gboolean + */ +gboolean +gnome_recent_model_add (GnomeRecentModel * recent, const gchar * uri) +{ + GSList *uri_lst; + gchar *gconf_key; + + g_return_val_if_fail (recent, FALSE); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), FALSE); + g_return_val_if_fail (recent->gconf_client, FALSE); + g_return_val_if_fail (uri, FALSE); + + gconf_key = gnome_recent_model_gconf_key (recent); + + + uri_lst = gconf_client_get_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, NULL); + + /* if this is already in our list, remove it */ + uri_lst = gnome_recent_model_delete_from_list (recent, uri_lst, uri); + + /* prepend the new one */ + uri_lst = g_slist_prepend (uri_lst, g_strdup (uri)); + + /* if we're over the limit, delete from the end */ + while (g_slist_length (uri_lst) > recent->limit) + { + gchar *tmp_uri; + tmp_uri = g_slist_nth_data (uri_lst, g_slist_length (uri_lst)-1); + uri_lst = g_slist_remove (uri_lst, tmp_uri); + g_free (tmp_uri); + } + + gconf_client_set_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, + uri_lst, NULL); + + gconf_client_suggest_sync (recent->gconf_client, NULL); + + /* add to the global list */ + if (recent->global) + gnome_recent_model_add (GNOME_RECENT_MODEL (recent->global), uri); + + g_free (gconf_key); + gnome_recent_model_g_slist_deep_free (uri_lst); + + return TRUE; +} + + +/** + * gnome_recent_model_delete: + * @recent: A GnomeRecentModel object. + * @uri: The URI you want to delete from the list. + * + * This function deletes a URI from the list of recently used URIs. + * + * Returns: a gboolean + */ +gboolean +gnome_recent_model_delete (GnomeRecentModel * recent, const gchar * uri) +{ + GSList *uri_lst; + GSList *new_uri_lst; + gboolean ret = FALSE; + gchar *gconf_key; + + g_return_val_if_fail (recent, FALSE); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), FALSE); + g_return_val_if_fail (recent->gconf_client, FALSE); + g_return_val_if_fail (uri, FALSE); + + gconf_key = gnome_recent_model_gconf_key (recent); + uri_lst = gconf_client_get_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, NULL); + + new_uri_lst = gnome_recent_model_delete_from_list (recent, uri_lst, uri); + + /* if it wasn't deleted, no need to cause unneeded updates */ + /* + if (new_uri_lst == uri_lst) { + return FALSE; + } + else + uri_lst = new_uri_lst; + */ + + /* delete it from gconf */ + gconf_client_set_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, + new_uri_lst, + NULL); + gconf_client_suggest_sync (recent->gconf_client, NULL); + + /* delete from the global list */ + if (recent->global) + gnome_recent_model_delete (GNOME_RECENT_MODEL (recent->global), uri); + + + g_free (gconf_key); + gnome_recent_model_g_slist_deep_free (new_uri_lst); + + return ret; +} + +/** + * gnome_recent_model_get_list: + * @recent: A GnomeRecentModel object. + * + * This returns a linked list of strings (URIs) currently held + * by this object. + * + * Returns: A GSList * + */ +GSList * +gnome_recent_model_get_list (GnomeRecentModel * recent) +{ + GSList *uri_lst; + gchar *gconf_key = gnome_recent_model_gconf_key (recent); + + g_return_val_if_fail (recent, NULL); + g_return_val_if_fail (recent->gconf_client, NULL); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), NULL); + + uri_lst = gconf_client_get_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, NULL); + + g_free (gconf_key); + + /* FIXME: This sucks. */ + gnome_recent_model_monitor_uri_list (recent, uri_lst); + + return uri_lst; +} + + + +/** + * gnome_recent_model_set_limit: + * @recent: A GnomeRecentModel object. + * @limit: The maximum number of items allowed in the list. + * + * Use this function to constrain the number of items allowed in the list. + * The default is %GNOME_RECENT_MODEL_DEFAULT_LIMIT. + * + */ +void +gnome_recent_model_set_limit (GnomeRecentModel *recent, gint limit) +{ + GSList *list; + int len; + unsigned int i; + + g_return_if_fail (recent); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + g_return_if_fail (limit > 0); + recent->limit = limit; + + list = gnome_recent_model_get_list (recent); + len = g_slist_length (list); + + if (len <= limit) return; + + /* if we're over the limit, delete from the end */ + i=g_slist_length (list); + while (i > recent->limit) + { + gchar *uri = g_slist_nth_data (list, i-1); + gnome_recent_model_delete (recent, uri); + + i--; + } + + gnome_recent_model_g_slist_deep_free (list); +} + + +/** + * gnome_recent_model_get_limit: + * @recent: A GnomeRecentModel object. + * + */ +gint +gnome_recent_model_get_limit (GnomeRecentModel *recent) +{ + g_return_val_if_fail (recent, -1); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), -1); + + return recent->limit; +} + + +/** + * gnome_recent_model_clear: + * @recent: A GnomeRecentModel object. + * + * This function clears the list of recently used URIs. + * + */ +void +gnome_recent_model_clear (GnomeRecentModel *recent) +{ + gchar *key; + + g_return_if_fail (recent); + g_return_if_fail (recent->gconf_client); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + + key = gnome_recent_model_gconf_key (recent); + + gconf_client_unset (recent->gconf_client, key, NULL); +} + +static void +gnome_recent_model_set_appname (GnomeRecentModel *recent, gchar *appname) +{ + gchar *key; + gint notify_id; + + g_return_if_fail (recent); + g_return_if_fail (appname); + + recent->appname = appname; + + /* if this isn't the global list embed a global one */ + if (strcmp (appname, GNOME_RECENT_MODEL_GLOBAL_LIST)) { + recent->global = gnome_recent_model_new_global (); + } + + /* Set up the gconf notification stuff */ + key = gnome_recent_model_gconf_key (recent); + gconf_client_add_dir (recent->gconf_client, + GNOME_RECENT_MODEL_BASE_KEY, GCONF_CLIENT_PRELOAD_NONE, NULL); + notify_id = gconf_client_notify_add (recent->gconf_client, + key, + gnome_recent_model_notify_cb, + recent, NULL, NULL); + + + + g_free (key); +} + +static GSList * +gnome_recent_model_delete_from_list (GnomeRecentModel *recent, GSList *list, + const gchar *uri) +{ + unsigned int i; + gchar *text; + + for (i = 0; i < g_slist_length (list); i++) { + text = g_slist_nth_data (list, i); + + if (!strcmp (text, uri)) { + list = g_slist_remove (list, text); + g_free (text); + } + } + + return list; +} + +/* this takes a list of GConfValues, and returns a list of strings */ +static GSList * +gnome_recent_model_gconf_to_list (GConfValue* value) +{ + GSList* iter; + GSList *list = NULL; + + g_return_val_if_fail (value, NULL); + + iter = gconf_value_get_list(value); + + while (iter != NULL) + { + GConfValue* element = iter->data; + gchar *text = g_strdup (gconf_value_get_string (element)); + + list = g_slist_prepend (list, text); + + iter = g_slist_next(iter); + } + + list = g_slist_reverse (list); + + return list; +} + +static void +gnome_recent_model_g_slist_deep_free (GSList *list) +{ + GSList *lst; + + if (list == NULL) + return; + + lst = list; + while (lst) { + g_free (lst->data); + lst->data = NULL; + lst = lst->next; + } + + g_slist_free (list); +} + +static gchar * +gnome_recent_model_gconf_key (GnomeRecentModel * model) +{ + gchar *key; + + g_return_val_if_fail (model, NULL); + + key = g_strdup_printf ("%s/%s", GNOME_RECENT_MODEL_BASE_KEY, model->appname); + return key; +} + +/* +static void +print_list (GSList *list) +{ + while (list) { + g_print ("%s, ", (char *)list->data); + + list = list->next; + } + g_print ("\n\n"); +} +*/ + +/* this is the gconf notification callback. */ +static void +gnome_recent_model_notify_cb (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + GSList *list=NULL; + GnomeRecentModel *recent = user_data; + + if (entry->value == NULL) { + g_signal_emit (G_OBJECT(recent), model_signals[CHANGED], 0, NULL); + return; + } + + list = gnome_recent_model_gconf_to_list (entry->value); + + gnome_recent_model_monitor_uri_list (recent, list); + + g_signal_emit (G_OBJECT(recent), model_signals[CHANGED], 0, list); + + gnome_recent_model_g_slist_deep_free (list); +} + + +gchar * +gnome_recent_model_get_appname (GnomeRecentModel *model) +{ + return g_strdup (model->appname); +} diff --git a/glabels2/src/gnome-recent-model.h b/glabels2/src/gnome-recent-model.h new file mode 100644 index 00000000..1ccc67dd --- /dev/null +++ b/glabels2/src/gnome-recent-model.h @@ -0,0 +1,40 @@ +/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +#ifndef __GNOME_RECENT_MODEL_H__ +#define __GNOME_RECENT_MODEL_H__ + +#include + +G_BEGIN_DECLS + +#define GNOME_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnome_recent_model_get_type (), GnomeRecentModel) +#define GNOME_RECENT_MODEL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnome_recent_model_get_type (), GnomeRecentModelClass) +#define GNOME_IS_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnome_recent_model_get_type ()) + +typedef struct _GnomeRecentModel GnomeRecentModel; + +typedef struct _GnomeRecentModelClass GnomeRecentModelClass; + +GType gnome_recent_model_get_type (void); + +/* constructors */ +GnomeRecentModel * gnome_recent_model_new (const gchar *appname, + gint limit); +GnomeRecentModel * gnome_recent_model_new_global (void); + + + +/* public methods */ +gboolean gnome_recent_model_add (GnomeRecentModel *recent, + const gchar *uri); +gboolean gnome_recent_model_delete (GnomeRecentModel *recent, + const gchar *uri); +void gnome_recent_model_clear (GnomeRecentModel *recent); +GSList * gnome_recent_model_get_list (GnomeRecentModel *recent); +void gnome_recent_model_set_limit (GnomeRecentModel *recent, + gint limit); +gint gnome_recent_model_get_limit (GnomeRecentModel *recent); +gchar *gnome_recent_model_get_appname (GnomeRecentModel *recent); + +G_END_DECLS + +#endif /* __GNOME_RECENT_MODEL_H__ */ diff --git a/glabels2/src/gnome-recent-util.c b/glabels2/src/gnome-recent-util.c new file mode 100644 index 00000000..c8988767 --- /dev/null +++ b/glabels2/src/gnome-recent-util.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include "gnome-recent-util.h" + +/* ripped out of gedit2 */ +gchar* +gnome_recent_util_escape_underlines (const gchar* text) +{ + GString *str; + gint length; + const gchar *p; + const gchar *end; + + g_return_val_if_fail (text != NULL, NULL); + + length = strlen (text); + + str = g_string_new (""); + + p = text; + end = text + length; + + while (p != end) + { + const gchar *next; + next = g_utf8_next_char (p); + + switch (*p) + { + case '_': + g_string_append (str, "__"); + break; + default: + g_string_append_len (str, p, next - p); + break; + } + + p = next; + } + + return g_string_free (str, FALSE); +} diff --git a/glabels2/src/gnome-recent-util.h b/glabels2/src/gnome-recent-util.h new file mode 100644 index 00000000..989c8306 --- /dev/null +++ b/glabels2/src/gnome-recent-util.h @@ -0,0 +1,9 @@ + +G_BEGIN_DECLS + + +gchar *gnome_recent_util_escape_underlines (const gchar *uri); + + + +G_END_DECLS diff --git a/glabels2/src/gnome-recent-view-bonobo.c b/glabels2/src/gnome-recent-view-bonobo.c new file mode 100644 index 00000000..f5a015c1 --- /dev/null +++ b/glabels2/src/gnome-recent-view-bonobo.c @@ -0,0 +1,500 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/** + * 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 of the + * License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: + * James Willcox + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include "gnome-recent-model.h" +#include "gnome-recent-view.h" +#include "gnome-recent-view-bonobo.h" +#include "gnome-recent-util.h" +#include "gnome-recent-marshal.h" + +#define GNOME_RECENT_VERB_NAME "-uri-" + +struct _GnomeRecentViewBonobo { + GObject parent_instance; /* We emit signals */ + + BonoboUIComponent *uic; + gchar *path; /* The menu path where our stuff + * will go + */ + + gulong changed_cb_id; + + GnomeRecentModel *model; +}; + +struct _GnomeRecentViewBonoboClass { + GObjectClass parent_class; + + void (*activate) (GnomeRecentViewBonobo *view, const gchar *uri); +}; + +struct _GnomeRecentViewBonoboMenuData { + GnomeRecentViewBonobo *view; + gchar *uri; +}; + +typedef struct _GnomeRecentViewBonoboMenuData GnomeRecentViewBonoboMenuData; + +enum { + ACTIVATE, + LAST_SIGNAL +}; + +/* GObject properties */ +enum { + PROP_BOGUS, + PROP_UI_COMPONENT, + PROP_MENU_PATH +}; + +static guint gnome_recent_view_bonobo_signals[LAST_SIGNAL] = { 0 }; + +static void +gnome_recent_view_bonobo_clear (GnomeRecentView *view_parent) +{ + gint i=1; + gboolean done=FALSE; + gchar *appname; + GnomeRecentModel *model; + GnomeRecentViewBonobo *view; + + g_return_if_fail (view_parent); + view = GNOME_RECENT_VIEW_BONOBO (view_parent); + g_return_if_fail (view->uic); + + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (view)); + appname = gnome_recent_model_get_appname (model); + + while (!done) + { + gchar *verb_name = g_strdup_printf ("%s%s%d", appname,GNOME_RECENT_VERB_NAME, i); + gchar *item_path = g_strconcat (view->path, "/", verb_name, NULL); + if (bonobo_ui_component_path_exists (view->uic, item_path, NULL)) + bonobo_ui_component_rm (view->uic, item_path, NULL); + else + done=TRUE; + + g_free (item_path); + g_free (verb_name); + + i++; + } + + g_free (appname); +} + +static void +gnome_recent_view_bonobo_menu_cb (BonoboUIComponent *uic, gpointer data, const char *cname) +{ + gboolean ret; + GnomeRecentViewBonoboMenuData *md = (GnomeRecentViewBonoboMenuData *) data; + GnomeRecentModel *model; + + g_return_if_fail (md); + g_return_if_fail (md->uri); + g_return_if_fail (md->view); + g_return_if_fail (GNOME_IS_RECENT_VIEW_BONOBO (md->view)); + + ret = FALSE; + g_signal_emit (G_OBJECT(md->view), + gnome_recent_view_bonobo_signals[ACTIVATE], 0, + md->uri, &ret); + + if (!ret) { + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (md->view)); + gnome_recent_model_delete (model, md->uri); + } +} + +static void +gnome_recent_view_bonobo_menu_data_destroy_cb (gpointer data, GClosure *closure) +{ + GnomeRecentViewBonoboMenuData *md = data; + + g_free (md->uri); + g_free (md); +} + + +static void +gnome_recent_view_bonobo_set_list (GnomeRecentViewBonobo *view, GSList *list) +{ + BonoboUIComponent* ui_component; + unsigned int i; + gchar *label = NULL; + gchar *verb_name = NULL; + gchar *tip = NULL; + gchar *escaped_name = NULL; + gchar *item_path = NULL; + gchar *uri; + gchar *cmd; + gchar *appname; + GnomeRecentViewBonoboMenuData *md; + GnomeRecentModel *model; + GClosure *closure; + + g_return_if_fail (view); + + ui_component = view->uic; + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (view)); + appname = gnome_recent_model_get_appname (model); + + gnome_recent_view_bonobo_clear (GNOME_RECENT_VIEW (view)); + + bonobo_ui_component_freeze (ui_component, NULL); + + for (i = 1; i <= g_slist_length (list); ++i) + { + + /* this is what gets passed to our private "activate" callback */ + md = (GnomeRecentViewBonoboMenuData *)g_malloc (sizeof (GnomeRecentViewBonoboMenuData)); + md->view = view; + md->uri = g_strdup (g_slist_nth_data (list, i-1)); + + /* Maybe we should use a gnome-vfs call here?? */ + uri = g_path_get_basename (g_slist_nth_data (list, i - 1)); + + escaped_name = gnome_recent_util_escape_underlines (uri); + + tip = g_strdup_printf (_("Open %s"), uri); + + verb_name = g_strdup_printf ("%s%s%d", appname,GNOME_RECENT_VERB_NAME, i); + cmd = g_strdup_printf (" ", verb_name); + bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL); + + closure = g_cclosure_new (G_CALLBACK (gnome_recent_view_bonobo_menu_cb), + md, gnome_recent_view_bonobo_menu_data_destroy_cb); + + bonobo_ui_component_add_verb_full (ui_component, verb_name, + closure); + + if (i < 10) + label = g_strdup_printf ("_%d. %s", i, escaped_name); + else + label = g_strdup_printf ("%d. %s", i, escaped_name); + + + + item_path = g_strconcat (view->path, "/", verb_name, NULL); + + if (bonobo_ui_component_path_exists (ui_component, item_path, NULL)) + { + bonobo_ui_component_set_prop (ui_component, item_path, + "label", label, NULL); + + bonobo_ui_component_set_prop (ui_component, item_path, + "tip", tip, NULL); + } + else + { + gchar *xml; + + xml = g_strdup_printf ("", + verb_name, verb_name, label, + tip); + + bonobo_ui_component_set_translate (ui_component, view->path, xml, NULL); + + g_free (xml); + } + + g_free (label); + g_free (verb_name); + g_free (tip); + g_free (escaped_name); + g_free (item_path); + g_free (uri); + g_free (cmd); + } + + + bonobo_ui_component_thaw (ui_component, NULL); +} + +static void +model_changed_cb (GnomeRecentModel *model, GSList *list, GnomeRecentViewBonobo *view) +{ + gnome_recent_view_bonobo_set_list (view, list); +} + + + +static void +gnome_recent_view_bonobo_populate (GnomeRecentViewBonobo *view) +{ + GnomeRecentModel *model; + GSList *list; + + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (view)); + list = gnome_recent_model_get_list (model); + + gnome_recent_view_bonobo_set_list (view, list); +} + +static GnomeRecentModel * +gnome_recent_view_bonobo_get_model (GnomeRecentView *view_parent) +{ + GnomeRecentViewBonobo *view; + + g_return_val_if_fail (view_parent, NULL); + view = GNOME_RECENT_VIEW_BONOBO (view_parent); + + return view->model; +} + +static void +gnome_recent_view_bonobo_set_model (GnomeRecentView *view_parent, GnomeRecentModel *model) +{ + GnomeRecentViewBonobo *view; + + g_return_if_fail (view_parent); + view = GNOME_RECENT_VIEW_BONOBO (view_parent); + + if (view->model) + g_signal_handler_disconnect (G_OBJECT (view->model), + view->changed_cb_id); + + view->model = model; + view->changed_cb_id = g_signal_connect (G_OBJECT (model), "changed", + G_CALLBACK (model_changed_cb), view); + + gnome_recent_view_bonobo_populate (view); +} + +static void +gnome_recent_view_bonobo_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeRecentViewBonobo *view = GNOME_RECENT_VIEW_BONOBO (object); + + switch (prop_id) + { + case PROP_UI_COMPONENT: + gnome_recent_view_bonobo_set_ui_component (GNOME_RECENT_VIEW_BONOBO (view), + BONOBO_UI_COMPONENT (g_value_get_object (value))); + break; + case PROP_MENU_PATH: + view->path = g_strdup (g_value_get_string (value)); + break; + default: + break; + } +} + +static void +gnome_recent_view_bonobo_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GnomeRecentViewBonobo *view = GNOME_RECENT_VIEW_BONOBO (object); + + switch (prop_id) + { + case PROP_UI_COMPONENT: + g_value_set_pointer (value, view->uic); + break; + case PROP_MENU_PATH: + g_value_set_string (value, g_strdup (view->path)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gnome_recent_view_bonobo_class_init (GnomeRecentViewBonoboClass * klass) +{ + GObjectClass *object_class; + + + object_class = G_OBJECT_CLASS (klass); + + object_class->set_property = gnome_recent_view_bonobo_set_property; + object_class->get_property = gnome_recent_view_bonobo_get_property; + + gnome_recent_view_bonobo_signals[ACTIVATE] = g_signal_new ("activate", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeRecentViewBonoboClass, activate), + NULL, NULL, + gnome_recent_BOOLEAN__STRING, + G_TYPE_BOOLEAN, 1, + G_TYPE_STRING); + + g_object_class_install_property (object_class, + PROP_UI_COMPONENT, + g_param_spec_object ("ui-component", + "UI Component", + "BonoboUIComponent for menus.", + bonobo_ui_component_get_type(), + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_MENU_PATH, + g_param_spec_string ("ui-path", + "Path", + "The path to put the menu items.", + "/menus/File/GnomeRecentDocuments", + G_PARAM_READWRITE)); + + + klass->activate = NULL; +} + +static void +gnome_recent_view_init (GnomeRecentViewClass *iface) +{ + iface->do_clear = gnome_recent_view_bonobo_clear; + iface->do_get_model = gnome_recent_view_bonobo_get_model; + iface->do_set_model = gnome_recent_view_bonobo_set_model; +} + + +static void +gnome_recent_view_bonobo_init (GnomeRecentViewBonobo * recent) +{ + /* maybe should remove this */ +} + +void +gnome_recent_view_bonobo_set_ui_component (GnomeRecentViewBonobo *view, BonoboUIComponent *uic) +{ + g_return_if_fail (view); + g_return_if_fail (uic); + + view->uic = uic; +} + +void +gnome_recent_view_bonobo_set_ui_path (GnomeRecentViewBonobo *view, const gchar *path) +{ + g_return_if_fail (view); + g_return_if_fail (path); + + view->path = g_strdup (path); +} + +BonoboUIComponent * +gnome_recent_view_bonobo_get_ui_component (GnomeRecentViewBonobo *view) +{ + g_return_val_if_fail (view, NULL); + + return view->uic; +} + +gchar * +gnome_recent_view_bonobo_get_ui_path (GnomeRecentViewBonobo *view) +{ + g_return_val_if_fail (view, NULL); + + return g_strdup (view->path); +} + +/** + * gnome_recent_view_bonobo_new: + * @appname: The name of your application. + * @limit: The maximum number of items allowed. + * + * This creates a new GnomeRecentViewBonobo object. + * + * Returns: a GnomeRecentViewBonobo object + */ +GnomeRecentViewBonobo * +gnome_recent_view_bonobo_new (BonoboUIComponent *uic, const gchar *path) +{ + GnomeRecentViewBonobo *view; + + g_return_val_if_fail (uic, NULL); + g_return_val_if_fail (path, NULL); + + view = GNOME_RECENT_VIEW_BONOBO (g_object_new (gnome_recent_view_bonobo_get_type (), + "ui-path", + path, + "ui-component", + uic, NULL)); + + g_return_val_if_fail (view, NULL); + + return view; +} + +/** + * gnome_recent_view_bonobo_get_type: + * @: + * + * This returns a GType representing a GnomeRecentViewBonobo object. + * + * Returns: a GType + */ +GType +gnome_recent_view_bonobo_get_type (void) +{ + static GType gnome_recent_view_bonobo_type = 0; + + if(!gnome_recent_view_bonobo_type) { + static const GTypeInfo gnome_recent_view_bonobo_info = { + sizeof (GnomeRecentViewBonoboClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc)gnome_recent_view_bonobo_class_init, /* class init */ + NULL, /* class finalize */ + NULL, /* class data */ + sizeof (GnomeRecentViewBonobo), + 0, + (GInstanceInitFunc) gnome_recent_view_bonobo_init + }; + + static const GInterfaceInfo view_info = + { + (GInterfaceInitFunc) gnome_recent_view_init, + NULL, + NULL + }; + + gnome_recent_view_bonobo_type = g_type_register_static (G_TYPE_OBJECT, + "GnomeRecentViewBonobo", + &gnome_recent_view_bonobo_info, 0); + g_type_add_interface_static (gnome_recent_view_bonobo_type, + GNOME_TYPE_RECENT_VIEW, + &view_info); + } + + return gnome_recent_view_bonobo_type; +} + diff --git a/glabels2/src/gnome-recent-view-bonobo.h b/glabels2/src/gnome-recent-view-bonobo.h new file mode 100644 index 00000000..92d63f10 --- /dev/null +++ b/glabels2/src/gnome-recent-view-bonobo.h @@ -0,0 +1,34 @@ +/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +#ifndef __GNOME_RECENT_VIEW_BONOBO_H__ +#define __GNOME_RECENT_VIEW_BONOBO_H__ + +#include + +G_BEGIN_DECLS + +#define GNOME_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnome_recent_view_bonobo_get_type (), GnomeRecentViewBonobo) +#define GNOME_RECENT_VIEW_BONOBO_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnome_recent_view_bonobo_get_type (), GnomeRecentViewBonoboClass) +#define GNOME_IS_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnome_recent_view_bonobo_get_type ()) + +typedef struct _GnomeRecentViewBonobo GnomeRecentViewBonobo; + +typedef struct _GnomeRecentViewBonoboClass GnomeRecentViewBonoboClass; + +GType gnome_recent_view_bonobo_get_type (void); + +GnomeRecentViewBonobo * gnome_recent_view_bonobo_new (BonoboUIComponent *uic, + const gchar *path); + + +void gnome_recent_view_bonobo_set_ui_component (GnomeRecentViewBonobo *view, + BonoboUIComponent *uic); + +void gnome_recent_view_bonobo_set_ui_path (GnomeRecentViewBonobo *view, + const gchar *path); + +gchar * gnome_recent_view_bonobo_get_ui_path (GnomeRecentViewBonobo *view); +BonoboUIComponent *gnome_recent_view_bonobo_get_ui_component (GnomeRecentViewBonobo *view); + +G_END_DECLS + +#endif /* __GNOME_RECENT_VIEW_BONOBO_H__ */ diff --git a/glabels2/src/gnome-recent-view.c b/glabels2/src/gnome-recent-view.c new file mode 100644 index 00000000..edb145c9 --- /dev/null +++ b/glabels2/src/gnome-recent-view.c @@ -0,0 +1,51 @@ +#include +#include +#include "gnome-recent-view.h" + + +GtkType +gnome_recent_view_get_type (void) +{ + static GtkType view_type = 0; + + if (!view_type) + { + static const GTypeInfo view_info = + { + sizeof (GnomeRecentViewClass), /* class_size */ + NULL, /* base_init */ + NULL, /* base_finalize */ + }; + + view_type = g_type_register_static (G_TYPE_INTERFACE, + "GnomeRecentView", + &view_info, 0); + } + + return view_type; +} + +void +gnome_recent_view_clear (GnomeRecentView *view) +{ + g_return_if_fail (GNOME_IS_RECENT_VIEW (view)); + + GNOME_RECENT_VIEW_GET_CLASS (view)->do_clear (view); +} + +GnomeRecentModel * +gnome_recent_view_get_model (GnomeRecentView *view) +{ + g_return_val_if_fail (view, NULL); + + return GNOME_RECENT_VIEW_GET_CLASS (view)->do_get_model (view); +} + +void +gnome_recent_view_set_model (GnomeRecentView *view, GnomeRecentModel *model) +{ + g_return_if_fail (view); + g_return_if_fail (model); + + GNOME_RECENT_VIEW_GET_CLASS (view)->do_set_model (view, model); +} diff --git a/glabels2/src/gnome-recent-view.h b/glabels2/src/gnome-recent-view.h new file mode 100644 index 00000000..aedf67cc --- /dev/null +++ b/glabels2/src/gnome-recent-view.h @@ -0,0 +1,49 @@ +#ifndef __GNOME_RECENT_VIEW_H__ +#define __GNOME_RECENT_VIEW_H__ + + +#include +#include +#include "gnome-recent-model.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GNOME_TYPE_RECENT_VIEW (gnome_recent_view_get_type ()) +#define GNOME_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RECENT_VIEW, GnomeRecentView)) +#define GNOME_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GNOME_TYPE_RECENT_VIEW, GnomeRecentViewClass)) +#define GNOME_IS_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RECENT_VIEW)) +#define GNOME_IS_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GNOME_TYPE_RECENT_VIEW)) +#define GNOME_RECENT_VIEW_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GNOME_TYPE_RECENT_VIEW, GnomeRecentViewClass)) + +typedef struct _GnomeRecentView GnomeRecentView; /* Dummy typedef */ +typedef struct _GnomeRecentViewClass GnomeRecentViewClass; + +struct _GnomeRecentViewClass +{ + GTypeInterface base_iface; + + /* vtable, not signals */ + void (* do_clear) (GnomeRecentView *view); + void (* do_set_model) (GnomeRecentView *view, + GnomeRecentModel *model); + GnomeRecentModel * (* do_get_model) (GnomeRecentView *view); +}; + +GtkType gnome_recent_view_get_type (void) G_GNUC_CONST; +void gnome_recent_view_set_list (GnomeRecentView *view, + GSList *list); +void gnome_recent_view_clear (GnomeRecentView *view); +GnomeRecentModel *gnome_recent_view_get_model (GnomeRecentView *view); +void gnome_recent_view_set_model (GnomeRecentView *view, + GnomeRecentModel *model); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNOME_RECENT_VIEW_H__ */ diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c new file mode 100644 index 00000000..aaa9920a --- /dev/null +++ b/glabels2/src/label-barcode.c @@ -0,0 +1,280 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_barcode.c: GLabels label text object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "label-barcode.h" + +#include "pixmaps/checkerboard.xpm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelBarcodePrivate { + glTextNode *text_node; + glBarcodeStyle style; + guint color; + gboolean text_flag; + gdouble scale; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_barcode_class_init (glLabelBarcodeClass *klass); +static void gl_label_barcode_instance_init (glLabelBarcode *lbc); +static void gl_label_barcode_finalize (GObject *object); + +static void update_size (glLabelBarcode *lbc); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_barcode_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelBarcodeClass), + NULL, + NULL, + (GClassInitFunc) gl_label_barcode_class_init, + NULL, + NULL, + sizeof (glLabelBarcode), + 0, + (GInstanceInitFunc) gl_label_barcode_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelBarcode", &info, 0); + } + + return type; +} + +static void +gl_label_barcode_class_init (glLabelBarcodeClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_barcode_finalize; +} + +static void +gl_label_barcode_instance_init (glLabelBarcode *lbc) +{ + lbc->private = g_new0 (glLabelBarcodePrivate, 1); +} + +static void +gl_label_barcode_finalize (GObject *object) +{ + glLabelBarcode *lbc; + + g_return_if_fail (object && GL_IS_LABEL_BARCODE (object)); + + lbc = GL_LABEL_BARCODE (object); + + gl_text_node_free (&lbc->private->text_node); + g_free (lbc->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "text" object. */ +/*****************************************************************************/ +GObject * +gl_label_barcode_new (glLabel *label) +{ + glLabelBarcode *lbc; + + lbc = g_object_new (gl_label_barcode_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lbc), label); + + return G_OBJECT (lbc); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelBarcode * +gl_label_barcode_dup (glLabelBarcode *lbc, + glLabel *label) +{ + glLabelBarcode *new_lbc; + glTextNode *text_node; + gdouble x, y, w, h; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lbc = GL_LABEL_BARCODE(gl_label_barcode_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lbc), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lbc), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lbc), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lbc), w, h); + + text_node = gl_label_barcode_get_data (lbc); + gl_label_barcode_get_props (lbc, &style, &text_flag, &color, &scale); + + gl_label_barcode_set_data (new_lbc, text_node); + gl_label_barcode_set_props (new_lbc,style, text_flag, color, scale); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_LABEL, "END"); + + return new_lbc; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_barcode_set_data (glLabelBarcode *lbc, + glTextNode *text_node) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + + gl_text_node_free (&lbc->private->text_node); + lbc->private->text_node = gl_text_node_dup (text_node); + + update_size (lbc); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); + + gl_debug (DEBUG_LABEL, "END"); +} + +void +gl_label_barcode_set_props (glLabelBarcode *lbc, + glBarcodeStyle style, + gboolean text_flag, + guint color, + gdouble scale) +{ + GdkPixbuf *pixbuf; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + + lbc->private->style = style; + lbc->private->text_flag = text_flag; + lbc->private->color = color; + lbc->private->scale = scale; + + update_size (lbc); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); + + gl_debug (DEBUG_LABEL, "END"); +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +glTextNode * +gl_label_barcode_get_data (glLabelBarcode *lbc) +{ + g_return_val_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc), NULL); + + return gl_text_node_dup (lbc->private->text_node); +} + +void +gl_label_barcode_get_props (glLabelBarcode *lbc, + glBarcodeStyle *style, + gboolean *text_flag, + guint *color, + gdouble *scale) +{ + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + + *style = lbc->private->style; + *text_flag = lbc->private->text_flag; + *color = lbc->private->color; + *scale = lbc->private->scale; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update object size. */ +/*---------------------------------------------------------------------------*/ +static void +update_size (glLabelBarcode *lbc) +{ + gchar *data; + glBarcode *gbc; + + gl_debug (DEBUG_LABEL, "START"); + + data = gl_barcode_default_digits (lbc->private->style); + gbc = gl_barcode_new (lbc->private->style, + lbc->private->text_flag, + lbc->private->scale, + data); + + gl_label_object_set_size (GL_LABEL_OBJECT(lbc), + gbc->width, gbc->height); + + gl_barcode_free (&gbc); + + gl_debug (DEBUG_LABEL, "END"); +} + diff --git a/glabels2/src/label-barcode.h b/glabels2/src/label-barcode.h new file mode 100644 index 00000000..d1c0e09b --- /dev/null +++ b/glabels2/src/label-barcode.h @@ -0,0 +1,80 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_barcode.h: GLabels label barcode object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_BARCODE_H__ +#define __LABEL_BARCODE_H__ + +#include +#include +#include "bc.h" +#include "text-node.h" +#include "label-object.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_BARCODE (gl_label_barcode_get_type ()) +#define GL_LABEL_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_BARCODE, glLabelBarcode)) +#define GL_LABEL_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_BARCODE, glLabelBarcodeClass)) +#define GL_IS_LABEL_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_BARCODE)) +#define GL_IS_LABEL_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_BARCODE)) + +typedef struct _glLabelBarcode glLabelBarcode; +typedef struct _glLabelBarcodeClass glLabelBarcodeClass; + +typedef struct _glLabelBarcodePrivate glLabelBarcodePrivate; + +struct _glLabelBarcode { + glLabelObject object; + + glLabelBarcodePrivate *private; +}; + +struct _glLabelBarcodeClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_barcode_get_type (void); + +extern GObject *gl_label_barcode_new (glLabel *label); + +extern glLabelBarcode *gl_label_barcode_dup (glLabelBarcode *lbc, + glLabel *label); + +extern void gl_label_barcode_set_data (glLabelBarcode *lbc, + glTextNode *text_node); +extern void gl_label_barcode_set_props (glLabelBarcode *lbc, + glBarcodeStyle style, + gboolean text_flag, + guint color, + gdouble scale); + +extern glTextNode *gl_label_barcode_get_data (glLabelBarcode *lbc); +extern void gl_label_barcode_get_props (glLabelBarcode *lbc, + glBarcodeStyle *style, + gboolean *text_flag, + guint *color, + gdouble *scale); + +G_END_DECLS + +#endif /* __LABEL_BARCODE_H__ */ diff --git a/glabels2/src/label-box.c b/glabels2/src/label-box.c new file mode 100644 index 00000000..a7e816ae --- /dev/null +++ b/glabels2/src/label-box.c @@ -0,0 +1,233 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_box.c: GLabels label box object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "label-box.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelBoxPrivate { + gdouble line_width; + guint line_color; + guint fill_color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_box_class_init (glLabelBoxClass *klass); +static void gl_label_box_instance_init (glLabelBox *lbox); +static void gl_label_box_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_box_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelBoxClass), + NULL, + NULL, + (GClassInitFunc) gl_label_box_class_init, + NULL, + NULL, + sizeof (glLabelBox), + 0, + (GInstanceInitFunc) gl_label_box_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelBox", &info, 0); + } + + return type; +} + +static void +gl_label_box_class_init (glLabelBoxClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_box_finalize; +} + +static void +gl_label_box_instance_init (glLabelBox *lbox) +{ + lbox->private = g_new0 (glLabelBoxPrivate, 1); +} + +static void +gl_label_box_finalize (GObject *object) +{ + glLabelBox *lbox; + + g_return_if_fail (object && GL_IS_LABEL_BOX (object)); + + lbox = GL_LABEL_BOX (object); + + g_free (lbox->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "box" object. */ +/*****************************************************************************/ +GObject * +gl_label_box_new (glLabel *label) +{ + glLabelBox *lbox; + + lbox = g_object_new (gl_label_box_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lbox), label); + + return G_OBJECT (lbox); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelBox * +gl_label_box_dup (glLabelBox *lbox, + glLabel *label) +{ + glLabelBox *new_lbox; + gdouble x, y, w, h, line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lbox = GL_LABEL_BOX(gl_label_box_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lbox), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lbox), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lbox), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lbox), w, h); + + line_width = gl_label_box_get_line_width (lbox); + line_color = gl_label_box_get_line_color (lbox); + fill_color = gl_label_box_get_fill_color (lbox); + + gl_label_box_set_line_width (new_lbox, line_width); + gl_label_box_set_line_color (new_lbox, line_color); + gl_label_box_set_fill_color (new_lbox, fill_color); + + + gl_debug (DEBUG_LABEL, "END"); + + return new_lbox; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_box_set_line_width (glLabelBox *lbox, + gdouble line_width) +{ + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + + if ( lbox->private->line_width != line_width ) { + lbox->private->line_width = line_width; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); + } +} + +void +gl_label_box_set_line_color (glLabelBox *lbox, + guint line_color) +{ + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + + if ( lbox->private->line_color != line_color ) { + lbox->private->line_color = line_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); + } +} + +void +gl_label_box_set_fill_color (glLabelBox *lbox, + guint fill_color) +{ + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + + if ( lbox->private->fill_color != fill_color ) { + lbox->private->fill_color = fill_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); + } +} + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gdouble +gl_label_box_get_line_width (glLabelBox *lbox) +{ + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0.0); + + return lbox->private->line_width; +} + +guint +gl_label_box_get_line_color (glLabelBox *lbox) +{ + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); + + return lbox->private->line_color; +} + +guint +gl_label_box_get_fill_color (glLabelBox *lbox) +{ + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); + + return lbox->private->fill_color; +} + diff --git a/glabels2/src/label-box.h b/glabels2/src/label-box.h new file mode 100644 index 00000000..fc5b6f9e --- /dev/null +++ b/glabels2/src/label-box.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_box.h: GLabels label box object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_BOX_H__ +#define __LABEL_BOX_H__ + +#include "label-object.h" + + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_BOX (gl_label_box_get_type ()) +#define GL_LABEL_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_BOX, glLabelBox)) +#define GL_LABEL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_BOX, glLabelBoxClass)) +#define GL_IS_LABEL_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_BOX)) +#define GL_IS_LABEL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_BOX)) + +typedef struct _glLabelBox glLabelBox; +typedef struct _glLabelBoxClass glLabelBoxClass; + +typedef struct _glLabelBoxPrivate glLabelBoxPrivate; + +struct _glLabelBox { + glLabelObject object; + + glLabelBoxPrivate *private; +}; + +struct _glLabelBoxClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_box_get_type (void); + +extern GObject *gl_label_box_new (glLabel *label); + +extern glLabelBox *gl_label_box_dup (glLabelBox *lbox, + glLabel *label); + +extern void gl_label_box_set_line_width (glLabelBox *lbox, + gdouble line_width); + +extern void gl_label_box_set_line_color (glLabelBox *lbox, + guint line_color); + +extern void gl_label_box_set_fill_color (glLabelBox *lbox, + guint fill_color); + +extern gdouble gl_label_box_get_line_width (glLabelBox *lbox); +extern guint gl_label_box_get_line_color (glLabelBox *lbox); +extern guint gl_label_box_get_fill_color (glLabelBox *lbox); + + +G_END_DECLS + +#endif /* __LABEL_BOX_H__ */ diff --git a/glabels2/src/label-ellipse.c b/glabels2/src/label-ellipse.c new file mode 100644 index 00000000..e071f5d4 --- /dev/null +++ b/glabels2/src/label-ellipse.c @@ -0,0 +1,232 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_ellipse.c: GLabels label ellipse object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "label-ellipse.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelEllipsePrivate { + gdouble line_width; + guint line_color; + guint fill_color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_ellipse_class_init (glLabelEllipseClass *klass); +static void gl_label_ellipse_instance_init (glLabelEllipse *lellipse); +static void gl_label_ellipse_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_ellipse_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelEllipseClass), + NULL, + NULL, + (GClassInitFunc) gl_label_ellipse_class_init, + NULL, + NULL, + sizeof (glLabelEllipse), + 0, + (GInstanceInitFunc) gl_label_ellipse_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelEllipse", &info, 0); + } + + return type; +} + +static void +gl_label_ellipse_class_init (glLabelEllipseClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_ellipse_finalize; +} + +static void +gl_label_ellipse_instance_init (glLabelEllipse *lellipse) +{ + lellipse->private = g_new0 (glLabelEllipsePrivate, 1); +} + +static void +gl_label_ellipse_finalize (GObject *object) +{ + glLabelEllipse *lellipse; + + g_return_if_fail (object && GL_IS_LABEL_ELLIPSE (object)); + + lellipse = GL_LABEL_ELLIPSE (object); + + g_free (lellipse->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "ellipse" object. */ +/*****************************************************************************/ +GObject * +gl_label_ellipse_new (glLabel *label) +{ + glLabelEllipse *lellipse; + + lellipse = g_object_new (gl_label_ellipse_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lellipse), label); + + return G_OBJECT (lellipse); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelEllipse * +gl_label_ellipse_dup (glLabelEllipse *lellipse, + glLabel *label) +{ + glLabelEllipse *new_lellipse; + gdouble x, y, w, h, line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lellipse = GL_LABEL_ELLIPSE(gl_label_ellipse_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lellipse), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lellipse), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lellipse), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lellipse), w, h); + + line_width = gl_label_ellipse_get_line_width (lellipse); + line_color = gl_label_ellipse_get_line_color (lellipse); + fill_color = gl_label_ellipse_get_fill_color (lellipse); + + gl_label_ellipse_set_line_width (new_lellipse, line_width); + gl_label_ellipse_set_line_color (new_lellipse, line_color); + gl_label_ellipse_set_fill_color (new_lellipse, fill_color); + + gl_debug (DEBUG_LABEL, "END"); + + return new_lellipse; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_ellipse_set_line_width (glLabelEllipse *lellipse, + gdouble line_width) +{ + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + + if ( lellipse->private->line_width != line_width ) { + lellipse->private->line_width = line_width; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); + } +} + +void +gl_label_ellipse_set_line_color (glLabelEllipse *lellipse, + guint line_color) +{ + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + + if ( lellipse->private->line_color != line_color ) { + lellipse->private->line_color = line_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); + } +} + +void +gl_label_ellipse_set_fill_color (glLabelEllipse *lellipse, + guint fill_color) +{ + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + + if ( lellipse->private->fill_color != fill_color ) { + lellipse->private->fill_color = fill_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); + } +} + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gdouble +gl_label_ellipse_get_line_width (glLabelEllipse *lellipse) +{ + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0.0); + + return lellipse->private->line_width; +} + +guint +gl_label_ellipse_get_line_color (glLabelEllipse *lellipse) +{ + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); + + return lellipse->private->line_color; +} + +guint +gl_label_ellipse_get_fill_color (glLabelEllipse *lellipse) +{ + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); + + return lellipse->private->fill_color; +} + diff --git a/glabels2/src/label-ellipse.h b/glabels2/src/label-ellipse.h new file mode 100644 index 00000000..8704e698 --- /dev/null +++ b/glabels2/src/label-ellipse.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_ellipse.h: GLabels label ellipse object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_ELLIPSE_H__ +#define __LABEL_ELLIPSE_H__ + +#include "label-object.h" + + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_ELLIPSE (gl_label_ellipse_get_type ()) +#define GL_LABEL_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_ELLIPSE, glLabelEllipse)) +#define GL_LABEL_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_ELLIPSE, glLabelEllipseClass)) +#define GL_IS_LABEL_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_ELLIPSE)) +#define GL_IS_LABEL_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_ELLIPSE)) + +typedef struct _glLabelEllipse glLabelEllipse; +typedef struct _glLabelEllipseClass glLabelEllipseClass; + +typedef struct _glLabelEllipsePrivate glLabelEllipsePrivate; + +struct _glLabelEllipse { + glLabelObject object; + + glLabelEllipsePrivate *private; +}; + +struct _glLabelEllipseClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_ellipse_get_type (void); + +extern GObject *gl_label_ellipse_new (glLabel *label); + +extern glLabelEllipse *gl_label_ellipse_dup (glLabelEllipse *lellipse, + glLabel *label); + +extern void gl_label_ellipse_set_line_width (glLabelEllipse *lellipse, + gdouble line_width); + +extern void gl_label_ellipse_set_line_color (glLabelEllipse *lellipse, + guint line_color); + +extern void gl_label_ellipse_set_fill_color (glLabelEllipse *lellipse, + guint fill_color); + +extern gdouble gl_label_ellipse_get_line_width (glLabelEllipse *lellipse); +extern guint gl_label_ellipse_get_line_color (glLabelEllipse *lellipse); +extern guint gl_label_ellipse_get_fill_color (glLabelEllipse *lellipse); + + +G_END_DECLS + +#endif /* __LABEL_ELLIPSE_H__ */ diff --git a/glabels2/src/label-image.c b/glabels2/src/label-image.c new file mode 100644 index 00000000..9ca6c30b --- /dev/null +++ b/glabels2/src/label-image.c @@ -0,0 +1,239 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_image.c: GLabels label image object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "label-image.h" + +#include "pixmaps/checkerboard.xpm" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelImagePrivate { + gchar *filename; + GdkPixbuf *pixbuf; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_image_class_init (glLabelImageClass *klass); +static void gl_label_image_instance_init (glLabelImage *limage); +static void gl_label_image_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_image_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelImageClass), + NULL, + NULL, + (GClassInitFunc) gl_label_image_class_init, + NULL, + NULL, + sizeof (glLabelImage), + 0, + (GInstanceInitFunc) gl_label_image_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelImage", &info, 0); + } + + return type; +} + +static void +gl_label_image_class_init (glLabelImageClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_image_finalize; +} + +static void +gl_label_image_instance_init (glLabelImage *limage) +{ + limage->private = g_new0 (glLabelImagePrivate, 1); + + limage->private->pixbuf = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); +} + +static void +gl_label_image_finalize (GObject *object) +{ + glLabelImage *limage; + + g_return_if_fail (object && GL_IS_LABEL_IMAGE (object)); + + limage = GL_LABEL_IMAGE (object); + + g_free (limage->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "image" object. */ +/*****************************************************************************/ +GObject * +gl_label_image_new (glLabel *label) +{ + glLabelImage *limage; + + limage = g_object_new (gl_label_image_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(limage), label); + + return G_OBJECT (limage); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelImage * +gl_label_image_dup (glLabelImage *limage, + glLabel *label) +{ + glLabelImage *new_limage; + gdouble x, y, w, h; + gchar *filename; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (limage && GL_IS_LABEL_IMAGE (limage)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_limage = GL_LABEL_IMAGE(gl_label_image_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(limage), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(limage), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_limage), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_limage), w, h); + + filename = gl_label_image_get_filename (limage); + + gl_label_image_set_filename (new_limage, filename); + + g_free (filename); + + gl_debug (DEBUG_LABEL, "END"); + + return new_limage; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_image_set_filename (glLabelImage *limage, + const gchar *filename) +{ + GdkPixbuf *pixbuf; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (limage && GL_IS_LABEL_IMAGE (limage)); + + if ( filename == NULL ) { + + g_free (limage->private->filename); + limage->private->filename = NULL; + + g_object_unref (limage->private->pixbuf); + limage->private->pixbuf = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(limage)); + } else { + + if ( (limage->private->filename == NULL) || + (strcmp (limage->private->filename, filename) != 0) ) { + + g_free (limage->private->filename); + limage->private->filename = g_strdup (filename); + + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); + g_object_unref (limage->private->pixbuf); + if ( pixbuf != NULL ) { + limage->private->pixbuf = pixbuf; + } else { + limage->private->pixbuf = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); + } + + gl_label_object_emit_changed (GL_LABEL_OBJECT(limage)); + } + + } + + gl_debug (DEBUG_LABEL, "END"); +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gchar * +gl_label_image_get_filename (glLabelImage *limage) +{ + g_return_val_if_fail (limage && GL_IS_LABEL_IMAGE (limage), NULL); + + return g_strdup (limage->private->filename); +} + +const GdkPixbuf * +gl_label_image_get_pixbuf (glLabelImage *limage) +{ + g_return_val_if_fail (limage && GL_IS_LABEL_IMAGE (limage), NULL); + + return limage->private->pixbuf; +} + diff --git a/glabels2/src/label-image.h b/glabels2/src/label-image.h new file mode 100644 index 00000000..34af171a --- /dev/null +++ b/glabels2/src/label-image.h @@ -0,0 +1,69 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_image.h: GLabels label image object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_IMAGE_H__ +#define __LABEL_IMAGE_H__ + +#include "label-object.h" +#include "gdk-pixbuf/gdk-pixbuf.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_IMAGE (gl_label_image_get_type ()) +#define GL_LABEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_IMAGE, glLabelImage)) +#define GL_LABEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_IMAGE, glLabelImageClass)) +#define GL_IS_LABEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_IMAGE)) +#define GL_IS_LABEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_IMAGE)) + +typedef struct _glLabelImage glLabelImage; +typedef struct _glLabelImageClass glLabelImageClass; + +typedef struct _glLabelImagePrivate glLabelImagePrivate; + +struct _glLabelImage { + glLabelObject object; + + glLabelImagePrivate *private; +}; + +struct _glLabelImageClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_image_get_type (void); + +extern GObject *gl_label_image_new (glLabel *label); + +extern glLabelImage *gl_label_image_dup (glLabelImage *limage, + glLabel *label); + +extern void gl_label_image_set_filename (glLabelImage *limage, + const gchar *filename); + +extern gchar *gl_label_image_get_filename (glLabelImage *limage); + +extern const GdkPixbuf *gl_label_image_get_pixbuf (glLabelImage *limage); + +G_END_DECLS + +#endif /* __LABEL_IMAGE_H__ */ diff --git a/glabels2/src/label-line.c b/glabels2/src/label-line.c new file mode 100644 index 00000000..990a2b96 --- /dev/null +++ b/glabels2/src/label-line.c @@ -0,0 +1,210 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_line.c: GLabels label line object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "label-line.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelLinePrivate { + gdouble line_width; + guint line_color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_line_class_init (glLabelLineClass *klass); +static void gl_label_line_instance_init (glLabelLine *lline); +static void gl_label_line_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_line_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelLineClass), + NULL, + NULL, + (GClassInitFunc) gl_label_line_class_init, + NULL, + NULL, + sizeof (glLabelLine), + 0, + (GInstanceInitFunc) gl_label_line_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelLine", &info, 0); + } + + return type; +} + +static void +gl_label_line_class_init (glLabelLineClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_line_finalize; +} + +static void +gl_label_line_instance_init (glLabelLine *lline) +{ + lline->private = g_new0 (glLabelLinePrivate, 1); +} + +static void +gl_label_line_finalize (GObject *object) +{ + glLabelLine *lline; + + g_return_if_fail (object && GL_IS_LABEL_LINE (object)); + + lline = GL_LABEL_LINE (object); + + g_free (lline->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "line" object. */ +/*****************************************************************************/ +GObject * +gl_label_line_new (glLabel *label) +{ + glLabelLine *lline; + + lline = g_object_new (gl_label_line_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lline), label); + + return G_OBJECT (lline); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelLine * +gl_label_line_dup (glLabelLine *lline, + glLabel *label) +{ + glLabelLine *new_lline; + gdouble x, y, w, h, line_width; + guint line_color; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lline = GL_LABEL_LINE(gl_label_line_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lline), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lline), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lline), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lline), w, h); + + line_width = gl_label_line_get_line_width (lline); + line_color = gl_label_line_get_line_color (lline); + + gl_label_line_set_line_width (new_lline, line_width); + gl_label_line_set_line_color (new_lline, line_color); + + gl_debug (DEBUG_LABEL, "END"); + + return new_lline; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_line_set_line_width (glLabelLine *lline, + gdouble line_width) +{ + g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); + + if ( lline->private->line_width != line_width ) { + lline->private->line_width = line_width; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); + } +} + +void +gl_label_line_set_line_color (glLabelLine *lline, + guint line_color) +{ + g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); + + if ( lline->private->line_color != line_color ) { + lline->private->line_color = line_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); + } +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gdouble +gl_label_line_get_line_width (glLabelLine *lline) +{ + g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0.0); + + return lline->private->line_width; +} + +guint +gl_label_line_get_line_color (glLabelLine *lline) +{ + g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0); + + return lline->private->line_color; +} + diff --git a/glabels2/src/label-line.h b/glabels2/src/label-line.h new file mode 100644 index 00000000..b418b890 --- /dev/null +++ b/glabels2/src/label-line.h @@ -0,0 +1,72 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_line.h: GLabels label line object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_LINE_H__ +#define __LABEL_LINE_H__ + +#include "label-object.h" + + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_LINE (gl_label_line_get_type ()) +#define GL_LABEL_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_LINE, glLabelLine)) +#define GL_LABEL_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_LINE, glLabelLineClass)) +#define GL_IS_LABEL_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_LINE)) +#define GL_IS_LABEL_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_LINE)) + +typedef struct _glLabelLine glLabelLine; +typedef struct _glLabelLineClass glLabelLineClass; + +typedef struct _glLabelLinePrivate glLabelLinePrivate; + +struct _glLabelLine { + glLabelObject object; + + glLabelLinePrivate *private; +}; + +struct _glLabelLineClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_line_get_type (void); + +extern GObject *gl_label_line_new (glLabel *label); + +extern glLabelLine *gl_label_line_dup (glLabelLine *lline, + glLabel *label); + +extern void gl_label_line_set_line_width (glLabelLine *lline, + gdouble line_width); + +extern void gl_label_line_set_line_color (glLabelLine *lline, + guint line_color); + +extern gdouble gl_label_line_get_line_width (glLabelLine *lline); +extern guint gl_label_line_get_line_color (glLabelLine *lline); + + +G_END_DECLS + +#endif /* __LABEL_LINE_H__ */ diff --git a/glabels2/src/label-object.c b/glabels2/src/label-object.c new file mode 100644 index 00000000..badbd339 --- /dev/null +++ b/glabels2/src/label-object.c @@ -0,0 +1,426 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_object.c: GLabels label object base class + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "label-object.h" +#include "marshal.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelObjectPrivate { + gchar *name; + gdouble x, y; + gdouble w, h; +}; + +enum { + CHANGED, + MOVED, + TOP, + BOTTOM, + LAST_SIGNAL +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint signals[LAST_SIGNAL] = {0}; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_object_class_init (glLabelObjectClass *klass); +static void gl_label_object_instance_init (glLabelObject *object); +static void gl_label_object_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_object_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelObjectClass), + NULL, + NULL, + (GClassInitFunc) gl_label_object_class_init, + NULL, + NULL, + sizeof (glLabelObject), + 0, + (GInstanceInitFunc) gl_label_object_instance_init, + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "glLabelObject", &info, 0); + } + + return type; +} + +static void +gl_label_object_class_init (glLabelObjectClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_LABEL, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_object_finalize; + + signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + signals[MOVED] = + g_signal_new ("moved", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, moved), + NULL, NULL, + gl_marshal_VOID__DOUBLE_DOUBLE, + G_TYPE_NONE, + 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE); + signals[TOP] = + g_signal_new ("top", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, top), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + signals[BOTTOM] = + g_signal_new ("bottom", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, bottom), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_object_instance_init (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + object->private = g_new0 (glLabelObjectPrivate, 1); + + object->private->name = g_strdup_printf ("object%d", instance++); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_object_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + parent = GL_LABEL_OBJECT(object)->parent; + gl_label_remove_object (parent, GL_LABEL_OBJECT(object)); + + g_free (GL_LABEL_OBJECT(object)->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_LABEL, "END"); +} + +GObject * +gl_label_object_new (glLabel *label) +{ + glLabelObject *object; + + gl_debug (DEBUG_LABEL, "START"); + + object = g_object_new (gl_label_object_get_type(), NULL); + + gl_label_object_set_parent (object, label); + + gl_debug (DEBUG_LABEL, "END"); + + return G_OBJECT (object); +} + +/*****************************************************************************/ +/* Emit "changed" signal (for derived objects). */ +/*****************************************************************************/ +void +gl_label_object_emit_changed (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Set parent label of object. */ +/*****************************************************************************/ +void +gl_label_object_set_parent (glLabelObject *object, + glLabel *label) +{ + glLabel *old_parent; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + old_parent = object->parent; + if ( old_parent != NULL ) { + gl_label_remove_object( old_parent, object ); + } + gl_label_add_object( label, object ); + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get parent label of object. */ +/*****************************************************************************/ +glLabel * +gl_label_object_get_parent (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + gl_debug (DEBUG_LABEL, "END"); + + return object->parent; +} + +/*****************************************************************************/ +/* Set name of object. */ +/*****************************************************************************/ +void +gl_label_object_set_name (glLabelObject *object, + gchar *name) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + g_free(object->private->name); + object->private->name = name; + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get name of object. */ +/*****************************************************************************/ +gchar * +gl_label_object_get_name (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + gl_debug (DEBUG_LABEL, "END"); + + return g_strdup(object->private->name); +} + +/*****************************************************************************/ +/* Set position of object. */ +/*****************************************************************************/ +void +gl_label_object_set_position (glLabelObject *object, + gdouble x, + gdouble y) +{ + gdouble dx, dy; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + dx = x - object->private->x; + dy = y - object->private->y; + + object->private->x = x; + object->private->y = y; + + g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Set position of object relative to old position. */ +/*****************************************************************************/ +void +gl_label_object_set_position_relative (glLabelObject *object, + gdouble dx, + gdouble dy) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + object->private->x += dx; + object->private->y += dy; + + gl_debug (DEBUG_LABEL, " x = %f, y= %f", + object->private->x, + object->private->y); + + g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get position of object. */ +/*****************************************************************************/ +void +gl_label_object_get_position (glLabelObject *object, + gdouble *x, + gdouble *y) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + *x = object->private->x; + *y = object->private->y; + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Set size of object. */ +/*****************************************************************************/ +void +gl_label_object_set_size (glLabelObject *object, + gdouble w, + gdouble h) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + object->private->w = w; + object->private->h = h; + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get size of object. */ +/*****************************************************************************/ +void +gl_label_object_get_size (glLabelObject *object, + gdouble *w, + gdouble *h) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + *w = object->private->w; + *h = object->private->h; + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Bring label object to front/top. */ +/****************************************************************************/ +void +gl_label_object_raise_to_top (glLabelObject *object) +{ + glLabel *label; + + gl_debug (DEBUG_LABEL, "START"); + + label = object->parent; + + gl_label_raise_object_to_top (label, object); + + g_signal_emit (G_OBJECT(object), signals[TOP], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Send label object to rear/bottom. */ +/****************************************************************************/ +void +gl_label_object_lower_to_bottom (glLabelObject *object) +{ + glLabel *label; + + gl_debug (DEBUG_LABEL, "START"); + + label = object->parent; + + gl_label_lower_object_to_bottom (label, object); + + g_signal_emit (G_OBJECT(object), signals[BOTTOM], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + diff --git a/glabels2/src/label-object.h b/glabels2/src/label-object.h new file mode 100644 index 00000000..878f711d --- /dev/null +++ b/glabels2/src/label-object.h @@ -0,0 +1,106 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_object.h: GLabels label object base class + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_OBJECT_H__ +#define __LABEL_OBJECT_H__ + +#include + + +G_BEGIN_DECLS + +typedef enum { + GL_LABEL_OBJECT_TEXT, + GL_LABEL_OBJECT_BOX, + GL_LABEL_OBJECT_LINE, + GL_LABEL_OBJECT_ELLIPSE, + GL_LABEL_OBJECT_IMAGE, + GL_LABEL_OBJECT_BARCODE, + GL_LABEL_OBJECT_N_TYPES +} glLabelObjectType; + + +#define GL_TYPE_LABEL_OBJECT (gl_label_object_get_type ()) +#define GL_LABEL_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_OBJECT, glLabelObject)) +#define GL_LABEL_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_OBJECT, glLabelObjectClass)) +#define GL_IS_LABEL_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_OBJECT)) +#define GL_IS_LABEL_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_OBJECT)) + +typedef struct _glLabelObject glLabelObject; +typedef struct _glLabelObjectClass glLabelObjectClass; + +typedef struct _glLabelObjectPrivate glLabelObjectPrivate; + +#include "label.h" + +struct _glLabelObject { + GObject object; + + glLabel *parent; + + glLabelObjectPrivate *private; +}; + +struct _glLabelObjectClass { + GObjectClass parent_class; + + void (*changed) (glLabelObject *object, gpointer user_data); + + void (*moved) (glLabelObject *object, + gdouble dx, gdouble dy, gpointer user_data); + + void (*top) (glLabelObject *object, gpointer user_data); + void (*bottom) (glLabelObject *object, gpointer user_data); +}; + +extern GType gl_label_object_get_type (void); + +extern GObject *gl_label_object_new (glLabel *label); + +extern void gl_label_object_emit_changed (glLabelObject *object); + +extern void gl_label_object_set_parent (glLabelObject *object, + glLabel *label); +extern glLabel *gl_label_object_get_parent (glLabelObject *object); + +extern void gl_label_object_set_name (glLabelObject *object, + gchar *name); +extern gchar *gl_label_object_get_name (glLabelObject *object); + +extern void gl_label_object_set_position (glLabelObject *object, + gdouble x, gdouble y); +extern void gl_label_object_set_position_relative (glLabelObject *object, + gdouble dx, + gdouble dy); +extern void gl_label_object_get_position (glLabelObject *object, + gdouble *x, gdouble *y); +extern void gl_label_object_set_size (glLabelObject *object, + gdouble w, gdouble h); +extern void gl_label_object_get_size (glLabelObject *object, + gdouble *w, gdouble *h); + +extern void gl_label_object_raise_to_top (glLabelObject * object); +extern void gl_label_object_lower_to_bottom (glLabelObject * object); + +G_END_DECLS + +#endif /* __LABEL_OBJECT_H__ */ diff --git a/glabels2/src/label-text.c b/glabels2/src/label-text.c new file mode 100644 index 00000000..8e30f995 --- /dev/null +++ b/glabels2/src/label-text.c @@ -0,0 +1,345 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_text.c: GLabels label text object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "label-text.h" + +#include "pixmaps/checkerboard.xpm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define DEFAULT_FONT_FAMILY "Helvetica" +#define DEFAULT_FONT_SIZE 14.0 +#define DEFAULT_FONT_WEIGHT GNOME_FONT_BOOK +#define DEFAULT_FONT_ITALIC_FLAG FALSE +#define DEFAULT_JUST GTK_JUSTIFY_LEFT +#define DEFAULT_COLOR GNOME_CANVAS_COLOR (0,0,0) + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelTextPrivate { + GList *lines; /* list of glLabelTextNode lists */ + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + GtkJustification just; + guint color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_text_class_init (glLabelTextClass *klass); +static void gl_label_text_instance_init (glLabelText *ltext); +static void gl_label_text_finalize (GObject *object); + +static void update_size (glLabelText *ltext); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_text_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelTextClass), + NULL, + NULL, + (GClassInitFunc) gl_label_text_class_init, + NULL, + NULL, + sizeof (glLabelText), + 0, + (GInstanceInitFunc) gl_label_text_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelText", &info, 0); + } + + return type; +} + +static void +gl_label_text_class_init (glLabelTextClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_text_finalize; +} + +static void +gl_label_text_instance_init (glLabelText *ltext) +{ + ltext->private = g_new0 (glLabelTextPrivate, 1); + + ltext->private->font_family = g_strdup(DEFAULT_FONT_FAMILY); + ltext->private->font_size = DEFAULT_FONT_SIZE; + ltext->private->font_weight = DEFAULT_FONT_WEIGHT; + ltext->private->font_italic_flag = DEFAULT_FONT_ITALIC_FLAG; + ltext->private->just = DEFAULT_JUST; + ltext->private->color = DEFAULT_COLOR; +} + +static void +gl_label_text_finalize (GObject *object) +{ + glLabelText *ltext; + + g_return_if_fail (object && GL_IS_LABEL_TEXT (object)); + + ltext = GL_LABEL_TEXT (object); + + g_free (ltext->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "text" object. */ +/*****************************************************************************/ +GObject * +gl_label_text_new (glLabel *label) +{ + glLabelText *ltext; + + ltext = g_object_new (gl_label_text_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(ltext), label); + + return G_OBJECT (ltext); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelText * +gl_label_text_dup (glLabelText *ltext, + glLabel *label) +{ + glLabelText *new_ltext; + gdouble x, y, w, h; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_ltext = GL_LABEL_TEXT(gl_label_text_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(ltext), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(ltext), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_ltext), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_ltext), w, h); + + lines = gl_label_text_get_lines (ltext); + gl_label_text_get_props (ltext, + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + gl_label_text_set_lines (new_ltext, lines); + gl_label_text_set_props (new_ltext, + font_family, font_size, font_weight, + font_italic_flag, + color, just); + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_LABEL, "END"); + + return new_ltext; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_text_set_lines (glLabelText *ltext, + GList *lines) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + + gl_text_node_lines_free (<ext->private->lines); + ltext->private->lines = gl_text_node_lines_dup (lines); + + update_size (ltext); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); + + gl_debug (DEBUG_LABEL, "END"); +} + +void +gl_label_text_set_props (glLabelText *ltext, + gchar *font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just) +{ + GdkPixbuf *pixbuf; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + + g_free (ltext->private->font_family); + + ltext->private->font_family = g_strdup (font_family); + ltext->private->font_size = font_size; + ltext->private->font_weight = font_weight; + ltext->private->font_italic_flag = font_italic_flag; + ltext->private->color = color; + ltext->private->just = just; + + gl_debug (DEBUG_LABEL, "just = %d", ltext->private->just); + + update_size (ltext); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); + + gl_debug (DEBUG_LABEL, "END"); +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +GList * +gl_label_text_get_lines (glLabelText *ltext) +{ + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), NULL); + + return gl_text_node_lines_dup (ltext->private->lines); +} + +void +gl_label_text_get_props (glLabelText *ltext, + gchar **font_family, + gdouble *font_size, + GnomeFontWeight *font_weight, + gboolean *font_italic_flag, + guint *color, + GtkJustification *just) +{ + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + + *font_family = g_strdup (ltext->private->font_family); + *font_size = ltext->private->font_size; + *font_weight = ltext->private->font_weight; + *font_italic_flag = ltext->private->font_italic_flag; + *color = ltext->private->color; + *just = ltext->private->just; + + gl_debug (DEBUG_LABEL, "just = %d", *just); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update object size. */ +/*---------------------------------------------------------------------------*/ +static void +update_size (glLabelText *ltext) +{ + gdouble w, h; + GnomeFont *font; + gchar *text; + gchar **line; + gint i; + GnomeGlyphList *glyphlist; + ArtDRect bbox; + gdouble affine[6]; + + gl_debug (DEBUG_LABEL, "START"); + + font = gnome_font_find_closest_from_weight_slant ( + ltext->private->font_family, + ltext->private->font_weight, + ltext->private->font_italic_flag, + ltext->private->font_size); + + text = gl_text_node_lines_expand (ltext->private->lines, NULL); + line = g_strsplit (text, "\n", -1); + g_free (text); + + art_affine_identity (affine); + + w = 0.0; + h = 0.0; + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, 0, + 0.0, 0.0, + line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + + if ( bbox.x1 > w ) w = bbox.x1; + + h += ltext->private->font_size; + + } + + g_strfreev (line); + + gl_label_object_set_size (GL_LABEL_OBJECT(ltext), w, h); + + gl_debug (DEBUG_LABEL, "END"); +} + diff --git a/glabels2/src/label-text.h b/glabels2/src/label-text.h new file mode 100644 index 00000000..cb7fd31f --- /dev/null +++ b/glabels2/src/label-text.h @@ -0,0 +1,83 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_text.h: GLabels label text object + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_TEXT_H__ +#define __LABEL_TEXT_H__ + +#include +#include +#include "text-node.h" +#include "label-object.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_TEXT (gl_label_text_get_type ()) +#define GL_LABEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_TEXT, glLabelText)) +#define GL_LABEL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_TEXT, glLabelTextClass)) +#define GL_IS_LABEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_TEXT)) +#define GL_IS_LABEL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_TEXT)) + +typedef struct _glLabelText glLabelText; +typedef struct _glLabelTextClass glLabelTextClass; + +typedef struct _glLabelTextPrivate glLabelTextPrivate; + +struct _glLabelText { + glLabelObject object; + + glLabelTextPrivate *private; +}; + +struct _glLabelTextClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_text_get_type (void); + +extern GObject *gl_label_text_new (glLabel *label); + +extern glLabelText *gl_label_text_dup (glLabelText *ltext, + glLabel *label); + +extern void gl_label_text_set_lines (glLabelText *ltext, + GList *lines); +extern void gl_label_text_set_props (glLabelText *ltext, + gchar *font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just); + +extern GList *gl_label_text_get_lines (glLabelText *ltext); +extern void gl_label_text_get_props (glLabelText *ltext, + gchar **font_family, + gdouble *font_size, + GnomeFontWeight *font_weight, + gboolean *font_italic_flag, + guint *color, + GtkJustification *just); + +G_END_DECLS + +#endif /* __LABEL_TEXT_H__ */ diff --git a/glabels2/src/label.c b/glabels2/src/label.c new file mode 100644 index 00000000..00054d7c --- /dev/null +++ b/glabels2/src/label.c @@ -0,0 +1,614 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.c: GLabels label module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "label.h" +#include "label-object.h" +#include "label-text.h" +#include "label-box.h" +#include "label-line.h" +#include "label-ellipse.h" +#include "label-image.h" +#include "label-barcode.h" +#include "template.h" +#include "marshal.h" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelPrivate { + + glTemplate *template; + gboolean rotate_flag; + + gchar *filename; + gboolean modified_flag; + gint untitled_instance; + + glMerge *merge; +}; + +enum { + CHANGED, + NAME_CHANGED, + MODIFIED_CHANGED, + LAST_SIGNAL +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint signals[LAST_SIGNAL] = {0}; + +static guint untitled = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_class_init (glLabelClass *klass); +static void gl_label_instance_init (glLabel *label); +static void gl_label_finalize (GObject *object); + +static void object_changed_cb (glLabelObject *object, glLabel *label); +static void object_moved_cb (glLabelObject *object, + gdouble x, gdouble y, glLabel *label); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelClass), + NULL, + NULL, + (GClassInitFunc) gl_label_class_init, + NULL, + NULL, + sizeof (glLabel), + 0, + (GInstanceInitFunc) gl_label_instance_init, + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "glLabel", &info, 0); + } + + return type; +} + +static void +gl_label_class_init (glLabelClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_LABEL, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_finalize; + + signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals[NAME_CHANGED] = + g_signal_new ("name_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelClass, name_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals[MODIFIED_CHANGED] = + g_signal_new ("modified_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelClass, modified_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_instance_init (glLabel *label) +{ + gl_debug (DEBUG_LABEL, "START"); + + label->private = g_new0 (glLabelPrivate, 1); + label->private->merge = gl_merge_new(); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_finalize (GObject *object) +{ + glLabel *label; + GList *p, *p_next; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL (object)); + + label = GL_LABEL (object); + + gl_template_free (&label->private->template); + + for (p = label->objects; p != NULL; p = p_next) { + p_next = p->next; /* NOTE: p will be left dangling */ + g_object_unref (G_OBJECT(p->data)); + } + + gl_merge_free (&label->private->merge); + + g_free (label->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_LABEL, "END"); +} + +GObject * +gl_label_new (void) +{ + glLabel *label; + + gl_debug (DEBUG_LABEL, "START"); + + label = g_object_new (gl_label_get_type(), NULL); + + label->private->modified_flag = FALSE; + + gl_debug (DEBUG_LABEL, "END"); + + return G_OBJECT (label); +} + + +/*****************************************************************************/ +/* Add object to label. */ +/*****************************************************************************/ +void +gl_label_add_object (glLabel *label, + glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + g_return_if_fail (GL_IS_LABEL_OBJECT (object)); + + object->parent = label; + label->objects = g_list_append (label->objects, object); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + g_signal_connect (G_OBJECT(object), "changed", + G_CALLBACK(object_changed_cb), label); + + g_signal_connect (G_OBJECT(object), "moved", + G_CALLBACK(object_moved_cb), label); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Remove object from label. */ +/*****************************************************************************/ +void +gl_label_remove_object (glLabel *label, + glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + g_return_if_fail (GL_IS_LABEL_OBJECT (object)); + + object->parent = NULL; + label->objects = g_list_remove (label->objects, object); + + if ( G_OBJECT(label)->ref_count /* not finalized */ ) { + + g_signal_handlers_disconnect_by_func (object, + G_CALLBACK(object_changed_cb), + label); + g_signal_handlers_disconnect_by_func (object, + G_CALLBACK(object_moved_cb), + label); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + } + + gl_debug (DEBUG_LABEL, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Object changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +object_changed_cb (glLabelObject *object, glLabel *label) +{ + + if ( !label->private->modified_flag ) { + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + } + + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Object moved callback. */ +/*---------------------------------------------------------------------------*/ +static void +object_moved_cb (glLabelObject *object, gdouble x, gdouble y, glLabel *label) +{ + + if ( !label->private->modified_flag ) { + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + } + + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); +} + +/****************************************************************************/ +/* Bring label object to front/top. */ +/****************************************************************************/ +void +gl_label_raise_object_to_top (glLabel *label, glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + /* Move to end of list, representing front most object */ + label->objects = g_list_remove (label->objects, object); + label->objects = g_list_append (label->objects, object); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Send label object to rear/bottom. */ +/****************************************************************************/ +void +gl_label_lower_object_to_bottom (glLabel *label, glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + /* Move to front of list, representing rear most object */ + label->objects = g_list_remove (label->objects, object); + label->objects = g_list_prepend (label->objects, object); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* set template. */ +/****************************************************************************/ +extern void +gl_label_set_template (glLabel *label, + glTemplate *template) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_template_free (&label->private->template); + label->private->template = gl_template_dup (template); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* set rotate flag. */ +/****************************************************************************/ +extern void +gl_label_set_rotate_flag (glLabel *label, + gboolean rotate_flag) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + label->private->rotate_flag = rotate_flag; + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Get template. */ +/****************************************************************************/ +glTemplate * +gl_label_get_template (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_debug (DEBUG_LABEL, "END"); + + return gl_template_dup (label->private->template); +} + +/****************************************************************************/ +/* Get rotate flag. */ +/****************************************************************************/ +gboolean +gl_label_get_rotate_flag (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_debug (DEBUG_LABEL, "END"); + + return label->private->rotate_flag; +} + +/****************************************************************************/ +/* Get label size. */ +/****************************************************************************/ +void +gl_label_get_size (glLabel * label, + gdouble *w, + gdouble *h) +{ + glTemplate *template; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + template = label->private->template; + if ( !template ) { + gl_debug (DEBUG_LABEL, "END -- template NULL"); + *w = *h = 0; + return; + } + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + if (!label->private->rotate_flag) { + *w = template->label_width; + *h = template->label_height; + } else { + *w = template->label_height; + *h = template->label_width; + } + break; + + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + *w = *h = 2.0 * template->label_radius; + break; + + default: + g_warning ("Unknown template label style %d", template->style); + *w = *h = 0; + break; + } + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* set merge information structure. */ +/****************************************************************************/ +extern void +gl_label_set_merge (glLabel * label, + glMerge * merge) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_merge_free (&label->private->merge); + label->private->merge = gl_merge_dup (merge); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Get merge information structure. */ +/****************************************************************************/ +glMerge * +gl_label_get_merge (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_debug (DEBUG_LABEL, "END"); + + return gl_merge_dup (label->private->merge); +} + +/****************************************************************************/ +/* return filename. */ +/****************************************************************************/ +gchar * +gl_label_get_filename (glLabel * label) +{ + gl_debug (DEBUG_LABEL, ""); + + return g_strdup ( label->private->filename ); +} + +/****************************************************************************/ +/* return short filename. */ +/****************************************************************************/ +gchar * +gl_label_get_short_name (glLabel * label) +{ + gl_debug (DEBUG_LABEL, ""); + + if ( label->private->filename == NULL ) { + + if ( label->private->untitled_instance == 0 ) { + label->private->untitled_instance = ++untitled; + } + + return g_strdup_printf ( _("%s %d"), _("Untitled"), + label->private->untitled_instance ); + + } else { + + return g_path_get_basename ( label->private->filename ); + + } +} + +/****************************************************************************/ +/* Is label modified? */ +/****************************************************************************/ +gboolean +gl_label_is_modified (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "return %d", label->private->modified_flag); + return label->private->modified_flag; +} + +/****************************************************************************/ +/* Is label untitled? */ +/****************************************************************************/ +gboolean +gl_label_is_untitled (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "return %d",(label->private->filename == NULL)); + return (label->private->filename == NULL); +} + +/****************************************************************************/ +/* Can undo? */ +/****************************************************************************/ +gboolean +gl_label_can_undo (glLabel * label) +{ + return FALSE; +} + + +/****************************************************************************/ +/* Can redo? */ +/****************************************************************************/ +gboolean +gl_label_can_redo (glLabel * label) +{ + return FALSE; +} + + +/****************************************************************************/ +/* Set filename. */ +/****************************************************************************/ +void +gl_label_set_filename (glLabel *label, + const gchar *filename) +{ + label->private->filename = g_strdup (filename); + + g_signal_emit (G_OBJECT(label), signals[NAME_CHANGED], 0); +} + +/****************************************************************************/ +/* Clear modified flag. */ +/****************************************************************************/ +void +gl_label_clear_modified (glLabel *label) +{ + + if ( label->private->modified_flag ) { + + label->private->modified_flag = FALSE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + } + +} + + + diff --git a/glabels2/src/label.h b/glabels2/src/label.h new file mode 100644 index 00000000..2d4ad166 --- /dev/null +++ b/glabels2/src/label.h @@ -0,0 +1,107 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.h: GLabels label module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __LABEL_H__ +#define __LABEL_H__ + +#include + +#include "merge.h" +#include "template.h" + +G_BEGIN_DECLS + +#define GL_TYPE_LABEL (gl_label_get_type ()) +#define GL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL, glLabel)) +#define GL_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL, glLabelClass)) +#define GL_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL)) +#define GL_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL)) + +typedef struct _glLabel glLabel; +typedef struct _glLabelClass glLabelClass; + +typedef struct _glLabelPrivate glLabelPrivate; + +#include "label-object.h" +struct _glLabel { + GObject object; + + GList *objects; + + glLabelPrivate *private; +}; + +struct _glLabelClass { + GObjectClass parent_class; + + void (*changed) (glLabel *label, gpointer user_data); + + void (*name_changed) (glLabel *label, gpointer user_data); + + void (*modified_changed) (glLabel *label, gpointer user_data); + +}; + + +extern GType gl_label_get_type (void); + +extern GObject *gl_label_new (void); + +extern void gl_label_add_object (glLabel *label, + glLabelObject *object); +extern void gl_label_remove_object (glLabel *label, + glLabelObject *object); +extern void gl_label_raise_object_to_top (glLabel *label, + glLabelObject * object); +extern void gl_label_lower_object_to_bottom (glLabel *label, + glLabelObject * object); + +extern void gl_label_set_template (glLabel * label, + glTemplate *template); + +extern void gl_label_set_rotate_flag (glLabel * label, + gboolean rotate_flag); + +extern glTemplate *gl_label_get_template (glLabel * label); +extern gboolean gl_label_get_rotate_flag (glLabel * label); +extern void gl_label_get_size (glLabel * label, + gdouble *w, + gdouble *h); + +extern void gl_label_set_merge (glLabel * label, + glMerge * merge); +extern glMerge *gl_label_get_merge (glLabel * label); + +extern gchar *gl_label_get_filename (glLabel * label); +extern gchar *gl_label_get_short_name (glLabel * label); +extern gboolean gl_label_is_modified (glLabel * label); +extern gboolean gl_label_is_untitled (glLabel * label); +extern gboolean gl_label_can_undo (glLabel * label); +extern gboolean gl_label_can_redo (glLabel * label); + +extern void gl_label_set_filename (glLabel *label, + const gchar *filename); +extern void gl_label_clear_modified (glLabel *label); + +G_END_DECLS + + +#endif /* __LABEL_H__ */ diff --git a/glabels2/src/marshal.list b/glabels2/src/marshal.list new file mode 100644 index 00000000..9a1941c1 --- /dev/null +++ b/glabels2/src/marshal.list @@ -0,0 +1,6 @@ +VOID:VOID +VOID:BOOLEAN +VOID:INT +VOID:INT,INT +VOID:DOUBLE,DOUBLE +BOOLEAN:OBJECT diff --git a/glabels2/src/mdi-child.c b/glabels2/src/mdi-child.c new file mode 100644 index 00000000..80fb5ba5 --- /dev/null +++ b/glabels2/src/mdi-child.c @@ -0,0 +1,363 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi-child.c: gLabels MDI child module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi-child.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#include + +#include "mdi-child.h" +#include "xml-label.h" +#include "label.h" +#include "view.h" +#include "marshal.h" +#include "debug.h" + +struct _glMDIChildPrivate +{ + GtkWidget *tab_label; +}; + +enum { + STATE_CHANGED, + UNDO_REDO_STATE_CHANGED, + LAST_SIGNAL +}; + +static void gl_mdi_child_class_init (glMDIChildClass *klass); +static void gl_mdi_child_init (glMDIChild *mdi); +static void gl_mdi_child_finalize (GObject *obj); +static void gl_mdi_child_destroy (GtkObject *obj); + +static void gl_mdi_child_real_state_changed (glMDIChild* child); + +static GtkWidget *gl_mdi_child_create_view (BonoboMDIChild *child); + +static void gl_mdi_child_document_state_changed_handler (glLabel *label, + glMDIChild* child); + +static void gl_mdi_child_document_can_undo_redo_handler (glLabel *label, + gboolean can, glMDIChild* child); + +static gchar* gl_mdi_child_get_config_string (BonoboMDIChild *child, gpointer data); + +static BonoboMDIChildClass *parent_class = NULL; +static guint mdi_child_signals[LAST_SIGNAL] = { 0 }; + + +GType +gl_mdi_child_get_type (void) +{ + static GType mdi_child_type = 0; + + gl_debug (DEBUG_MDI, "START"); + + if (mdi_child_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (glMDIChildClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gl_mdi_child_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (glMDIChild), + 0, /* n_preallocs */ + (GInstanceInitFunc) gl_mdi_child_init + }; + + mdi_child_type = g_type_register_static (BONOBO_TYPE_MDI_CHILD, + "glMDIChild", + &our_info, + 0); + } + + gl_debug (DEBUG_MDI, "END"); + + return mdi_child_type; +} + +static void +gl_mdi_child_class_init (glMDIChildClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gl_debug (DEBUG_MDI, "START"); + + parent_class = g_type_class_peek_parent (klass); + + gobject_class->finalize = gl_mdi_child_finalize; + + klass->state_changed = gl_mdi_child_real_state_changed; + klass->undo_redo_state_changed = NULL; + + mdi_child_signals [STATE_CHANGED] = + g_signal_new ("state_changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (glMDIChildClass, state_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + mdi_child_signals [UNDO_REDO_STATE_CHANGED] = + g_signal_new ("undo_redo_state_changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (glMDIChildClass, undo_redo_state_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + BONOBO_MDI_CHILD_CLASS (klass)->create_view = + (BonoboMDIChildViewCreator)(gl_mdi_child_create_view); + + BONOBO_MDI_CHILD_CLASS (klass)->get_config_string = + (BonoboMDIChildConfigFunc)(gl_mdi_child_get_config_string); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_child_init (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + child->priv = g_new0 (glMDIChildPrivate, 1); + + child->priv->tab_label = NULL; + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_child_finalize (GObject *obj) +{ + glMDIChild *child; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (obj != NULL); + + child = GL_MDI_CHILD (obj); + + g_return_if_fail (GL_IS_MDI_CHILD (child)); + g_return_if_fail (child->priv != NULL); + + if (child->label != NULL) + g_object_unref (G_OBJECT (child->label)); + + g_free (child->priv); + + G_OBJECT_CLASS (parent_class)->finalize (obj); + + gl_debug (DEBUG_MDI, "END"); +} + +static void gl_mdi_child_real_state_changed (glMDIChild* child) +{ + gchar* docname = NULL; + gchar* tab_name = NULL; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (child != NULL); + g_return_if_fail (child->label != NULL); + + docname = gl_label_get_short_name (child->label); + g_return_if_fail (docname != NULL); + + if (gl_label_is_modified (child->label)) + { + tab_name = g_strdup_printf ("%s*", docname); + } + else + { + tab_name = g_strdup_printf ("%s", docname); + } + + g_free (docname); + + g_return_if_fail (tab_name != NULL); + + bonobo_mdi_child_set_name (BONOBO_MDI_CHILD (child), tab_name); + + g_free (tab_name); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_child_document_state_changed_handler (glLabel *label, glMDIChild* child) +{ + gl_debug (DEBUG_MDI, ""); + g_return_if_fail (child->label == label); + + g_signal_emit (G_OBJECT (child), mdi_child_signals [STATE_CHANGED], 0); +} + +static void +gl_mdi_child_document_can_undo_redo_handler (glLabel *label, gboolean can, + glMDIChild* child) +{ + gl_debug (DEBUG_MDI, ""); + g_return_if_fail (child->label == label); + + g_signal_emit (G_OBJECT (child), mdi_child_signals [UNDO_REDO_STATE_CHANGED], 0); +} + + +static void +gl_mdi_child_connect_signals (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + g_signal_connect (G_OBJECT (child->label), "name_changed", + G_CALLBACK (gl_mdi_child_document_state_changed_handler), + child); + g_signal_connect (G_OBJECT (child->label), "modified_changed", + G_CALLBACK (gl_mdi_child_document_state_changed_handler), + child); +#if 0 + g_signal_connect (G_OBJECT (child->label), "can_undo", + G_CALLBACK (gl_mdi_child_document_can_undo_redo_handler), + child); + g_signal_connect (G_OBJECT (child->label), "can_redo", + G_CALLBACK (gl_mdi_child_document_can_undo_redo_handler), + child); +#endif + + gl_debug (DEBUG_MDI, "END"); +} + +/** + * gl_mdi_child_new: + * + * Creates a new #glMDIChild object. + * + * Return value: a new #glMDIChild + **/ +glMDIChild* +gl_mdi_child_new (const gchar *tmplt_name, + gboolean rotate_flag) +{ + glMDIChild *child; + gchar *doc_name; + glTemplate *template; + + gl_debug (DEBUG_MDI, "START"); + + child = GL_MDI_CHILD (g_object_new (GL_TYPE_MDI_CHILD, NULL)); + g_return_val_if_fail (child != NULL, NULL); + + child->label = GL_LABEL (gl_label_new ()); + g_return_val_if_fail (child->label != NULL, NULL); + + template = gl_template_from_name (tmplt_name); + gl_label_set_template (child->label, template); + gl_template_free (&template); + gl_label_set_rotate_flag (child->label, rotate_flag); + gl_label_clear_modified (child->label); + + doc_name = gl_label_get_short_name (child->label); + bonobo_mdi_child_set_name (BONOBO_MDI_CHILD (child), doc_name); + g_free(doc_name); + + gl_mdi_child_connect_signals (child); + + gl_debug (DEBUG_MDI, "END"); + + return child; +} + +glMDIChild* +gl_mdi_child_new_with_uri (const gchar *uri, GError **error) +{ + glMDIChild *child; + glLabel *doc; + glXMLLabelStatus status; + + gl_debug (DEBUG_MDI, "START"); + + doc = gl_xml_label_open (uri, &status); + + if (doc == NULL) + { + return NULL; + } + + child = GL_MDI_CHILD (g_object_new (GL_TYPE_MDI_CHILD, NULL)); + g_return_val_if_fail (child != NULL, NULL); + + child->label = doc; + g_return_val_if_fail (child->label != NULL, NULL); + + gl_mdi_child_real_state_changed (child); + + gl_mdi_child_connect_signals (child); + + gl_debug (DEBUG_MDI, "END"); + + return child; +} + +static GtkWidget * +gl_mdi_child_create_view (BonoboMDIChild *child) +{ + glView *new_view; + + gl_debug (DEBUG_MDI, "START"); + + g_return_val_if_fail (child != NULL, NULL); + g_return_val_if_fail (GL_IS_MDI_CHILD (child), NULL); + + new_view = GL_VIEW(gl_view_new (GL_MDI_CHILD (child)->label)); + + gtk_widget_show_all (GTK_WIDGET (new_view)); + + gl_debug (DEBUG_MDI, "END"); + + return GTK_WIDGET (new_view); +} + +static gchar* +gl_mdi_child_get_config_string (BonoboMDIChild *child, gpointer data) +{ + glMDIChild *c; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (child != NULL, NULL); + g_return_val_if_fail (GL_IS_MDI_CHILD (child), NULL); + + c = GL_MDI_CHILD (child); + + return gl_label_get_filename (c->label); +} diff --git a/glabels2/src/mdi-child.h b/glabels2/src/mdi-child.h new file mode 100644 index 00000000..9e00cf47 --- /dev/null +++ b/glabels2/src/mdi-child.h @@ -0,0 +1,79 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi-child.h: gLabels MDI child module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi-child.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#ifndef __MDI_CHILD_H__ +#define __MDI_CHILD_H__ + +#include + +#include "label.h" + +#define GL_TYPE_MDI_CHILD (gl_mdi_child_get_type ()) +#define GL_MDI_CHILD(o) (GTK_CHECK_CAST ((o), GL_TYPE_MDI_CHILD, glMDIChild)) +#define GL_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MDI_CHILD, \ + glMDIChildClass)) +#define GL_IS_MDI_CHILD(o) (GTK_CHECK_TYPE ((o), GL_TYPE_MDI_CHILD)) +#define GL_IS_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MDI_CHILD)) +#define GL_MDI_CHILD_GET_CLASS(o) (GTK_CHECK_GET_CLASS ((o), GL_TYPE_MDI_CHILD, glMdiChildClass)) + + +typedef struct _glMDIChild glMDIChild; +typedef struct _glMDIChildClass glMDIChildClass; + +typedef struct _glMDIChildPrivate glMDIChildPrivate; + +struct _glMDIChild +{ + BonoboMDIChild child; + + glLabel* label; + glMDIChildPrivate *priv; +}; + +struct _glMDIChildClass +{ + BonoboMDIChildClass parent_class; + + /* MDI child state changed */ + void (*state_changed) (glMDIChild *child); + + void (*undo_redo_state_changed) (glMDIChild *child); +}; + + +GtkType gl_mdi_child_get_type (void) G_GNUC_CONST; + +glMDIChild* gl_mdi_child_new (const gchar *tmplt_name, + gboolean rotate_flag); + +glMDIChild* gl_mdi_child_new_with_uri (const gchar *uri, GError **error); + +#endif /* __MDI_CHILD_H__ */ + diff --git a/glabels2/src/mdi.c b/glabels2/src/mdi.c new file mode 100644 index 00000000..3e0dc58f --- /dev/null +++ b/glabels2/src/mdi.c @@ -0,0 +1,857 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi.c: gLabels MDI module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#include + +#include +#include +#include + +#include + +#include "mdi.h" +#include "mdi-child.h" +#include "glabels.h" +#include "menus.h" +#include "prefs.h" +#include "recent.h" +#include "file.h" +#include "view.h" +#include "debug.h" +#include "gnome-recent-view.h" + +#include +#include + +#include + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define DEFAULT_WINDOW_WIDTH 500 +#define DEFAULT_WINDOW_HEIGHT 375 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glMDIPrivate +{ + gint untitled_number; +}; + + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static BonoboMDIClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_mdi_class_init (glMDIClass *klass); +static void gl_mdi_init (glMDI *mdi); +static void gl_mdi_finalize (GObject *object); + +static void gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win); +static void gl_mdi_set_app_toolbar_style (BonoboWindow *win); +static void gl_mdi_set_app_statusbar_style (BonoboWindow *win); + +static gint gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child); +static gint gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view); +static gint gl_mdi_remove_child_cb (BonoboMDI *mdi, BonoboMDIChild *child); +static gint gl_mdi_remove_view_cb (BonoboMDI *mdi, GtkWidget *view); + +static void gl_mdi_view_changed_cb (BonoboMDI *mdi, GtkWidget *old_view); +static void gl_mdi_child_changed_cb (BonoboMDI *mdi, BonoboMDIChild *old_child); +static void gl_mdi_child_state_changed_cb (glMDIChild *child); + +static void gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi); + +static void gl_mdi_view_menu_item_toggled_cb ( + BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + BonoboWindow *win); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_mdi_get_type (void) +{ + static GType mdi_type = 0; + + if (mdi_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (glMDIClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gl_mdi_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (glMDI), + 0, /* n_preallocs */ + (GInstanceInitFunc) gl_mdi_init + }; + + mdi_type = g_type_register_static (BONOBO_TYPE_MDI, + "glMDI", + &our_info, + 0); + } + + return mdi_type; +} + +static void +gl_mdi_class_init (glMDIClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + gl_debug (DEBUG_MDI, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_mdi_finalize; + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_init (glMDI *mdi) +{ + gl_debug (DEBUG_MDI, "START"); + + bonobo_mdi_construct (BONOBO_MDI (mdi), "glabels", "gLabels", + DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); + + mdi->priv = g_new0 (glMDIPrivate, 1); + + mdi->priv->untitled_number = 0; + + bonobo_mdi_set_ui_template_file (BONOBO_MDI (mdi), + GLABELS_UI_DIR "glabels-ui.xml", + gl_verbs); + + bonobo_mdi_set_child_list_path (BONOBO_MDI (mdi), "/menu/Documents/"); + + /* Connect signals */ + g_signal_connect (G_OBJECT (mdi), "top_window_created", + G_CALLBACK (gl_mdi_app_created_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "add_child", + G_CALLBACK (gl_mdi_add_child_cb), NULL); + g_signal_connect (G_OBJECT (mdi), "add_view", + G_CALLBACK (gl_mdi_add_view_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "remove_child", + G_CALLBACK (gl_mdi_remove_child_cb), NULL); + g_signal_connect (G_OBJECT (mdi), "remove_view", + G_CALLBACK (gl_mdi_remove_view_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "child_changed", + G_CALLBACK (gl_mdi_child_changed_cb), NULL); + g_signal_connect (G_OBJECT (mdi), "view_changed", + G_CALLBACK (gl_mdi_view_changed_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "all_windows_destroyed", + G_CALLBACK (gl_file_exit), NULL); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_finalize (GObject *object) +{ + glMDI *mdi; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (object != NULL); + + mdi = GL_MDI (object); + + g_return_if_fail (GL_IS_MDI (mdi)); + g_return_if_fail (mdi->priv != NULL); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + g_free (mdi->priv); + + gl_debug (DEBUG_MDI, "END"); +} + + +/*****************************************************************************/ +/* NEW mdi objecg. */ +/*****************************************************************************/ +glMDI* +gl_mdi_new (void) +{ + glMDI *mdi; + + gl_debug (DEBUG_MDI, "START"); + + mdi = GL_MDI (g_object_new (GL_TYPE_MDI, NULL)); + g_return_val_if_fail (mdi != NULL, NULL); + + gl_debug (DEBUG_MDI, "END"); + return mdi; +} + +/*---------------------------------------------------------------------------*/ +/* App created callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win) +{ + GtkWidget *widget; + BonoboControl *control; + BonoboUIComponent *ui_component; + GnomeRecentView *view; + GnomeRecentModel *model; + + static GtkTargetEntry drag_types[] = + { + { "text/uri-list", 0, 0 }, + }; + + static gint n_drag_types = + sizeof (drag_types) / sizeof (drag_types [0]); + + gl_debug (DEBUG_MDI, "START"); + + ui_component = bonobo_mdi_get_ui_component_from_window (win); + g_return_if_fail (ui_component != NULL); + + /* Set the toolbar style according to prefs */ + gl_mdi_set_app_toolbar_style (win); + + /* Add listener fo the view menu */ + bonobo_ui_component_add_listener (ui_component, "ViewToolbar", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + + bonobo_ui_component_add_listener (ui_component, "ToolbarSystem", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + bonobo_ui_component_add_listener (ui_component, "ToolbarIcon", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + bonobo_ui_component_add_listener (ui_component, "ToolbarIconText", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + bonobo_ui_component_add_listener (ui_component, "ToolbarTooltips", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + + + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_no_docs_sensible_verbs, + FALSE); + + /* add a GeditRecentView object */ + model = gl_recent_get_model (); + view = GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component, + "/menu/File/Recents")); + gnome_recent_view_set_model (view, model); + + g_signal_connect (G_OBJECT (view), "activate", + G_CALLBACK (gl_file_open_recent), win); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Menu item togglded callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_view_menu_item_toggled_cb ( + BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + BonoboWindow *win) +{ + gboolean s; + + gl_debug (DEBUG_MDI, "%s toggled to '%s'", path, state); + + s = (strcmp (state, "1") == 0); + + if ((strcmp (path, "ViewToolbar") == 0) && + (s != gl_prefs->toolbar_visible)) + { + gl_prefs->toolbar_visible = s; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if (s && (strcmp (path, "ToolbarSystem") == 0) && + (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_SYSTEM)) + { + gl_prefs->toolbar_buttons_style = GL_TOOLBAR_SYSTEM; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if (s && (strcmp (path, "ToolbarIcon") == 0) && + (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_ICONS)) + { + gl_prefs->toolbar_buttons_style = GL_TOOLBAR_ICONS; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if (s && (strcmp (path, "ToolbarIconText") == 0) && + (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT)) + { + gl_prefs->toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if ((strcmp (path, "ToolbarTooltips") == 0) && + (s != gl_prefs->toolbar_view_tooltips)) + { + gl_prefs->toolbar_view_tooltips = s; + gl_mdi_set_app_toolbar_style (win); + + return; + } + +} + +/*---------------------------------------------------------------------------*/ +/* Set toolbar style. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_set_app_toolbar_style (BonoboWindow *win) +{ + BonoboUIComponent *ui_component; + GConfClient *client; + gboolean labels; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (BONOBO_IS_WINDOW (win)); + + ui_component = bonobo_mdi_get_ui_component_from_window (win); + g_return_if_fail (ui_component != NULL); + + bonobo_ui_component_freeze (ui_component, NULL); + + /* Updated view menu */ + gl_menus_set_verb_state (ui_component, + "/commands/ViewToolbar", + gl_prefs->toolbar_visible); + + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarSystem", + gl_prefs->toolbar_visible); + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarIcon", + gl_prefs->toolbar_visible); + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarIconText", + gl_prefs->toolbar_visible); + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarTooltips", + gl_prefs->toolbar_visible); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarSystem", + gl_prefs->toolbar_buttons_style == GL_TOOLBAR_SYSTEM); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarIcon", + gl_prefs->toolbar_buttons_style == GL_TOOLBAR_ICONS); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarIconText", + gl_prefs->toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarTooltips", + gl_prefs->toolbar_view_tooltips); + + + /* Actually update toolbar style */ + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", + "tips", gl_prefs->toolbar_view_tooltips ? "1" : "0", + NULL); + + switch (gl_prefs->toolbar_buttons_style) + { + case GL_TOOLBAR_SYSTEM: + + client = gconf_client_get_default (); + if (client == NULL) + goto error; + + labels = gconf_client_get_bool (client, + "/desktop/gnome/interface/toolbar-labels", NULL); + + g_object_unref (G_OBJECT (client)); + + if (labels) + { + gl_debug (DEBUG_MDI, "SYSTEM: BOTH"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "both", NULL); + + } + else + { + gl_debug (DEBUG_MDI, "SYSTEM: ICONS"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "icons", NULL); + } + + break; + + case GL_TOOLBAR_ICONS: + gl_debug (DEBUG_MDI, "GLABELS: ICONS"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "icon", NULL); + + break; + + case GL_TOOLBAR_ICONS_AND_TEXT: + gl_debug (DEBUG_MDI, "GLABELS: ICONS_AND_TEXT"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "both", NULL); + + break; + default: + goto error; + break; + } + + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", + "hidden", gl_prefs->toolbar_visible ? "0":"1", NULL); + + error: + bonobo_ui_component_thaw (ui_component, NULL); + + gl_debug (DEBUG_MDI, "END"); +} + + +/*---------------------------------------------------------------------------*/ +/* Child state changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_child_state_changed_cb (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) != BONOBO_MDI_CHILD (child)) + return; + + gl_mdi_set_active_window_title (BONOBO_MDI (glabels_mdi)); + gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Child undo/redo state changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_child_undo_redo_state_changed_cb (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) != BONOBO_MDI_CHILD (child)) + return; + + gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Add child callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + g_signal_connect (G_OBJECT (child), "state_changed", + G_CALLBACK (gl_mdi_child_state_changed_cb), + NULL); + g_signal_connect (G_OBJECT (child), "undo_redo_state_changed", + G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb), + NULL); + + gl_debug (DEBUG_MDI, "END"); + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* Add view callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view) +{ + gl_debug (DEBUG_MDI, "START"); + gl_debug (DEBUG_MDI, "END"); + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* Remove child callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_remove_child_cb (BonoboMDI *mdi, BonoboMDIChild *child) +{ + glLabel* doc; + gboolean close = TRUE; + + gl_debug (DEBUG_MDI, "START"); + + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (GL_MDI_CHILD (child)->label != NULL, FALSE); + + doc = GL_MDI_CHILD (child)->label; + + if (gl_label_is_modified (doc)) + { + GtkWidget *msgbox, *w; + gchar *fname = NULL, *msg = NULL; + gint ret; + gboolean exiting; + + w = GTK_WIDGET (g_list_nth_data (bonobo_mdi_child_get_views (child), 0)); + + if(w != NULL) + bonobo_mdi_set_active_view (mdi, w); + + fname = gl_label_get_short_name (doc); + + msgbox = gtk_message_dialog_new (GTK_WINDOW (bonobo_mdi_get_active_window (mdi)), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + _("Do you want to save the changes you made to the document \"%s\"? \n\n" + "Your changes will be lost if you don't save them."), + fname); + + gl_util_dialog_add_button (GTK_DIALOG (msgbox), + _("Do_n't save"), + GTK_STOCK_NO, + GTK_RESPONSE_NO); + + if (glabels_close_x_button_pressed) + exiting = FALSE; + else if (glabels_exit_button_pressed) + exiting = TRUE; + else + { + /* Delete event generated */ + if (g_list_length (bonobo_mdi_get_windows (BONOBO_MDI (glabels_mdi))) == 1) + exiting = TRUE; + else + exiting = FALSE; + } + +#if 0 + if (exiting) + gl_util_dialog_add_button (GTK_DIALOG (msgbox), + _("_Don't quit"), + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); + else + gl_util_dialog_add_button (GTK_DIALOG (msgbox), + _("_Don't close"), + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); +#endif + + gtk_dialog_add_button (GTK_DIALOG (msgbox), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + + gtk_dialog_add_button (GTK_DIALOG (msgbox), + GTK_STOCK_SAVE, + GTK_RESPONSE_YES); + + gtk_dialog_set_default_response (GTK_DIALOG (msgbox), GTK_RESPONSE_YES); + + gtk_window_set_resizable (GTK_WINDOW (msgbox), FALSE); + + ret = gtk_dialog_run (GTK_DIALOG (msgbox)); + + gtk_widget_destroy (msgbox); + + g_free (fname); + g_free (msg); + + switch (ret) + { + case GTK_RESPONSE_YES: + close = gl_file_save (GL_MDI_CHILD (child)); + break; + case GTK_RESPONSE_NO: + close = TRUE; + break; + default: + close = FALSE; + } + + gl_debug (DEBUG_MDI, "CLOSE: %s", close ? "TRUE" : "FALSE"); + } + + /* FIXME: there is a bug if you "close all" >1 docs, don't save the document + * and then don't close the last one. + */ + /* Disable to avoid the bug */ + /* + if (close) + { + g_signal_handlers_disconnect_by_func (child, + G_CALLBACK (gl_mdi_child_state_changed_cb), + NULL); + g_signal_handlers_disconnect_by_func (GTK_OBJECT (child), + G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb), + NULL); + } + */ + + gl_debug (DEBUG_MDI, "END"); + return close; +} + +/*---------------------------------------------------------------------------*/ +/* Remove view callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_remove_view_cb (BonoboMDI *mdi, GtkWidget *view) +{ + gl_debug (DEBUG_MDI, ""); + gl_debug (DEBUG_MDI, "END"); + + return TRUE; +} + +/*****************************************************************************/ +/* Set title of active window. */ +/*****************************************************************************/ +void +gl_mdi_set_active_window_title (BonoboMDI *mdi) +{ + BonoboMDIChild* active_child = NULL; + glLabel* doc = NULL; + gchar* docname = NULL; + gchar* title = NULL; + + gl_debug (DEBUG_MDI, "START"); + + + active_child = bonobo_mdi_get_active_child (mdi); + if (active_child == NULL) + return; + + doc = GL_MDI_CHILD (active_child)->label; + g_return_if_fail (doc != NULL); + + /* Set active window title */ + docname = gl_label_get_short_name (doc); + g_return_if_fail (docname != NULL); + + if (gl_label_is_modified (doc)) + { + title = g_strdup_printf ("%s %s - glabels", + docname, _("(modified)")); + } + else + { + title = g_strdup_printf ("%s - glabels", docname); + + } + + gtk_window_set_title (GTK_WINDOW (bonobo_mdi_get_active_window (mdi)), title); + + g_free (docname); + g_free (title); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Child changed callback. */ +/*---------------------------------------------------------------------------*/ +static +void gl_mdi_child_changed_cb (BonoboMDI *mdi, BonoboMDIChild *old_child) +{ + gl_debug (DEBUG_MDI, "START"); + + gl_mdi_set_active_window_title (mdi); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* View changed callback. */ +/*---------------------------------------------------------------------------*/ +static +void gl_mdi_view_changed_cb (BonoboMDI *mdi, GtkWidget *old_view) +{ + BonoboWindow *win; + GtkWidget* status; + GtkWidget *active_view; + + gl_debug (DEBUG_MDI, "START"); + + gl_mdi_set_active_window_verbs_sensitivity (mdi); + + active_view = bonobo_mdi_get_active_view (mdi); + + win = bonobo_mdi_get_active_window (mdi); + g_return_if_fail (win != NULL); + + gl_debug (DEBUG_MDI, "END"); +} + +/*****************************************************************************/ +/* Set sensitivity of verbs in active window. */ +/*****************************************************************************/ +void +gl_mdi_set_active_window_verbs_sensitivity (BonoboMDI *mdi) +{ + /* FIXME: it is too slooooooow! - Paolo */ + + BonoboWindow* active_window = NULL; + BonoboMDIChild* active_child = NULL; + glLabel* doc = NULL; + BonoboUIComponent *ui_component; + + gl_debug (DEBUG_MDI, "START"); + + active_window = bonobo_mdi_get_active_window (mdi); + + if (active_window == NULL) + return; + + ui_component = bonobo_mdi_get_ui_component_from_window (active_window); + g_return_if_fail (ui_component != NULL); + + active_child = bonobo_mdi_get_active_child (mdi); + + bonobo_ui_component_freeze (ui_component, NULL); + + if (active_child == NULL) + { + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_no_docs_sensible_verbs, FALSE); + goto end; + } + else + { + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_all_sensible_verbs, TRUE); + } + + doc = GL_MDI_CHILD (active_child)->label; + g_return_if_fail (doc != NULL); + + if (!gl_label_can_undo (doc)) + gl_menus_set_verb_sensitive (ui_component, + "/commands/EditUndo", FALSE); + + if (!gl_label_can_redo (doc)) + gl_menus_set_verb_sensitive (ui_component, + "/commands/EditRedo", FALSE); + + if (!gl_label_is_modified (doc)) + { + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_not_modified_doc_sensible_verbs, + FALSE); + goto end; + } + +end: + bonobo_ui_component_thaw (ui_component, NULL); + + gl_debug (DEBUG_MDI, "END"); +} + + +/*****************************************************************************/ +/* Set sensitivity of undo/redo verbs in active window. */ +/*****************************************************************************/ +static void +gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi) +{ + BonoboWindow* active_window = NULL; + BonoboMDIChild* active_child = NULL; + glLabel* doc = NULL; + BonoboUIComponent *ui_component; + + gl_debug (DEBUG_MDI, "START"); + + active_window = bonobo_mdi_get_active_window (mdi); + g_return_if_fail (active_window != NULL); + + ui_component = bonobo_mdi_get_ui_component_from_window (active_window); + g_return_if_fail (ui_component != NULL); + + active_child = bonobo_mdi_get_active_child (mdi); + doc = GL_MDI_CHILD (active_child)->label; + g_return_if_fail (doc != NULL); + + bonobo_ui_component_freeze (ui_component, NULL); + + gl_menus_set_verb_sensitive (ui_component, "/commands/EditUndo", + gl_label_can_undo (doc)); + + gl_menus_set_verb_sensitive (ui_component, "/commands/EditRedo", + gl_label_can_redo (doc)); + + bonobo_ui_component_thaw (ui_component, NULL); + + gl_debug (DEBUG_MDI, "END"); +} + diff --git a/glabels2/src/mdi.h b/glabels2/src/mdi.h new file mode 100644 index 00000000..3f215a36 --- /dev/null +++ b/glabels2/src/mdi.h @@ -0,0 +1,73 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi.h: gLabels MDI module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#ifndef __MDI_H__ +#define __MDI_H__ + +#include + +#define GL_TYPE_MDI (gl_mdi_get_type ()) +#define GL_MDI(obj) (GTK_CHECK_CAST ((obj), GL_TYPE_MDI, glMDI)) +#define GL_MDI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MDI, glMDIClass)) +#define GL_IS_MDI(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_MDI)) +#define GL_IS_MDI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MDI)) +#define GL_MDI_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_MDI, glMdiClass)) + + +typedef struct _glMDI glMDI; +typedef struct _glMDIClass glMDIClass; + +typedef struct _glMDIPrivate glMDIPrivate; + +struct _glMDI +{ + BonoboMDI mdi; + + glMDIPrivate *priv; +}; + +struct _glMDIClass +{ + BonoboMDIClass parent_class; +}; + + +GtkType gl_mdi_get_type (void) G_GNUC_CONST; + +glMDI* gl_mdi_new (void); + +void gl_mdi_set_active_window_title (BonoboMDI *mdi); + +void gl_mdi_update_ui_according_to_preferences (glMDI *mdi); + +void gl_mdi_set_active_window_verbs_sensitivity (BonoboMDI *mdi); + +#endif /* __MDI_H__ */ + diff --git a/glabels2/src/menus.c b/glabels2/src/menus.c new file mode 100644 index 00000000..f2c05e7d --- /dev/null +++ b/glabels2/src/menus.c @@ -0,0 +1,260 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * menus.c: GLabels menus module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-menus.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#include + +#include "menus.h" +#include "commands.h" +#include "tools.h" +#include "glabels.h" + +BonoboUIVerb gl_verbs [] = { + BONOBO_UI_VERB ("FileNew", gl_cmd_file_new), + BONOBO_UI_VERB ("FileOpen", gl_cmd_file_open), + BONOBO_UI_VERB ("FileSave", gl_cmd_file_save), + BONOBO_UI_VERB ("FileSaveAs", gl_cmd_file_save_as), + BONOBO_UI_VERB ("FilePrint", gl_cmd_file_print), + BONOBO_UI_VERB ("FileClose", gl_cmd_file_close), + BONOBO_UI_VERB ("FileCloseAll", gl_cmd_file_close_all), + BONOBO_UI_VERB ("FileExit", gl_cmd_file_exit), + BONOBO_UI_VERB ("EditCut", gl_cmd_edit_cut), + BONOBO_UI_VERB ("EditCopy", gl_cmd_edit_copy), + BONOBO_UI_VERB ("EditPaste", gl_cmd_edit_paste), + BONOBO_UI_VERB ("EditDelete", gl_cmd_edit_delete), + BONOBO_UI_VERB ("EditSelectAll", gl_cmd_edit_select_all), + BONOBO_UI_VERB ("EditUnSelectAll", gl_cmd_edit_unselect_all), + BONOBO_UI_VERB ("ToolsArrow", gl_tools_arrow), + BONOBO_UI_VERB ("ToolsText", gl_tools_text), + BONOBO_UI_VERB ("ToolsBox", gl_tools_box), + BONOBO_UI_VERB ("ToolsLine", gl_tools_line), + BONOBO_UI_VERB ("ToolsEllipse", gl_tools_ellipse), + BONOBO_UI_VERB ("ToolsImage", gl_tools_image), + BONOBO_UI_VERB ("ToolsBarcode", gl_tools_barcode), + BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin), + BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout), + BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1), + BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties), + BONOBO_UI_VERB ("SettingsPreferences", gl_cmd_settings_preferences), + BONOBO_UI_VERB ("HelpContents", gl_cmd_help_contents), + BONOBO_UI_VERB ("About", gl_cmd_help_about), + + BONOBO_UI_VERB_END +}; + +gchar* gl_menus_no_docs_sensible_verbs [] = { + "/commands/FileSave", + "/commands/FileSaveAs", + "/commands/FilePrint", + "/commands/FilePrintPreview", + "/commands/FileClose", + "/commands/FileCloseAll", + "/commands/EditUndo", + "/commands/EditRedo", + "/commands/EditCut", + "/commands/EditCopy", + "/commands/EditPaste", + "/commands/EditDelete", + "/commands/EditSelectAll", + "/commands/EditUnSelectAll", + "/commands/ToolsArrow", + "/commands/ToolsText", + "/commands/ToolsLine", + "/commands/ToolsBox", + "/commands/ToolsEllipse", + "/commands/ToolsImage", + "/commands/ToolsBarcode", + "/commands/ToolsZoomIn", + "/commands/ToolsZoomOut", + "/commands/ToolsZoom1to1", + "/commands/ToolsMergeProperties", + + NULL +}; + +gchar* gl_menus_not_modified_doc_sensible_verbs [] = { + "/commands/FileSave", + + NULL +}; + + +void +gl_menus_set_verb_sensitive (BonoboUIComponent *ui_component, gchar* cname, gboolean sensitive) +{ + g_return_if_fail (cname != NULL); + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + bonobo_ui_component_set_prop ( + ui_component, cname, "sensitive", sensitive ? "1" : "0", NULL); +} + +void +gl_menus_set_verb_list_sensitive (BonoboUIComponent *ui_component, gchar** vlist, gboolean sensitive) +{ + g_return_if_fail (vlist != NULL); + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + for ( ; *vlist; ++vlist) + { + bonobo_ui_component_set_prop ( + ui_component, *vlist, "sensitive", sensitive ? "1" : "0", NULL); + } +} + +void +gl_menus_set_verb_state (BonoboUIComponent *ui_component, gchar* cname, gboolean state) +{ + g_return_if_fail (cname != NULL); + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + bonobo_ui_component_set_prop ( + ui_component, cname, "state", state ? "1" : "0", NULL); +} + +void +gl_menus_add_menu_item (BonoboWindow *window, const gchar *path, + const gchar *name, const gchar *label, + const gchar *tooltip, const gchar *stock_pixmap, + BonoboUIVerbFn cb) +{ + BonoboUIComponent *ui_component; + gchar *item_path; + gchar *cmd; + + g_return_if_fail (window != NULL); + g_return_if_fail (path != NULL); + g_return_if_fail (label != NULL); + g_return_if_fail (cb != NULL); + + item_path = g_strconcat (path, name, NULL); + ui_component = bonobo_mdi_get_ui_component_from_window (BONOBO_WINDOW (window)); + if (!bonobo_ui_component_path_exists (ui_component, item_path, NULL)) { + gchar *xml; + + xml = g_strdup_printf ("", name, + label, tooltip); + + + if (stock_pixmap != NULL) { + cmd = g_strdup_printf ("", + name, stock_pixmap); + } + else { + cmd = g_strdup_printf ("", name); + } + + + bonobo_ui_component_set_translate (ui_component, path, + xml, NULL); + + bonobo_ui_component_set_translate (ui_component, "/commands/", + cmd, NULL); + + bonobo_ui_component_add_verb (ui_component, name, cb, NULL); + + g_free (xml); + g_free (cmd); + } + + g_free (item_path); +} + +void +gl_menus_remove_menu_item (BonoboWindow *window, const gchar *path, + const gchar *name) +{ + BonoboUIComponent *ui_component; + gchar *item_path; + + g_return_if_fail (window != NULL); + g_return_if_fail (path != NULL); + g_return_if_fail (name != NULL); + + item_path = g_strconcat (path, name, NULL); + ui_component = bonobo_mdi_get_ui_component_from_window (BONOBO_WINDOW (window)); + + if (bonobo_ui_component_path_exists (ui_component, item_path, NULL)) { + gchar *cmd; + + cmd = g_strdup_printf ("/commands/%s", name); + + bonobo_ui_component_rm (ui_component, item_path, NULL); + bonobo_ui_component_rm (ui_component, cmd, NULL); + + g_free (cmd); + } + + g_free (item_path); +} + +void +gl_menus_add_menu_item_all (const gchar *path, const gchar *name, + const gchar *label, const gchar *tooltip, + const gchar *stock_pixmap, + BonoboUIVerbFn cb) +{ + GList* top_windows; + + top_windows = glabels_get_top_windows (); + g_return_if_fail (top_windows != NULL); + + while (top_windows) + { + BonoboWindow* window = BONOBO_WINDOW (top_windows->data); + + + gl_menus_add_menu_item (window, path, name, label, tooltip, + stock_pixmap, cb); + + top_windows = g_list_next (top_windows); + } +} + +void +gl_menus_remove_menu_item_all (const gchar *path, const gchar *name) +{ + GList* top_windows; + + top_windows = glabels_get_top_windows (); + g_return_if_fail (top_windows != NULL); + + while (top_windows) + { + BonoboWindow* window = BONOBO_WINDOW (top_windows->data); + + + gl_menus_remove_menu_item (window, path, name); + + + top_windows = g_list_next (top_windows); + } +} diff --git a/glabels2/src/menus.h b/glabels2/src/menus.h new file mode 100644 index 00000000..24a0541c --- /dev/null +++ b/glabels2/src/menus.h @@ -0,0 +1,80 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * menus.h: GLabels menus module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-menus.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#ifndef __GL_MENU_H__ +#define __GL_MENU_H__ + +#include +#include +#include + +extern BonoboUIVerb gl_verbs []; +extern gchar* gl_menus_no_docs_sensible_verbs []; +extern gchar* gl_menus_untitled_doc_sensible_verbs []; +extern gchar* gl_menus_not_modified_doc_sensible_verbs []; + +#define gl_menus_all_sensible_verbs gl_menus_no_docs_sensible_verbs + +void gl_menus_set_verb_sensitive (BonoboUIComponent *ui_component, + gchar *cname, + gboolean sensitive); +void gl_menus_set_verb_list_sensitive (BonoboUIComponent *ui_component, + gchar **vlist, + gboolean sensitive); +void gl_menus_set_verb_state (BonoboUIComponent *ui_component, + gchar* cname, + gboolean state); + +/* convenience functions for plugins */ + +void gl_menus_add_menu_item (BonoboWindow *window, + const gchar *path, + const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *stock_pixmap, + BonoboUIVerbFn cb); + +void gl_menus_remove_menu_item (BonoboWindow *window, + const gchar *path, + const gchar *name); + + +void gl_menus_add_menu_item_all (const gchar *path, + const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *stock_pixmap, + BonoboUIVerbFn cb); + +void gl_menus_remove_menu_item_all (const gchar *path, + const gchar *name); + + +#endif /* __GL_MENU_H__ */ diff --git a/glabels2/src/merge-properties.c b/glabels2/src/merge-properties.c new file mode 100644 index 00000000..b55770a5 --- /dev/null +++ b/glabels2/src/merge-properties.c @@ -0,0 +1,270 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_properties.c: document merge properties dialog module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "glabels.h" +#include "mdi.h" +#include "view.h" +#include "merge.h" +#include "merge-ui.h" +#include "merge-properties.h" + +#include "debug.h" + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GtkWidget *dialog; + + glView *view; + glLabel *label; + + GtkWidget *type_entry; + GtkWidget *src_entry; + GtkWidget *field_ws; + + glMergeType src_type; + gchar *field_ws_src; + +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void create_merge_dialog_widgets (GtkDialog * dialog, + PropertyDialogPassback * data); + +static void type_changed_cb (GtkWidget * widget, PropertyDialogPassback * data); +static void src_changed_cb (GtkWidget * widget, PropertyDialogPassback * data); + +static void response_cb (GtkDialog * dialog, gint response, + PropertyDialogPassback * data); + +/****************************************************************************/ +/* Launch merge properties dialog. */ +/****************************************************************************/ +void +gl_merge_properties_dialog (glView * view) +{ + static PropertyDialogPassback *data = NULL; + GtkWidget *dialog; + BonoboWindow *win = glabels_get_active_window (); + + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + + dialog = gtk_dialog_new_with_buttons ( + _("Edit document-merge properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); + + data->dialog = dialog; + data->view = view; + data->label = view->label; + + data->type_entry = NULL; + data->src_entry = NULL; + data->field_ws = NULL; + + create_merge_dialog_widgets (GTK_DIALOG (dialog), data); + + g_signal_connect (G_OBJECT(dialog), "response", + G_CALLBACK(response_cb), data); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create and add start page to druid. */ +/*--------------------------------------------------------------------------*/ +static void +create_merge_dialog_widgets (GtkDialog * dialog, + PropertyDialogPassback * data) +{ + GtkWidget *wvbox, *wframe, *whbox, *wtable, *wlabel, *wcombo, *wscroll; + GList *texts; + glMerge *merge; + glMergeType type; + gchar *src; + GList *fields; + + merge = gl_label_get_merge (data->label); + type = merge->type; + src = merge->src; + fields = merge->field_defs; + gl_merge_free (&merge); + + wvbox = dialog->vbox; + + wframe = gtk_frame_new (_("Source")); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + whbox = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_container_add (GTK_CONTAINER (wframe), whbox); + + wtable = gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_box_pack_start (GTK_BOX (whbox), wtable, FALSE, FALSE, GNOME_PAD); + + wlabel = gtk_label_new (_("Format:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + wcombo = gtk_combo_new (); + gtk_widget_set_usize (wcombo, 400, -1); + texts = gl_merge_get_long_texts_list (); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), texts); + gl_merge_free_long_texts_list (&texts); + data->type_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (data->type_entry), FALSE); + gtk_table_attach_defaults (GTK_TABLE (wtable), wcombo, 1, 2, 0, 1); + gtk_entry_set_text (GTK_ENTRY (data->type_entry), + gl_merge_type_to_long_text (type)); + + wlabel = gtk_label_new (_("Location:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + + data->src_entry = gl_merge_ui_src_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), data->src_entry, 1, 2, 1, + 2); + gl_merge_ui_src_set_type (GL_MERGE_UI_SRC (data->src_entry), type); + gl_merge_ui_src_set_value (GL_MERGE_UI_SRC (data->src_entry), src); + + wframe = gtk_frame_new (_("Fields")); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wscroll = gtk_scrolled_window_new (NULL, NULL); + gtk_container_set_border_width (GTK_CONTAINER (wscroll), 5); + gtk_widget_set_usize (wscroll, 500, 300); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (wframe), wscroll); + + data->field_ws = gl_merge_ui_field_ws_new (); + gtk_container_set_border_width (GTK_CONTAINER (data->field_ws), 10); + gl_merge_ui_field_ws_set_type_src (GL_MERGE_UI_FIELD_WS + (data->field_ws), type, src); + gl_merge_ui_field_ws_set_field_defs (GL_MERGE_UI_FIELD_WS + (data->field_ws), fields); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (wscroll), + data->field_ws); + + g_signal_connect (G_OBJECT (data->type_entry), "changed", + G_CALLBACK (type_changed_cb), data); + g_signal_connect (G_OBJECT (data->src_entry), "changed", + G_CALLBACK (src_changed_cb), data); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. type "changed" callback. */ +/*--------------------------------------------------------------------------*/ +static void +type_changed_cb (GtkWidget * widget, + PropertyDialogPassback * data) +{ + glMergeType type; + gchar *type_text; + + type_text = gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + gl_merge_ui_src_set_type (GL_MERGE_UI_SRC (data->src_entry), type); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. source "changed" callback. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (GtkWidget * widget, + PropertyDialogPassback * data) +{ + glMergeType type; + gchar *type_text, *src; + + type_text = gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + src = gl_merge_ui_src_get_value (GL_MERGE_UI_SRC (data->src_entry)); + gl_merge_ui_field_ws_set_type_src (GL_MERGE_UI_FIELD_WS + (data->field_ws), type, src); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. response callback. */ +/*--------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog * dialog, + gint response, + PropertyDialogPassback * data) +{ + gchar *type_text; + glMerge *merge; + + switch (response) { + + case GTK_RESPONSE_OK: + + merge = gl_merge_new(); + + type_text = + gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + merge->type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + merge->src = + gl_merge_ui_src_get_value (GL_MERGE_UI_SRC (data->src_entry)); + + merge->field_defs = + gl_merge_ui_field_ws_get_field_defs (GL_MERGE_UI_FIELD_WS + (data->field_ws)); + + gl_label_set_merge (data->label, merge); + + gl_merge_free (&merge); + + break; + } + + gtk_widget_destroy (data->dialog); +} diff --git a/glabels2/src/merge-properties.h b/glabels2/src/merge-properties.h new file mode 100644 index 00000000..1d72b587 --- /dev/null +++ b/glabels2/src/merge-properties.h @@ -0,0 +1,29 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_properties.h: document merge properties dialog module header file + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_PROPERTIES_H__ +#define __MERGE_PROPERTIES_H__ + +#include "view.h" + +extern void gl_merge_properties_dialog (glView * view); + +#endif diff --git a/glabels2/src/merge-text.c b/glabels2/src/merge-text.c new file mode 100644 index 00000000..50852e51 --- /dev/null +++ b/glabels2/src/merge-text.c @@ -0,0 +1,272 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_text.c: text-file merge backend module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "merge-text.h" + +#include "debug.h" + +#define LINE_BUF_LEN 1024 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ +static GList * split_fields( gchar *line, gchar delim ); +static void free_fields( GList **fields ); + + +/****************************************************************************/ +/* Open merge source. */ +/****************************************************************************/ +glMergeInput * +gl_merge_text_open (glMergeType type, + GList * field_defs, + gchar * src) +{ + FILE *fp; + glMergeInput *input; + + fp = fopen (src, "r"); + if (fp == NULL) { + return NULL; + } + + input = g_new0 (glMergeInput, 1); + input->type = type; + input->field_defs = field_defs; + input->handle = fp; + + return input; +} + +/****************************************************************************/ +/* Close merge source. */ +/****************************************************************************/ +void +gl_merge_text_close (glMergeInput * input) +{ + if (input != NULL) { + + fclose ((FILE *) input->handle); + g_free (input); + + } +} + +/****************************************************************************/ +/* Get next record from merge source, NULL if no records left (i.e EOF) */ +/****************************************************************************/ +glMergeRecord * +gl_merge_text_get_record (glMergeInput * input) +{ + gchar delim, *loc; + GList *fields, *p; + gint i_field; + glMergeRecord *record = NULL; + glMergeField *field; + gchar line[LINE_BUF_LEN]; + + if (input != NULL) { + + switch (input->type) { + case GL_MERGE_TEXT_TAB: + delim = '\t'; + break; + case GL_MERGE_TEXT_COLON: + delim = ':'; + break; + case GL_MERGE_TEXT_COMMA: + delim = ','; + break; + default: + g_warning ("Unexpected merge type"); + return NULL; + } + + while (fgets (line, LINE_BUF_LEN, (FILE *) input->handle) != + NULL) { + if (TRUE /* TODO: skip blank lines or comments */ ) { + g_strchomp (line); + record = g_new0 (glMergeRecord, 1); + record->select_flag = TRUE; + fields = split_fields (line, delim); + i_field = 1; + for (p=fields; p != NULL; p=p->next) { + loc = + g_strdup_printf ("%d", i_field++); + field = g_new0 (glMergeField, 1); + field->value = g_strdup (p->data); + field->key = + gl_merge_find_key (input-> + field_defs, loc); + record->field_list = + g_list_append (record->field_list, field); + g_free (loc); + } + free_fields (&fields); + return record; + } + } + + } + return NULL; +} + +/****************************************************************************/ +/* Retrieve a list of raw fields (columns in this case) */ +/****************************************************************************/ +GList * +gl_merge_text_get_raw_record (glMergeInput * input) +{ + GList *list = NULL; + gchar line[LINE_BUF_LEN], delim; + GList *fields, *p; + gint i_field; + glMergeRawField *raw_field; + + if (input != NULL) { + + switch (input->type) { + case GL_MERGE_TEXT_TAB: + delim = '\t'; + break; + case GL_MERGE_TEXT_COLON: + delim = ':'; + break; + case GL_MERGE_TEXT_COMMA: + delim = ','; + break; + default: + g_warning ("Unexpected merge type"); + return NULL; + } + + while (fgets (line, LINE_BUF_LEN, (FILE *) input->handle) + != NULL) { + if (TRUE /* TODO: skip blank lines or comments */ ) { + g_strchomp (line); + fields = split_fields (line, delim); + i_field = 1; + for (p=fields; p != NULL; p=p->next) { + raw_field = + g_new0 (glMergeRawField, 1); + raw_field->loc = + g_strdup_printf ("%d", + i_field++); + raw_field->value = g_strdup (p->data); + list = g_list_append (list, raw_field); + } + free_fields (&fields); + break; + } + } + + } + return list; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Split out fields by delimiter while decoding things like "\n". */ +/*---------------------------------------------------------------------------*/ +static GList * split_fields ( gchar *line, + gchar delim ) +{ + GList *list = NULL; + GString *string; + gchar *c; + enum { NORMAL, ESCAPED } state; + + g_return_val_if_fail (line != NULL, NULL); + + state = NORMAL; + string = g_string_new( "" ); + for ( c=line; *c!=0; c++ ) { + + switch (state) { + + case NORMAL: + if ( *c == '\\' ) { + state = ESCAPED; + } else if ( *c != delim ) { + string = g_string_append_c (string, *c); + } else { + list = g_list_append (list, + g_strdup (string->str)); + string = g_string_assign( string, "" ); + } + break; + + case ESCAPED: + switch (*c) { + case 'n': + string = g_string_append_c (string, '\n'); + break; + case 't': + string = g_string_append_c (string, '\t'); + break; + default: + string = g_string_append_c (string, *c); + break; + } + state = NORMAL; + break; + + default: + g_assert_not_reached(); + break; + } + + } + list = g_list_append( list, g_strdup(string->str) ); + g_string_free( string, TRUE ); + + return list; +} + +/*---------------------------------------------------------------------------*/ +/* Free list of fields. */ +/*---------------------------------------------------------------------------*/ +void +free_fields (GList ** list) +{ + GList *p; + + for (p = *list; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*list); + *list = NULL; +} + diff --git a/glabels2/src/merge-text.h b/glabels2/src/merge-text.h new file mode 100644 index 00000000..b1dddef7 --- /dev/null +++ b/glabels2/src/merge-text.h @@ -0,0 +1,35 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_text.h: text-file merge backend module header file + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_TEXT_H__ +#define __MERGE_TEXT_H__ + +#include + +#include "merge.h" + +extern glMergeInput *gl_merge_text_open (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_text_close (glMergeInput * input); +extern glMergeRecord *gl_merge_text_get_record (glMergeInput * input); +extern GList *gl_merge_text_get_raw_record (glMergeInput * input); + +#endif diff --git a/glabels2/src/merge-ui-text.c b/glabels2/src/merge-ui-text.c new file mode 100644 index 00000000..ba280a3d --- /dev/null +++ b/glabels2/src/merge-ui-text.c @@ -0,0 +1,448 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui_text.c: text-file document merge user interface backend module + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "merge-ui-text.h" +#include "merge-text.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef struct { + gchar *loc; + GtkWidget *entry; +} EntryNode; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint merge_ui_text_src_signals[LAST_SIGNAL] = { 0 }; +static gint merge_ui_text_field_ws_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_merge_ui_text_src_class_init (glMergeUITextSrcClass * class); +static void gl_merge_ui_text_src_instance_init (glMergeUITextSrc * src); +static void gl_merge_ui_text_src_finalize (GObject * object); +static void gl_merge_ui_text_src_construct (glMergeUITextSrc * src, + glMergeType type); + +static void src_changed_cb (glMergeUITextSrc * src); + +static void gl_merge_ui_text_field_ws_class_init (glMergeUITextFieldWSClass * class); +static void gl_merge_ui_text_field_ws_instance_init (glMergeUITextFieldWS * field_ws); +static void gl_merge_ui_text_field_ws_finalize (GObject * object); +static void gl_merge_ui_text_field_ws_construct (glMergeUITextFieldWS * field_ws, + glMergeType type, + gchar * src); + +static void field_ws_changed_cb (glMergeUITextFieldWS * field_ws); + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_text_src_get_type (void) +{ + static guint merge_ui_text_src_type = 0; + + if (!merge_ui_text_src_type) { + GTypeInfo merge_ui_text_src_info = { + sizeof (glMergeUITextSrcClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_text_src_class_init, + NULL, + NULL, + sizeof (glMergeUITextSrc), + 0, + (GInstanceInitFunc) gl_merge_ui_text_src_instance_init, + }; + + merge_ui_text_src_type = + g_type_register_static (gtk_vbox_get_type (), + "glMergeUITextSrc", + &merge_ui_text_src_info, 0); + } + + return merge_ui_text_src_type; +} + +static void +gl_merge_ui_text_src_class_init (glMergeUITextSrcClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_merge_ui_text_src_finalize; + + merge_ui_text_src_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUITextSrcClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +gl_merge_ui_text_src_instance_init (glMergeUITextSrc * src) +{ + src->type = GL_MERGE_NONE; + src->entry = NULL; +} + +static void +gl_merge_ui_text_src_finalize (GObject * object) +{ + glMergeUITextSrc *src; + glMergeUITextSrcClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_TEXT_SRC (object)); + + src = GL_MERGE_UI_TEXT_SRC (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_merge_ui_text_src_new (glMergeType type) +{ + glMergeUITextSrc *src; + + src = g_object_new (gl_merge_ui_text_src_get_type (), NULL); + + gl_merge_ui_text_src_construct (src, type); + + return GTK_WIDGET (src); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_merge_ui_text_src_construct (glMergeUITextSrc * src, + glMergeType type) +{ + GtkWidget *wvbox, *wentry; + + wvbox = GTK_WIDGET (src); + + src->type = type; + + src->entry = + gnome_file_entry_new (NULL, _("Select merge-database source")); + gtk_box_pack_start (GTK_BOX (wvbox), src->entry, TRUE, TRUE, 0); + + wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (src->entry)); + g_signal_connect_swapped (G_OBJECT (wentry), "changed", + G_CALLBACK (src_changed_cb), + G_OBJECT (src)); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (glMergeUITextSrc * src) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (src), merge_ui_text_src_signals[CHANGED], 0); +} + +/*****************************************************************************/ +/* Set src name. */ +/*****************************************************************************/ +void +gl_merge_ui_text_src_set_value (glMergeUITextSrc * src, + gchar * text) +{ + GtkWidget *wentry; + + wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (src->entry)); + + gtk_entry_set_text (GTK_ENTRY (wentry), text); +} + +/*****************************************************************************/ +/* Get src name. */ +/*****************************************************************************/ +gchar * +gl_merge_ui_text_src_get_value (glMergeUITextSrc * src) +{ + return gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (src->entry), + TRUE); +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_text_field_ws_get_type (void) +{ + static guint merge_ui_text_field_ws_type = 0; + + if (!merge_ui_text_field_ws_type) { + GTypeInfo merge_ui_text_field_ws_info = { + sizeof (glMergeUITextFieldWSClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_text_field_ws_class_init, + NULL, + NULL, + sizeof (glMergeUITextFieldWS), + 0, + (GInstanceInitFunc) gl_merge_ui_text_field_ws_instance_init, + }; + + merge_ui_text_field_ws_type = + g_type_register_static (gtk_hbox_get_type (), + "glMergeUITextFieldWS", + &merge_ui_text_field_ws_info, 0); + } + + return merge_ui_text_field_ws_type; +} + +static void +gl_merge_ui_text_field_ws_class_init (glMergeUITextFieldWSClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_merge_ui_text_field_ws_finalize; + + merge_ui_text_field_ws_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUITextFieldWSClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +gl_merge_ui_text_field_ws_instance_init (glMergeUITextFieldWS * field_ws) +{ + field_ws->type = GL_MERGE_NONE; + field_ws->entry_list = NULL; +} + +static void +gl_merge_ui_text_field_ws_finalize (GObject * object) +{ + glMergeUITextFieldWS *field_ws; + glMergeUITextFieldWSClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_TEXT_FIELD_WS (object)); + + field_ws = GL_MERGE_UI_TEXT_FIELD_WS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_merge_ui_text_field_ws_new (glMergeType type, + gchar * src) +{ + glMergeUITextFieldWS *field_ws; + + field_ws = g_object_new (gl_merge_ui_text_field_ws_get_type (), NULL); + + gl_merge_ui_text_field_ws_construct (field_ws, type, src); + + return GTK_WIDGET (field_ws); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_merge_ui_text_field_ws_construct (glMergeUITextFieldWS * field_ws, + glMergeType type, + gchar * src) +{ + GtkWidget *whbox, *wtable, *wlabel, *whline, *wentry; + glMergeInput *mp; + glMergeRawField *sample_field; + GList *sample_field_list=NULL, *p; + gint n_fields, i; + EntryNode *entry_node; + + field_ws->type = type; + field_ws->entry_list = NULL; + + mp = gl_merge_open( type, NULL, src ); + sample_field_list = gl_merge_get_raw_record (mp); + gl_merge_close(mp); + n_fields = g_list_length( sample_field_list ); + + whbox = GTK_WIDGET (field_ws); + + wtable = gtk_table_new (n_fields + 2, 3, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 20); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 10); + gtk_box_pack_start (GTK_BOX (whbox), wtable, FALSE, FALSE, GNOME_PAD); + + wlabel = gtk_label_new (_("Column")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 1, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + wlabel = gtk_label_new (_("Custom field key")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 1, 2, 0, 1); + + wlabel = gtk_label_new (_("Sample data")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 2, 3, 0, 1); + + whline = gtk_hseparator_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), whline, 0, 1, 1, 2); + whline = gtk_hseparator_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), whline, 1, 2, 1, 2); + whline = gtk_hseparator_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), whline, 2, 3, 1, 2); + + for (p = sample_field_list, i = 0; p != NULL; p = p->next, i++) { + sample_field = p->data; + + wlabel = gtk_label_new (sample_field->loc); + gtk_misc_set_alignment (GTK_MISC (wlabel), 1, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, + 0, 1, i + 2, i + 3); + + wentry = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (wentry), sample_field->loc); + gtk_widget_set_usize (wentry, 100, 0); + gtk_table_attach_defaults (GTK_TABLE (wtable), wentry, + 1, 2, i + 2, i + 3); + + g_signal_connect_swapped (G_OBJECT (wentry), "changed", + G_CALLBACK(field_ws_changed_cb), + G_OBJECT (field_ws)); + + wlabel = gtk_label_new (sample_field->value); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL(wlabel), GTK_JUSTIFY_LEFT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, + 2, 3, i + 2, i + 3); + + entry_node = g_new0 (EntryNode, 1); + entry_node->loc = g_strdup (sample_field->loc); + entry_node->entry = wentry; + field_ws->entry_list = + g_list_append (field_ws->entry_list, entry_node); + + } + + gl_merge_free_raw_record (&sample_field_list); + +} + +/*****************************************************************************/ +/* Set field definitions. (associate key with locator) */ +/*****************************************************************************/ +void +gl_merge_ui_text_field_ws_set_field_defs (glMergeUITextFieldWS * field_ws, + GList * field_defs) +{ + GList *p_entry, *p_defs; + EntryNode *entry; + glMergeFieldDefinition *def; + + for (p_entry = field_ws->entry_list; p_entry != NULL; + p_entry = p_entry->next) { + entry = (EntryNode *) p_entry->data; + + for (p_defs = field_defs; p_defs != NULL; p_defs = p_defs->next) { + def = (glMergeFieldDefinition *) p_defs->data; + + if (strcmp (entry->loc, def->loc) == 0) { + gtk_entry_set_text (GTK_ENTRY (entry->entry), + def->key); + } + } + } + +} + +/*****************************************************************************/ +/* Get field definitions. (associate key with locator) */ +/*****************************************************************************/ +GList * +gl_merge_ui_text_field_ws_get_field_defs (glMergeUITextFieldWS * field_ws) +{ + GList *p_entry, *defs_list = NULL; + EntryNode *entry; + glMergeFieldDefinition *def; + + for (p_entry = field_ws->entry_list; p_entry != NULL; + p_entry = p_entry->next) { + entry = (EntryNode *) p_entry->data; + + def = g_new0 (glMergeFieldDefinition, 1); + + def->loc = g_strdup (entry->loc); + def->key = + gtk_editable_get_chars (GTK_EDITABLE (entry->entry), 0, -1); + + defs_list = g_list_append (defs_list, def); + + } + + return defs_list; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +field_ws_changed_cb (glMergeUITextFieldWS * field_ws) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_text_field_ws_signals[CHANGED], 0); +} diff --git a/glabels2/src/merge-ui-text.h b/glabels2/src/merge-ui-text.h new file mode 100644 index 00000000..42006f2f --- /dev/null +++ b/glabels2/src/merge-ui-text.h @@ -0,0 +1,101 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui_text.h: text-file merge user interface backend header + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_UI_TEXT_H__ +#define __MERGE_UI_TEXT_H__ + +#include + +#include "merge.h" + +/*======================================================*/ +/* Merge source selection widget */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_TEXT_SRC (gl_merge_ui_text_src_get_type ()) +#define GL_MERGE_UI_TEXT_SRC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_TEXT_SRC, glMergeUITextSrc )) +#define GL_MERGE_UI_TEXT_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_TEXT_SRC, glMergeUITextSrcClass)) +#define GL_IS_MERGE_UI_TEXT_SRC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_TEXT_SRC)) +#define GL_IS_MERGE_UI_TEXT_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_TEXT_SRC)) + +typedef struct _glMergeUITextSrc glMergeUITextSrc; +typedef struct _glMergeUITextSrcClass glMergeUITextSrcClass; + +struct _glMergeUITextSrc { + GtkVBox parent_widget; + + glMergeType type; + GtkWidget *entry; +}; + +struct _glMergeUITextSrcClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUITextSrc * src, gpointer user_data); +}; + +extern guint gl_merge_ui_text_src_get_type (void); +extern GtkWidget *gl_merge_ui_text_src_new (glMergeType type); +extern void gl_merge_ui_text_src_set_value (glMergeUITextSrc * src, + gchar * text); +extern gchar *gl_merge_ui_text_src_get_value (glMergeUITextSrc * src); + +/*======================================================*/ +/* Merge field selection/definition widget. */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_TEXT_FIELD_WS (gl_merge_ui_text_field_ws_get_type ()) +#define GL_MERGE_UI_TEXT_FIELD_WS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_TEXT_FIELD_WS, glMergeUITextFieldWS )) +#define GL_MERGE_UI_TEXT_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_TEXT_FIELD_WS, glMergeUITextFieldWSClass)) +#define GL_IS_MERGE_UI_TEXT_FIELD_WS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_TEXT_FIELD_WS)) +#define GL_IS_MERGE_UI_TEXT_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_TEXT_FIELD_WS)) + +typedef struct _glMergeUITextFieldWS glMergeUITextFieldWS; +typedef struct _glMergeUITextFieldWSClass glMergeUITextFieldWSClass; + +struct _glMergeUITextFieldWS { + GtkHBox parent_widget; + + glMergeType type; + GList *entry_list; +}; + +struct _glMergeUITextFieldWSClass { + GtkHBoxClass parent_class; + + void (*changed) (glMergeUITextFieldWS * field_ws, gpointer user_data); +}; + +extern guint gl_merge_ui_text_field_ws_get_type (void); +extern GtkWidget *gl_merge_ui_text_field_ws_new (glMergeType type, + gchar * src); +extern void gl_merge_ui_text_field_ws_set_field_defs (glMergeUITextFieldWS * field_ws, + GList * field_defs); +extern GList *gl_merge_ui_text_field_ws_get_field_defs (glMergeUITextFieldWS * + field_ws); + +#endif diff --git a/glabels2/src/merge-ui.c b/glabels2/src/merge-ui.c new file mode 100644 index 00000000..18a25b51 --- /dev/null +++ b/glabels2/src/merge-ui.c @@ -0,0 +1,557 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui.c: document merge user interface module + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "merge-ui.h" +#include "marshal.h" + +/* Backends */ +#include "merge-ui-text.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef struct { + + GtkWidget * (*src_new) (glMergeType); + void (*src_set_value) (); + gchar * (*src_get_value) (); + + GtkWidget * (*field_ws_new) (glMergeType, gchar *); + void (*field_ws_set_field_defs) (); + GList * (*field_ws_get_field_defs) (); + +} BackendFunctions; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint merge_ui_src_signals[LAST_SIGNAL] = { 0 }; +static gint merge_ui_field_ws_signals[LAST_SIGNAL] = { 0 }; + +static BackendFunctions func[GL_MERGE_N_TYPES]; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_merge_ui_src_class_init (glMergeUISrcClass * class); +static void gl_merge_ui_src_instance_init (glMergeUISrc * src); +static void gl_merge_ui_src_finalize (GObject * object); + +static void src_changed_cb (glMergeUISrc * src); + +static void gl_merge_ui_field_ws_class_init (glMergeUIFieldWSClass * class); +static void gl_merge_ui_field_ws_instance_init (glMergeUIFieldWS * field_ws); +static void gl_merge_ui_field_ws_finalize (GObject * object); + +static void field_ws_changed_cb (glMergeUIFieldWS * field_ws); + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_merge_ui_init (void) +{ + gint i; + + gl_debug (DEBUG_MERGE, "START"); + + /* Register backend functions. */ + + i = GL_MERGE_NONE; + func[i].src_new = NULL; + func[i].src_set_value = NULL; + func[i].src_get_value = NULL; + func[i].field_ws_new = NULL; + func[i].field_ws_set_field_defs = NULL; + func[i].field_ws_get_field_defs = NULL; + + i = GL_MERGE_TEXT_TAB; + func[i].src_new = gl_merge_ui_text_src_new; + func[i].src_set_value = gl_merge_ui_text_src_set_value; + func[i].src_get_value = gl_merge_ui_text_src_get_value; + func[i].field_ws_new = gl_merge_ui_text_field_ws_new; + func[i].field_ws_set_field_defs = + gl_merge_ui_text_field_ws_set_field_defs; + func[i].field_ws_get_field_defs = + gl_merge_ui_text_field_ws_get_field_defs; + + i = GL_MERGE_TEXT_COMMA; + func[i].src_new = gl_merge_ui_text_src_new; + func[i].src_set_value = gl_merge_ui_text_src_set_value; + func[i].src_get_value = gl_merge_ui_text_src_get_value; + func[i].field_ws_new = gl_merge_ui_text_field_ws_new; + func[i].field_ws_set_field_defs = + gl_merge_ui_text_field_ws_set_field_defs; + func[i].field_ws_get_field_defs = + gl_merge_ui_text_field_ws_get_field_defs; + + i = GL_MERGE_TEXT_COLON; + func[i].src_new = gl_merge_ui_text_src_new; + func[i].src_set_value = gl_merge_ui_text_src_set_value; + func[i].src_get_value = gl_merge_ui_text_src_get_value; + func[i].field_ws_new = gl_merge_ui_text_field_ws_new; + func[i].field_ws_set_field_defs = + gl_merge_ui_text_field_ws_set_field_defs; + func[i].field_ws_get_field_defs = + gl_merge_ui_text_field_ws_get_field_defs; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_src_get_type (void) +{ + static guint merge_ui_src_type = 0; + + if (!merge_ui_src_type) { + GTypeInfo merge_ui_src_info = { + sizeof (glMergeUISrcClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_src_class_init, + NULL, + NULL, + sizeof (glMergeUISrc), + 0, + (GInstanceInitFunc) gl_merge_ui_src_instance_init, + }; + + merge_ui_src_type = + g_type_register_static (gtk_vbox_get_type (), + "glMergeUISrc", + &merge_ui_src_info, 0); + } + + return merge_ui_src_type; +} + +static void +gl_merge_ui_src_class_init (glMergeUISrcClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MERGE, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_merge_ui_src_finalize; + + merge_ui_src_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUISrcClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_src_instance_init (glMergeUISrc * src) +{ + gl_debug (DEBUG_MERGE, "START"); + src->backend_widget = NULL; + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_src_finalize (GObject * object) +{ + glMergeUISrc *src; + + gl_debug (DEBUG_MERGE, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_SRC (object)); + + src = GL_MERGE_UI_SRC (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MERGE, "END"); +} + +GtkWidget * +gl_merge_ui_src_new (void) +{ + glMergeUISrc *src; + + gl_debug (DEBUG_MERGE, "START"); + + src = g_object_new (gl_merge_ui_src_get_type (), NULL); + + src->type = GL_MERGE_NONE; + src->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (src->backend_widget), 0, 0.5); + gtk_box_pack_start (GTK_BOX (src), src->backend_widget, FALSE, FALSE, + 0); + + gl_debug (DEBUG_MERGE, "END"); + + return GTK_WIDGET (src); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (glMergeUISrc * src) +{ + gl_debug (DEBUG_MERGE, "START"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (src), merge_ui_src_signals[CHANGED], 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Set type. */ +/*****************************************************************************/ +void +gl_merge_ui_src_set_type (glMergeUISrc * src, + glMergeType type) +{ + gl_debug (DEBUG_MERGE, "START"); + + if (type != src->type) { + + gtk_widget_destroy (src->backend_widget); + + src->type = type; + + if (type != GL_MERGE_NONE) { + src->backend_widget = (func[type].src_new) (type); + } else { + src->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (src->backend_widget), + 0, 0.5); + } + + gtk_box_pack_start (GTK_BOX (src), src->backend_widget, + FALSE, FALSE, 0); + + if (GTK_WIDGET_VISIBLE (src)) { + gtk_widget_show_all (src->backend_widget); + } + + if (type != GL_MERGE_NONE) { + g_signal_connect_swapped (G_OBJECT(src->backend_widget), + "changed", + G_CALLBACK(src_changed_cb), + G_OBJECT (src)); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (src), + merge_ui_src_signals[CHANGED], 0); + } + + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Set src. */ +/*****************************************************************************/ +void +gl_merge_ui_src_set_value (glMergeUISrc * src, + gchar * text) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + type = src->type; + + if (type != GL_MERGE_NONE) { + func[type].src_set_value (src->backend_widget, text); + } else { + gl_debug (DEBUG_MERGE, "END"); + return; + } + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Get src name. */ +/*****************************************************************************/ +gchar * +gl_merge_ui_src_get_value (glMergeUISrc * src) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, ""); + + type = src->type; + + if (type != GL_MERGE_NONE) { + return func[type].src_get_value (src->backend_widget); + } else { + return NULL; + } + +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_field_ws_get_type (void) +{ + static guint merge_ui_field_ws_type = 0; + + gl_debug (DEBUG_MERGE, "START"); + + if (!merge_ui_field_ws_type) { + GTypeInfo merge_ui_field_ws_info = { + sizeof (glMergeUIFieldWSClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_field_ws_class_init, + NULL, + NULL, + sizeof (glMergeUIFieldWS), + 0, + (GInstanceInitFunc) gl_merge_ui_field_ws_instance_init, + }; + + merge_ui_field_ws_type = + g_type_register_static (gtk_vbox_get_type (), + "glMergeUIFieldWS", + &merge_ui_field_ws_info, 0); + } + + gl_debug (DEBUG_MERGE, "END"); + + return merge_ui_field_ws_type; +} + +static void +gl_merge_ui_field_ws_class_init (glMergeUIFieldWSClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MERGE, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_merge_ui_field_ws_finalize; + + merge_ui_field_ws_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUIFieldWSClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_field_ws_instance_init (glMergeUIFieldWS * field_ws) +{ + gl_debug (DEBUG_MERGE, "START"); + + field_ws->type = GL_MERGE_NONE; + field_ws->src = NULL; + field_ws->backend_widget = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_field_ws_finalize (GObject * object) +{ + glMergeUIFieldWS *field_ws; + glMergeUIFieldWSClass *class; + + gl_debug (DEBUG_MERGE, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_FIELD_WS (object)); + + field_ws = GL_MERGE_UI_FIELD_WS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MERGE, "END"); +} + +GtkWidget * +gl_merge_ui_field_ws_new (void) +{ + glMergeUIFieldWS *field_ws; + + gl_debug (DEBUG_MERGE, "START"); + + field_ws = g_object_new (gl_merge_ui_field_ws_get_type (), NULL); + + field_ws->type = GL_MERGE_NONE; + field_ws->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (field_ws->backend_widget), 0, 0.5); + gtk_box_pack_start (GTK_BOX (field_ws), field_ws->backend_widget, + FALSE, FALSE, 0); + + gl_debug (DEBUG_MERGE, "END"); + + return GTK_WIDGET (field_ws); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +field_ws_changed_cb (glMergeUIFieldWS * field_ws) +{ + gl_debug (DEBUG_MERGE, "START"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED], 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* set type and src data, create appropriate backend widget. */ +/*****************************************************************************/ +void +gl_merge_ui_field_ws_set_type_src (glMergeUIFieldWS * field_ws, + glMergeType type, + gchar * src) +{ + gl_debug (DEBUG_MERGE, "START"); + + if (field_ws->src != NULL) + g_free (field_ws->src); + if (field_ws->backend_widget != NULL) { + gtk_widget_destroy (field_ws->backend_widget); + } + + field_ws->type = type; + field_ws->src = g_strdup (src); + + if (type != GL_MERGE_NONE) { + field_ws->backend_widget = + (func[type].field_ws_new) (type, src); + } else { + field_ws->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (field_ws->backend_widget), 0, + 0.5); + } + + gtk_box_pack_start (GTK_BOX (field_ws), field_ws->backend_widget, + FALSE, FALSE, 0); + + if (type != GL_MERGE_NONE) { + g_signal_connect_swapped (G_OBJECT(field_ws->backend_widget), + "changed", + G_CALLBACK(field_ws_changed_cb), + G_OBJECT (field_ws)); + } + + if (GTK_WIDGET_VISIBLE (field_ws)) { + gtk_widget_show_all (field_ws->backend_widget); + } + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED], 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Set field definitions (associate ids with raw fields). */ +/*****************************************************************************/ +void +gl_merge_ui_field_ws_set_field_defs (glMergeUIFieldWS * field_ws, + GList * field_defs) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + type = field_ws->type; + + if (type != GL_MERGE_NONE) { + + (func[type].field_ws_set_field_defs) (field_ws->backend_widget, + field_defs); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED], 0); + + } + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Get field definitions (associate ids with raw fields). */ +/*****************************************************************************/ +GList * +gl_merge_ui_field_ws_get_field_defs (glMergeUIFieldWS * field_ws) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, ""); + + type = field_ws->type; + + if (type != GL_MERGE_NONE) { + + return (func[type].field_ws_get_field_defs) (field_ws-> + backend_widget); + } else { + + return NULL; + + } + +} diff --git a/glabels2/src/merge-ui.h b/glabels2/src/merge-ui.h new file mode 100644 index 00000000..e5a7e719 --- /dev/null +++ b/glabels2/src/merge-ui.h @@ -0,0 +1,106 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui.h: document merge user interface module header file + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_UI_H__ +#define __MERGE_UI_H__ + +#include + +#include "merge.h" + +extern void + gl_merge_ui_init (void); + +/*======================================================*/ +/* Merge source selection widget */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_SRC (gl_merge_ui_src_get_type ()) +#define GL_MERGE_UI_SRC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_SRC, glMergeUISrc )) +#define GL_MERGE_UI_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_SRC, glMergeUISrcClass)) +#define GL_IS_MERGE_UI_SRC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_SRC)) +#define GL_IS_MERGE_UI_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_SRC)) + +typedef struct _glMergeUISrc glMergeUISrc; +typedef struct _glMergeUISrcClass glMergeUISrcClass; + +struct _glMergeUISrc { + GtkVBox parent_widget; + + glMergeType type; + GtkWidget *backend_widget; +}; + +struct _glMergeUISrcClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUISrc * src, gpointer user_data); +}; + +extern guint gl_merge_ui_src_get_type (void); +extern GtkWidget *gl_merge_ui_src_new (void); +extern void gl_merge_ui_src_set_type (glMergeUISrc * src, glMergeType type); +extern void gl_merge_ui_src_set_value (glMergeUISrc * src, gchar * text); +extern gchar *gl_merge_ui_src_get_value (glMergeUISrc * src); + +/*======================================================*/ +/* Merge field selection/definition widget. */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_FIELD_WS (gl_merge_ui_field_ws_get_type ()) +#define GL_MERGE_UI_FIELD_WS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_FIELD_WS, glMergeUIFieldWS )) +#define GL_MERGE_UI_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_FIELD_WS, glMergeUIFieldWSClass)) +#define GL_IS_MERGE_UI_FIELD_WS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_FIELD_WS)) +#define GL_IS_MERGE_UI_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_FIELD_WS)) + +typedef struct _glMergeUIFieldWS glMergeUIFieldWS; +typedef struct _glMergeUIFieldWSClass glMergeUIFieldWSClass; + +struct _glMergeUIFieldWS { + GtkVBox parent_widget; + + glMergeType type; + gchar *src; + GtkWidget *backend_widget; +}; + +struct _glMergeUIFieldWSClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUIFieldWS * field_ws, gpointer user_data); +}; + +extern guint gl_merge_ui_field_ws_get_type (void); +extern GtkWidget *gl_merge_ui_field_ws_new (void); +extern void gl_merge_ui_field_ws_set_type_src (glMergeUIFieldWS * field_ws, + glMergeType type, + gchar * src); +extern void gl_merge_ui_field_ws_set_field_defs (glMergeUIFieldWS * field_ws, + GList * field_defs); +extern GList *gl_merge_ui_field_ws_get_field_defs (glMergeUIFieldWS * field_ws); + +#endif diff --git a/glabels2/src/merge.c b/glabels2/src/merge.c new file mode 100644 index 00000000..ed813322 --- /dev/null +++ b/glabels2/src/merge.c @@ -0,0 +1,605 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge.c: document merge module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "merge.h" +#include "merge-text.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ +typedef struct { + gchar *short_text; + gchar *long_text; +} TypeTexts; + +typedef struct { + + glMergeInput * (*open) (glMergeType, GList *, gchar *); + void (*close) (glMergeInput *); + glMergeRecord * (*get_record) (glMergeInput *); + GList * (*get_raw_record) (glMergeInput *); + +} BackendFunctions; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static TypeTexts type_text[GL_MERGE_N_TYPES]; + +static BackendFunctions func[GL_MERGE_N_TYPES]; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_merge_init (void) +{ + gint i; + + gl_debug (DEBUG_MERGE, "START"); + + /* Register backend functions and data. */ + + i = GL_MERGE_NONE; + func[i].open = NULL; + func[i].close = NULL; + func[i].get_record = NULL; + func[i].get_raw_record = NULL; + type_text[i].short_text = "None"; + type_text[i].long_text = _("None"); + + i = GL_MERGE_TEXT_TAB; + func[i].open = gl_merge_text_open; + func[i].close = gl_merge_text_close; + func[i].get_record = gl_merge_text_get_record; + func[i].get_raw_record = gl_merge_text_get_raw_record; + type_text[i].short_text = "Text/Tab"; + type_text[i].long_text = _("Text with tab separators"); + + i = GL_MERGE_TEXT_COMMA; + func[i].open = gl_merge_text_open; + func[i].close = gl_merge_text_close; + func[i].get_record = gl_merge_text_get_record; + func[i].get_raw_record = gl_merge_text_get_raw_record; + type_text[i].short_text = "Text/Comma"; + type_text[i].long_text = _("Text with comma separators"); + + i = GL_MERGE_TEXT_COLON; + func[i].open = gl_merge_text_open; + func[i].close = gl_merge_text_close; + func[i].get_record = gl_merge_text_get_record; + func[i].get_raw_record = gl_merge_text_get_raw_record; + type_text[i].short_text = "Text/Colon"; + type_text[i].long_text = _("Text with colon separators"); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Create new merge information structure. */ +/*****************************************************************************/ +glMerge *gl_merge_new (void) +{ + gl_debug (DEBUG_MERGE, ""); + + return g_new0 (glMerge, 1); +} + +/*****************************************************************************/ +/* Duplicate merge information structure. */ +/*****************************************************************************/ +glMerge *gl_merge_dup (glMerge *orig) +{ + glMerge *new; + + gl_debug (DEBUG_MERGE, "START"); + + new = gl_merge_new (); + + new->type = orig->type; + new->src = g_strdup (orig->src); + new->field_defs = gl_merge_dup_field_def_list (orig->field_defs); + + gl_debug (DEBUG_MERGE, "END"); + return new; +} + +/*****************************************************************************/ +/* Free existing merge information structure. */ +/*****************************************************************************/ +void gl_merge_free (glMerge **merge) +{ + gl_debug (DEBUG_MERGE, "START"); + + g_free ((*merge)->src); + (*merge)->src = NULL; + gl_merge_free_field_def_list (&(*merge)->field_defs); + + *merge = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Lookup type from short text. */ +/*****************************************************************************/ +glMergeType +gl_merge_text_to_type (gchar * text) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + if (g_strcasecmp (text, type_text[type].short_text) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return type; + } + } + + gl_debug (DEBUG_MERGE, "END"); + + return GL_MERGE_NONE; +} + +/*****************************************************************************/ +/* Lookup short text for given type. */ +/*****************************************************************************/ +gchar * +gl_merge_type_to_text (glMergeType type) +{ + gl_debug (DEBUG_MERGE, ""); + + return g_strdup (type_text[type].short_text); +} + +/*****************************************************************************/ +/* Lookup type from long descriptive text. */ +/*****************************************************************************/ +glMergeType +gl_merge_long_text_to_type (gchar * text) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + if (g_strcasecmp (text, type_text[type].long_text) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return type; + } + } + + gl_debug (DEBUG_MERGE, "END"); + return GL_MERGE_NONE; +} + +/*****************************************************************************/ +/* Lookup longer, more descriptive text for given type. */ +/*****************************************************************************/ +gchar * +gl_merge_type_to_long_text (glMergeType type) +{ + gl_debug (DEBUG_MERGE, ""); + + return g_strdup (type_text[type].long_text); +} + +/*****************************************************************************/ +/* Retrieve a list of descriptive texts for all available types. */ +/*****************************************************************************/ +GList * +gl_merge_get_long_texts_list (void) +{ + glMergeType type; + GList *list = NULL; + + gl_debug (DEBUG_MERGE, "START"); + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + + list = g_list_append (list, gl_merge_type_to_long_text (type)); + + } + + gl_debug (DEBUG_MERGE, "END"); + return list; +} + +/*****************************************************************************/ +/* Free list of descriptive texts. */ +/*****************************************************************************/ +void +gl_merge_free_long_texts_list (GList ** list) +{ + GList *p; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *list; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*list); + *list = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Duplicate field definitions. */ +/*****************************************************************************/ +GList *gl_merge_dup_field_def_list (GList * orig) +{ + GList *new, *p_orig; + glMergeFieldDefinition *fd_new, *fd_orig; + + gl_debug (DEBUG_MERGE, "START"); + + new = NULL; + for (p_orig = orig; p_orig != NULL; p_orig = p_orig->next) { + fd_orig = (glMergeFieldDefinition *) p_orig->data; + fd_new = g_new0 (glMergeFieldDefinition, 1); + + fd_new->key = g_strdup (fd_orig->key); + fd_new->loc = g_strdup (fd_orig->loc); + + new = g_list_append (new, fd_new); + } + + gl_debug (DEBUG_MERGE, "END"); + return new; +} + +/*****************************************************************************/ +/* Free list of field definitions. */ +/*****************************************************************************/ +void +gl_merge_free_field_def_list (GList ** list) +{ + GList *p; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *list; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + g_free (field_def->key); + field_def->key = NULL; + g_free (field_def->loc); + field_def->loc = NULL; + + g_free (p->data); + p->data = NULL; + } + + g_list_free (*list); + *list = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Extract a list of valid keys from field definitions list */ +/*****************************************************************************/ +GList * +gl_merge_get_key_list (GList * field_defs) +{ + GList *p, *keys; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_MERGE, "START"); + + keys = NULL; + for (p = field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + keys = g_list_append (keys, g_strdup (field_def->key)); + } + + gl_debug (DEBUG_MERGE, "END"); + + return keys; +} + +/*****************************************************************************/ +/* Free a list of keys. */ +/*****************************************************************************/ +void +gl_merge_free_key_list (GList ** keys) +{ + GList *p; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *keys; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*keys); + *keys = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Lookup key for given locator. */ +/*****************************************************************************/ +gchar * +gl_merge_find_key (GList * field_defs, + gchar * loc) +{ + GList *p; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + if (strcmp (loc, field_def->loc) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return g_strdup (field_def->key); + } + + } + + gl_debug (DEBUG_MERGE, "END"); + + return NULL; +} + +/*****************************************************************************/ +/* Open merge source front-end. */ +/*****************************************************************************/ +glMergeInput * +gl_merge_open (glMergeType type, + GList * field_defs, + gchar * src) +{ + gl_debug (DEBUG_MERGE, ""); + + return func[type].open (type, field_defs, src); +} + +/*****************************************************************************/ +/* Close merge source front-end. */ +/*****************************************************************************/ +void +gl_merge_close (glMergeInput * input) +{ + gl_debug (DEBUG_MERGE, "START"); + + if ( input != NULL ) { + func[input->type].close (input); + } + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Get next record from merge source, NULL if exhausted (front-end). */ +/*****************************************************************************/ +glMergeRecord * +gl_merge_get_record (glMergeInput * input) +{ + gl_debug (DEBUG_MERGE, ""); + + if ( input == NULL ) { + return NULL; + } + return func[input->type].get_record (input); +} + +/*****************************************************************************/ +/* Get next record (raw) from merge source, NULL if exhausted (front-end). */ +/*****************************************************************************/ +GList * +gl_merge_get_raw_record (glMergeInput * input) +{ + gl_debug (DEBUG_MERGE, ""); + + if ( input == NULL ) { + return NULL; + } + return func[input->type].get_raw_record (input); +} + +/*****************************************************************************/ +/* Free a merge record (list of fields) */ +/*****************************************************************************/ +void +gl_merge_free_record (glMergeRecord ** record) +{ + GList *p; + glMergeField *field; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = (*record)->field_list; p != NULL; p = p->next) { + field = (glMergeField *) p->data; + + g_free (field->key); + field->key = NULL; + g_free (field->value); + field->value = NULL; + + g_free (p->data); + p->data = NULL; + + } + g_list_free ((*record)->field_list); + (*record)->field_list = NULL; + + g_free (*record); + *record = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Free a merge record (list of fields) */ +/*****************************************************************************/ +void +gl_merge_free_raw_record (GList ** record) +{ + GList *p; + glMergeRawField *field; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *record; p != NULL; p = p->next) { + field = (glMergeRawField *) p->data; + + g_free (field->loc); + field->loc = NULL; + g_free (field->value); + field->value = NULL; + + g_free (p->data); + p->data = NULL; + + } + + g_list_free (*record); + *record = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Find key in given record and evaluate. */ +/*****************************************************************************/ +extern gchar * +gl_merge_eval_key (gchar * key, + glMergeRecord * record) +{ + GList *p; + glMergeField *field; + + gl_debug (DEBUG_MERGE, "START"); + + if ( record != NULL ) { + for (p = record->field_list; p != NULL; p = p->next) { + field = (glMergeField *) p->data; + + if (strcmp (key, field->key) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return g_strdup (field->value); + } + + } + } + + gl_debug (DEBUG_MERGE, "END"); + + return NULL; +} + +/*****************************************************************************/ +/* Read all records from merge source. */ +/*****************************************************************************/ +GList * +gl_merge_read_data(glMergeType type, + GList *field_defs, + gchar *src) +{ + glMergeInput *mp; + glMergeRecord *record; + GList *record_list = NULL; + + gl_debug (DEBUG_MERGE, "START"); + + mp = gl_merge_open (type, field_defs, src); + while ( (record = gl_merge_get_record (mp)) != NULL ) { + record_list = g_list_append( record_list, record ); + } + gl_merge_close(mp); + + gl_debug (DEBUG_MERGE, "END"); + + return record_list; +} + +/*****************************************************************************/ +/* Free a list of records. */ +/*****************************************************************************/ +void +gl_merge_free_data (GList ** record_list) +{ + GList *p; + glMergeRecord *record; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *record_list; p != NULL; p = p->next) { + record = (glMergeRecord *) p->data; + + gl_merge_free_record( &record ); + + } + + g_list_free (*record_list); + *record_list = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Count selected records. */ +/*****************************************************************************/ +gint +gl_merge_count_records (GList *record_list) +{ + GList *p; + glMergeRecord *record; + gint count; + + gl_debug (DEBUG_MERGE, "START"); + + count = 0; + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) count ++; + } + + gl_debug (DEBUG_MERGE, "END"); + + return count; +} + diff --git a/glabels2/src/merge.h b/glabels2/src/merge.h new file mode 100644 index 00000000..3c8497b6 --- /dev/null +++ b/glabels2/src/merge.h @@ -0,0 +1,105 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge.h: document merge module header file + * + * Copyright (C) 2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_H__ +#define __MERGE_H__ + +#include + +typedef enum { + + GL_MERGE_NONE, + GL_MERGE_TEXT_TAB, + GL_MERGE_TEXT_COMMA, + GL_MERGE_TEXT_COLON, + + GL_MERGE_N_TYPES +} glMergeType; + +typedef struct { + glMergeType type; + gchar *src; + GList *field_defs; +} glMerge; + +typedef struct { + gchar *key; + gchar *loc; +} glMergeFieldDefinition; + +typedef struct { + gchar *loc; + gchar *value; +} glMergeRawField; + +typedef struct { + gchar *key; + gchar *value; +} glMergeField; + +typedef struct { + gboolean select_flag; + GList *field_list; /* List of glMergeFields */ +} glMergeRecord; + +typedef struct { + glMergeType type; + GList *field_defs; + gpointer handle; +} glMergeInput; + +extern void + gl_merge_init (void); + +extern glMerge *gl_merge_new (void); +extern glMerge *gl_merge_dup (glMerge *orig); +extern void gl_merge_free (glMerge **merge); + +extern glMergeType gl_merge_text_to_type (gchar * text); +extern gchar *gl_merge_type_to_text (glMergeType type); +extern glMergeType gl_merge_long_text_to_type (gchar * text); +extern gchar *gl_merge_type_to_long_text (glMergeType type); +extern GList *gl_merge_get_long_texts_list (void); +extern void gl_merge_free_long_texts_list (GList ** list); + +extern GList *gl_merge_dup_field_def_list (GList * field_defs); +extern void gl_merge_free_field_def_list (GList ** field_defs); + +extern GList *gl_merge_get_key_list (GList * field_defs); +extern void gl_merge_free_key_list (GList ** keys); + +extern gchar *gl_merge_find_key (GList * field_defs, gchar * loc); + +extern glMergeInput *gl_merge_open (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_close (glMergeInput * input); +extern glMergeRecord *gl_merge_get_record (glMergeInput * input); +extern GList *gl_merge_get_raw_record (glMergeInput * input); +extern void gl_merge_free_record (glMergeRecord ** record); +extern void gl_merge_free_raw_record (GList ** record); +extern gchar *gl_merge_eval_key (gchar * key, glMergeRecord * record); + +extern GList *gl_merge_read_data (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_free_data (GList **record_list); +extern gint gl_merge_count_records (GList *record_list); + +#endif diff --git a/glabels2/src/pixmaps/Makefile.am b/glabels2/src/pixmaps/Makefile.am new file mode 100644 index 00000000..5b192860 --- /dev/null +++ b/glabels2/src/pixmaps/Makefile.am @@ -0,0 +1,18 @@ + +EXTRA_DIST = \ + collate.xpm \ + nocollate.xpm \ + checkerboard.xpm \ + cursor_text.xbm \ + cursor_text_mask.xbm \ + cursor_box.xbm \ + cursor_box_mask.xbm \ + cursor_line.xbm \ + cursor_line_mask.xbm \ + cursor_ellipse.xbm \ + cursor_ellipse_mask.xbm \ + cursor_image.xbm \ + cursor_image_mask.xbm \ + cursor_barcode.xbm \ + cursor_barcode_mask.xbm + diff --git a/glabels2/src/pixmaps/Makefile.in b/glabels2/src/pixmaps/Makefile.in new file mode 100644 index 00000000..26850921 --- /dev/null +++ b/glabels2/src/pixmaps/Makefile.in @@ -0,0 +1,191 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +EXTRA_DIST = collate.xpm nocollate.xpm checkerboard.xpm cursor_text.xbm cursor_text_mask.xbm cursor_box.xbm cursor_box_mask.xbm cursor_line.xbm cursor_line_mask.xbm cursor_ellipse.xbm cursor_ellipse_mask.xbm cursor_image.xbm cursor_image_mask.xbm cursor_barcode.xbm cursor_barcode_mask.xbm + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/pixmaps/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/pixmaps + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/src/pixmaps/checkerboard.xpm b/glabels2/src/pixmaps/checkerboard.xpm new file mode 100644 index 00000000..33ab7b57 --- /dev/null +++ b/glabels2/src/pixmaps/checkerboard.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * checkerboard_xpm[] = { +"24 24 2 1", +" c #CCCCCC", +". c #000000", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. .."}; diff --git a/glabels2/src/pixmaps/collate.xpm b/glabels2/src/pixmaps/collate.xpm new file mode 100644 index 00000000..a781151a --- /dev/null +++ b/glabels2/src/pixmaps/collate.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char *collate_xpm[]={ +"58 28 3 1", +". c None", +"# c #000000", +"a c #ffffff", +"..........................................................", +".###################..###################.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaa##aaaaaaaa#.................", +".#aaaaaaa##aaaaaaaa#..#aaaaaa#aa#aaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaaa#aaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaa#aaaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaa#aaaaaaaaaa#.................", +".#aaaaaaa###aaaaaaa#..#aaaaaa####aaaaaaa#.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".###################..###################.................", +"..........................................................", +"..........................................................", +"..........................................................", +".................###################..###################.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaaa##aaaaaaaa#.", +".................#aaaaaaa##aaaaaaaa#..#aaaaaa#aa#aaaaaaa#.", +"....##..##..##...#aaaaaaaa#aaaaaaaa#..#aaaaaaaaa#aaaaaaa#.", +"....##..##..##...#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaaa#aaaaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaa#aaaaaaaaaa#.", +".................#aaaaaaa###aaaaaaa#..#aaaaaa####aaaaaaa#.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................###################..###################.", +"..........................................................", +".........................................................."}; diff --git a/glabels2/src/pixmaps/cursor_barcode.xbm b/glabels2/src/pixmaps/cursor_barcode.xbm new file mode 100644 index 00000000..6e8d1d62 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_barcode.xbm @@ -0,0 +1,16 @@ +#define cursor_barcode_width 32 +#define cursor_barcode_height 32 +#define cursor_barcode_x_hot 7 +#define cursor_barcode_y_hot 7 +static unsigned char cursor_barcode_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_barcode_mask.xbm b/glabels2/src/pixmaps/cursor_barcode_mask.xbm new file mode 100644 index 00000000..52ed3ba2 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_barcode_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_barcode_mask_width 32 +#define cursor_barcode_mask_height 32 +#define cursor_barcode_mask_x_hot 7 +#define cursor_barcode_mask_y_hot 7 +static unsigned char cursor_barcode_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0xf1, 0xff, 0xff, 0xc0, 0xf1, 0xff, 0xff, 0xc0, 0xf1, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_box.xbm b/glabels2/src/pixmaps/cursor_box.xbm new file mode 100644 index 00000000..48ae4ea2 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_box.xbm @@ -0,0 +1,16 @@ +#define cursor_box_width 32 +#define cursor_box_height 32 +#define cursor_box_x_hot 7 +#define cursor_box_y_hot 7 +static unsigned char cursor_box_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0xff, 0x7f, + 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_box_mask.xbm b/glabels2/src/pixmaps/cursor_box_mask.xbm new file mode 100644 index 00000000..b41e0559 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_box_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_box_mask_width 32 +#define cursor_box_mask_height 32 +#define cursor_box_mask_x_hot 7 +#define cursor_box_mask_y_hot 7 +static unsigned char cursor_box_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0xc1, 0xff, 0xff, + 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, + 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff}; diff --git a/glabels2/src/pixmaps/cursor_ellipse.xbm b/glabels2/src/pixmaps/cursor_ellipse.xbm new file mode 100644 index 00000000..946af9ac --- /dev/null +++ b/glabels2/src/pixmaps/cursor_ellipse.xbm @@ -0,0 +1,16 @@ +#define cursor_ellipse_width 32 +#define cursor_ellipse_height 32 +#define cursor_ellipse_x_hot 7 +#define cursor_ellipse_y_hot 7 +static unsigned char cursor_ellipse_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x7c, 0x00, 0x80, 0x00, 0xef, 0x01, 0x00, 0x80, 0x01, 0x03, + 0x00, 0xc0, 0x00, 0x06, 0x00, 0x60, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x08, + 0x00, 0x30, 0x00, 0x18, 0x00, 0x30, 0x00, 0x18, 0x00, 0x10, 0x00, 0x10, + 0x00, 0x30, 0x00, 0x18, 0x00, 0x30, 0x00, 0x18, 0x00, 0x20, 0x00, 0x08, + 0x00, 0x60, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x06, 0x00, 0x80, 0x01, 0x03, + 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_ellipse_mask.xbm b/glabels2/src/pixmaps/cursor_ellipse_mask.xbm new file mode 100644 index 00000000..22fb5442 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_ellipse_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_ellipse_mask_width 32 +#define cursor_ellipse_mask_height 32 +#define cursor_ellipse_mask_x_hot 7 +#define cursor_ellipse_mask_y_hot 7 +static unsigned char cursor_ellipse_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0xfe, 0x00, + 0xc0, 0x81, 0xff, 0x03, 0xc0, 0xc1, 0xff, 0x07, 0xc0, 0xe1, 0xff, 0x0f, + 0x00, 0xf0, 0x83, 0x1f, 0x00, 0xf0, 0x01, 0x1f, 0x00, 0xf8, 0x00, 0x3e, + 0x00, 0x78, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x3c, + 0x00, 0x78, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x3c, 0x00, 0xf8, 0x00, 0x3e, + 0x00, 0xf0, 0x01, 0x1f, 0x00, 0xf0, 0x83, 0x1f, 0x00, 0xe0, 0xff, 0x0f, + 0x00, 0xc0, 0xff, 0x07, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_image.xbm b/glabels2/src/pixmaps/cursor_image.xbm new file mode 100644 index 00000000..32308360 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_image.xbm @@ -0,0 +1,16 @@ +#define cursor_image_width 32 +#define cursor_image_height 32 +#define cursor_image_x_hot 7 +#define cursor_image_y_hot 7 +static unsigned char cursor_image_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0xf0, 0xff, 0x7f, 0x80, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, + 0x00, 0x10, 0x00, 0x4c, 0x00, 0x10, 0x00, 0x52, 0x00, 0x10, 0x08, 0x4c, + 0x00, 0x10, 0x14, 0x40, 0x00, 0x10, 0x22, 0x40, 0x00, 0x10, 0x41, 0x40, + 0x00, 0x90, 0xc1, 0x40, 0x00, 0x10, 0x41, 0x40, 0x00, 0xf0, 0xc1, 0x7f, + 0x00, 0x10, 0x41, 0x40, 0x00, 0x10, 0x41, 0x40, 0x00, 0x10, 0x41, 0x40, + 0x00, 0x10, 0x7f, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, + 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_image_mask.xbm b/glabels2/src/pixmaps/cursor_image_mask.xbm new file mode 100644 index 00000000..9c79e82e --- /dev/null +++ b/glabels2/src/pixmaps/cursor_image_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_image_mask_width 32 +#define cursor_image_mask_height 32 +#define cursor_image_mask_x_hot 7 +#define cursor_image_mask_y_hot 7 +static unsigned char cursor_image_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0xf9, 0xff, 0xff, + 0xc0, 0xf9, 0xff, 0xff, 0xc0, 0xf9, 0xff, 0xff, 0xc0, 0xf9, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff}; diff --git a/glabels2/src/pixmaps/cursor_line.xbm b/glabels2/src/pixmaps/cursor_line.xbm new file mode 100644 index 00000000..f5e2636e --- /dev/null +++ b/glabels2/src/pixmaps/cursor_line.xbm @@ -0,0 +1,16 @@ +#define cursor_line_width 32 +#define cursor_line_height 32 +#define cursor_line_x_hot 7 +#define cursor_line_y_hot 7 +static unsigned char cursor_line_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, + 0x80, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_line_mask.xbm b/glabels2/src/pixmaps/cursor_line_mask.xbm new file mode 100644 index 00000000..a9359d55 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_line_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_line_mask_width 32 +#define cursor_line_mask_height 32 +#define cursor_line_mask_x_hot 7 +#define cursor_line_mask_y_hot 7 +static unsigned char cursor_line_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x08, 0xc0, 0x01, 0x00, 0x1c, + 0xc0, 0x01, 0x00, 0x1e, 0xc0, 0x01, 0x00, 0x0f, 0xc0, 0x01, 0x80, 0x07, + 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x00, + 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_text.xbm b/glabels2/src/pixmaps/cursor_text.xbm new file mode 100644 index 00000000..4378c1a6 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_text.xbm @@ -0,0 +1,16 @@ +#define cursor_text_width 32 +#define cursor_text_height 32 +#define cursor_text_x_hot 7 +#define cursor_text_y_hot 7 +static unsigned char cursor_text_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, + 0x00, 0xc0, 0x9c, 0x01, 0x00, 0x40, 0x1c, 0x01, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_text_mask.xbm b/glabels2/src/pixmaps/cursor_text_mask.xbm new file mode 100644 index 00000000..543c2b7f --- /dev/null +++ b/glabels2/src/pixmaps/cursor_text_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_text_mask_width 32 +#define cursor_text_mask_height 32 +#define cursor_text_mask_x_hot 7 +#define cursor_text_mask_y_hot 7 +static unsigned char cursor_text_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0xe1, 0xff, 0x03, 0xc0, 0xe1, 0xff, 0x03, + 0x00, 0xe0, 0xff, 0x03, 0x00, 0xe0, 0xbe, 0x03, 0x00, 0x60, 0x3e, 0x03, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/nocollate.xpm b/glabels2/src/pixmaps/nocollate.xpm new file mode 100644 index 00000000..a67cc13c --- /dev/null +++ b/glabels2/src/pixmaps/nocollate.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char *nocollate_xpm[]={ +"58 28 3 1", +". c None", +"# c #000000", +"a c #ffffff", +"..........................................................", +".###################..###################.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.................", +".#aaaaaaa##aaaaaaaa#..#aaaaaaa##aaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.................", +".#aaaaaaa###aaaaaaa#..#aaaaaaa###aaaaaaa#.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".###################..###################.................", +"..........................................................", +"..........................................................", +"..........................................................", +".................###################..###################.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................#aaaaaaaa##aaaaaaa#..#aaaaaaaa##aaaaaaa#.", +".................#aaaaaaa#aa#aaaaaa#..#aaaaaaa#aa#aaaaaa#.", +"....##..##..##...#aaaaaaaaaa#aaaaaa#..#aaaaaaaaaa#aaaaaa#.", +"....##..##..##...#aaaaaaaaa#aaaaaaa#..#aaaaaaaaa#aaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.", +".................#aaaaaaa#aaaaaaaaa#..#aaaaaaa#aaaaaaaaa#.", +".................#aaaaaaa####aaaaaa#..#aaaaaaa####aaaaaa#.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................###################..###################.", +"..........................................................", +".........................................................."}; diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c new file mode 100644 index 00000000..7d09221a --- /dev/null +++ b/glabels2/src/prefs-dialog.c @@ -0,0 +1,568 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs-dialog.c: Preferences dialog module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include +#include + +#include "bonobo-mdi.h" +#include "prefs-dialog.h" +#include "prefs.h" +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-text-props.h" +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define US_LETTER "US Letter" +#define A4 "A4" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glPrefsDialogPrivate +{ + GtkWidget* categories_tree; + + GtkWidget* notebook; + + GtkTreeModel *categories_tree_model; + + /* Units page */ + GtkWidget *units_points_radio; + GtkWidget *units_inches_radio; + GtkWidget *units_mm_radio; + + /* Page size page */ + GtkWidget *page_size_us_letter_radio; + GtkWidget *page_size_a4_radio; + + /* Default text properties */ + GtkWidget *text; + + /* Default line properties */ + GtkWidget *line; + + /* Default fill properties */ + GtkWidget *fill; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GtkDialogClass* parent_class = NULL; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_prefs_dialog_class_init (glPrefsDialogClass *klass); +static void gl_prefs_dialog_init (glPrefsDialog *dlg); +static void gl_prefs_dialog_finalize (GObject *object); +static void gl_prefs_dialog_construct (glPrefsDialog *dlg); + +static void response_cb (glPrefsDialog *dialog, + gint response, + gpointer user_data); + +static GtkWidget *locale_page (glPrefsDialog *dlg); +static GtkWidget *object_page (glPrefsDialog *dlg); + +static update_locale_page_from_prefs (glPrefsDialog *dlg); +static update_object_page_from_prefs (glPrefsDialog *dlg); + +static update_prefs_from_locale_page (glPrefsDialog *dlg); +static update_prefs_from_object_page (glPrefsDialog *dlg); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_prefs_dialog_get_type (void) +{ + static GType dialog_type = 0; + + if (!dialog_type) + { + static const GTypeInfo dialog_info = + { + sizeof (glPrefsDialogClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gl_prefs_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (glPrefsDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gl_prefs_dialog_init + }; + + dialog_type = g_type_register_static (GTK_TYPE_DIALOG, + "glPrefsDialog", + &dialog_info, + 0); + } + + return dialog_type; +} + +static void +gl_prefs_dialog_class_init (glPrefsDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + gl_debug (DEBUG_PREFS, ""); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_prefs_dialog_finalize; +} + +static void +gl_prefs_dialog_init (glPrefsDialog *dlg) +{ + gl_debug (DEBUG_PREFS, ""); + + dlg->private = g_new0 (glPrefsDialogPrivate, 1); +} + +static void +gl_prefs_dialog_finalize (GObject *object) +{ + glPrefsDialog* dlg; + + gl_debug (DEBUG_PREFS, ""); + + g_return_if_fail (object != NULL); + + dlg = GL_PREFS_DIALOG (object); + + g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); + g_return_if_fail (dlg->private != NULL); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + g_free (dlg->private); +} + +/*****************************************************************************/ +/* NEW preferences dialog. */ +/*****************************************************************************/ +GtkWidget* +gl_prefs_dialog_new (GtkWindow *parent) +{ + GtkWidget *dlg; + + gl_debug (DEBUG_PREFS, ""); + + dlg = GTK_WIDGET (g_object_new (GL_TYPE_PREFS_DIALOG, NULL)); + + if (parent) + gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); + + gl_prefs_dialog_construct (GL_PREFS_DIALOG(dlg)); + + return dlg; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_prefs_dialog_construct (glPrefsDialog *dlg) +{ + GtkWidget *notebook, *wlabel, *wvbox, *wvbox1, *whbox, *wframe; + GSList *radio_group = NULL; + + g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); + g_return_if_fail (dlg->private != NULL); + + gtk_dialog_add_button (GTK_DIALOG(dlg), + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + + gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CLOSE); + + g_signal_connect(G_OBJECT (dlg), "response", + G_CALLBACK (response_cb), NULL); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dlg)->vbox), + notebook, TRUE, TRUE, 0); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), + locale_page (dlg), + gtk_label_new (_("Locale"))); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), + object_page (dlg), + gtk_label_new (_("Object defaults"))); + + update_locale_page_from_prefs (dlg); + update_object_page_from_prefs (dlg); + + gtk_widget_show_all (GTK_DIALOG (dlg)->vbox); + + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + gtk_window_set_title (GTK_WINDOW (dlg), _("Preferences")); + gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (glPrefsDialog *dlg, + gint response, + gpointer user_data) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dlg != NULL); + g_return_if_fail(GTK_IS_DIALOG(dlg)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dlg)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Build Locale Properties Notebook Tab */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +locale_page (glPrefsDialog *dlg) +{ + GtkWidget *wlabel, *wvbox, *whbox, *wvbox1, *wframe; + GSList *radio_group = NULL; + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + + wlabel = gtk_label_new (_("Select locale specific behavior.")); + gtk_box_pack_start (GTK_BOX (wvbox), wlabel, FALSE, FALSE, 0); + + whbox = gtk_hbox_new (TRUE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, FALSE, FALSE, 0); + + /* ----- Display Units Frame ------------------------------------ */ + wframe = gtk_frame_new (_("Display units")); + gtk_box_pack_start (GTK_BOX (whbox), wframe, FALSE, TRUE, 0); + + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox1), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox1); + + radio_group = NULL; + + dlg->private->units_points_radio = + gtk_radio_button_new_with_label (radio_group, _("Points")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_points_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->units_points_radio, + FALSE, FALSE, 0); + + dlg->private->units_inches_radio = + gtk_radio_button_new_with_label (radio_group, _("Inches")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_inches_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->units_inches_radio, + FALSE, FALSE, 0); + + dlg->private->units_mm_radio = + gtk_radio_button_new_with_label (radio_group, _("Millimeters")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_mm_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->units_mm_radio, + FALSE, FALSE, 0); + + /* ----- Page Size Frame ------------------------------------ */ + wframe = gtk_frame_new (_("Default page size")); + gtk_box_pack_start (GTK_BOX (whbox), wframe, FALSE, TRUE, 0); + + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox1), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox1); + + radio_group = NULL; + + dlg->private->page_size_us_letter_radio = + gtk_radio_button_new_with_label (radio_group, US_LETTER); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON + (dlg->private->page_size_us_letter_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->page_size_us_letter_radio, FALSE, + FALSE, 0); + + dlg->private->page_size_a4_radio = + gtk_radio_button_new_with_label (radio_group, A4); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->page_size_a4_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->page_size_a4_radio, + FALSE, FALSE, 0); + + g_signal_connect_swapped ( + G_OBJECT(dlg->private->units_points_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->units_inches_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->units_mm_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->page_size_us_letter_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->page_size_a4_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + + return wvbox; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Build Default Object Properties Notebook Tab */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +object_page (glPrefsDialog *dlg) +{ + GtkWidget *wlabel, *wvbox, *whbox; + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + + wlabel = gtk_label_new (_("Select default properties for new objects.")); + gtk_box_pack_start (GTK_BOX (wvbox), wlabel, FALSE, FALSE, 0); + + /* text props entry */ + dlg->private->text = + gl_wdgt_text_props_new ("Text"); + gtk_box_pack_start (GTK_BOX (wvbox), dlg->private->text, + FALSE, FALSE, 0); + + whbox = gtk_hbox_new (TRUE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, FALSE, FALSE, 0); + + /* ------ Line box ------ */ + dlg->private->line = gl_wdgt_line_new (_("Line")); + gtk_box_pack_start (GTK_BOX (whbox), dlg->private->line, + FALSE, TRUE, 0); + + /* ------ Fill box ------ */ + dlg->private->fill = gl_wdgt_fill_new (_("Fill")); + gtk_box_pack_start (GTK_BOX (whbox), dlg->private->fill, + FALSE, TRUE, 0); + + g_signal_connect_swapped (G_OBJECT(dlg->private->text), + "changed", + G_CALLBACK(update_prefs_from_object_page), + dlg); + g_signal_connect_swapped (G_OBJECT(dlg->private->line), + "changed", + G_CALLBACK(update_prefs_from_object_page), + dlg); + g_signal_connect_swapped (G_OBJECT(dlg->private->fill), + "changed", + G_CALLBACK(update_prefs_from_object_page), + dlg); + return wvbox; +} + + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update locale page widgets from current prefs. */ +/*--------------------------------------------------------------------------*/ +static update_locale_page_from_prefs (glPrefsDialog *dlg) +{ + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->units_points_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->units_inches_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->units_mm_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->page_size_us_letter_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->page_size_a4_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_points_radio), + TRUE); + break; + case GL_PREFS_UNITS_INCHES: + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_inches_radio), + TRUE); + break; + case GL_PREFS_UNITS_MM: + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_mm_radio), + TRUE); + break; + default: + g_warning ("Illegal units"); /* Should not happen */ + break; + } + + if ( g_strcasecmp(gl_prefs->default_page_size, US_LETTER) == 0) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_us_letter_radio), + TRUE); + } else if ( g_strcasecmp(gl_prefs->default_page_size, A4) == 0) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_a4_radio), + TRUE); + } else { + g_warning ("Unknown default page size"); /* Shouldn't happen */ + } + + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->units_points_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->units_inches_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->units_mm_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->page_size_us_letter_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->page_size_a4_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update object page widgets from current prefs. */ +/*--------------------------------------------------------------------------*/ +static update_object_page_from_prefs (glPrefsDialog *dlg) +{ + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->text), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->line), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->fill), + G_CALLBACK(update_prefs_from_object_page), dlg); + + gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(dlg->private->text), + gl_prefs->default_font_family, + gl_prefs->default_font_size, + gl_prefs->default_font_weight, + gl_prefs->default_font_italic_flag, + gl_prefs->default_text_color, + gl_prefs->default_text_alignment); + + gl_wdgt_line_set_params (GL_WDGT_LINE(dlg->private->line), + gl_prefs->default_line_width, + gl_prefs->default_line_color); + + gl_wdgt_fill_set_params (GL_WDGT_FILL(dlg->private->fill), + gl_prefs->default_fill_color); + + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->text), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->line), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->fill), + G_CALLBACK(update_prefs_from_object_page), dlg); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update prefs from current state of locale page widgets. */ +/*--------------------------------------------------------------------------*/ +static update_prefs_from_locale_page (glPrefsDialog *dlg) +{ + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_points_radio)) == 0) { + gl_prefs->units = GL_PREFS_UNITS_PTS; + } + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_inches_radio)) == 0) { + gl_prefs->units = GL_PREFS_UNITS_INCHES; + } + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_mm_radio)) == 0) { + gl_prefs->units = GL_PREFS_UNITS_MM; + } + + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_us_letter_radio)) == 0) { + gl_prefs->default_page_size = US_LETTER; + } + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_a4_radio)) == 0) { + gl_prefs->default_page_size = A4; + } + + gl_prefs_save_settings (); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update prefs from current state of object page widgets. */ +/*--------------------------------------------------------------------------*/ +static update_prefs_from_object_page (glPrefsDialog *dlg) +{ + gl_wdgt_text_props_get_params (GL_WDGT_TEXT_PROPS(dlg->private->text), + &gl_prefs->default_font_family, + &gl_prefs->default_font_size, + &gl_prefs->default_font_weight, + &gl_prefs->default_font_italic_flag, + &gl_prefs->default_text_color, + &gl_prefs->default_text_alignment); + + gl_wdgt_line_get_params (GL_WDGT_LINE(dlg->private->line), + &gl_prefs->default_line_width, + &gl_prefs->default_line_color); + + gl_wdgt_fill_get_params (GL_WDGT_FILL(dlg->private->fill), + &gl_prefs->default_fill_color); + + gl_prefs_save_settings (); +} + + + diff --git a/glabels2/src/prefs-dialog.h b/glabels2/src/prefs-dialog.h new file mode 100644 index 00000000..6daafdf7 --- /dev/null +++ b/glabels2/src/prefs-dialog.h @@ -0,0 +1,58 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs-dialog.h: Preferences dialog module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PREFS_DIALOG_H__ +#define __PREFS_DIALOG_H__ + +#include + +#define GL_TYPE_PREFS_DIALOG (gl_prefs_dialog_get_type ()) +#define GL_PREFS_DIALOG(obj) (GTK_CHECK_CAST ((obj), GL_TYPE_PREFS_DIALOG, glPrefsDialog)) +#define GL_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PREFS_DIALOG, glPrefsDialogClass)) +#define GL_IS_PREFS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_PREFS_DIALOG)) +#define GL_IS_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PREFS_DIALOG)) +#define GL_PREFS_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_PREFS_DIALOG, glPrefsDialogClass)) + + +typedef struct _glPrefsDialog glPrefsDialog; +typedef struct _glPrefsDialogClass glPrefsDialogClass; + +typedef struct _glPrefsDialogPrivate glPrefsDialogPrivate; + +struct _glPrefsDialog +{ + GtkDialog parent_instance; + + glPrefsDialogPrivate *private; + +}; + +struct _glPrefsDialogClass +{ + GtkDialogClass parent_class; +}; + +GtkType gl_prefs_dialog_get_type (void) G_GNUC_CONST; + +GtkWidget* gl_prefs_dialog_new (GtkWindow *parent); + +#endif /* __PREFS_DIALOG_H__ */ diff --git a/glabels2/src/prefs.c b/glabels2/src/prefs.c new file mode 100644 index 00000000..c30040ca --- /dev/null +++ b/glabels2/src/prefs.c @@ -0,0 +1,635 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs.h: Application preferences module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include +#include + +#include "prefs.h" +#include "glabels.h" +#include "util.h" + +#include "debug.h" + +glPreferences *gl_prefs = NULL; + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/* GConf keys */ +#define BASE_KEY "/apps/glabels" + +#define PREF_UNITS "/units" +#define PREF_DEFAULT_PAGE_SIZE "/default-page-size" + +#define PREF_DEFAULT_FONT_FAMILY "/default-font-family" +#define PREF_DEFAULT_FONT_SIZE "/default-font-size" +#define PREF_DEFAULT_FONT_WEIGHT "/default-font-weight" +#define PREF_DEFAULT_FONT_ITALIC_FLAG "/default-font-italic-flag" +#define PREF_DEFAULT_TEXT_COLOR "/default-text-color" +#define PREF_DEFAULT_TEXT_ALIGNMENT "/default-text-alignment" + +#define PREF_DEFAULT_LINE_WIDTH "/default-line-width" +#define PREF_DEFAULT_LINE_COLOR "/default-line-color" + +#define PREF_DEFAULT_FILL_COLOR "/default-fill-color" + +#define PREF_TOOLBAR_VISIBLE "/toolbar-visible" +#define PREF_TOOLBAR_BUTTONS_STYLE "/toolbar-buttons-style" +#define PREF_TOOLBAR_VIEW_TOOLTIPS "/toolbar-view-tooltips" + +#define PREF_MDI_MODE "/mdi-mode" +#define PREF_TABS_POSITION "/mdi-tabs-position" + +#define PREF_MAX_RECENTS "/max-recents" + +/* Default values */ +#define DEFAULT_UNITS_STRING units_to_string (GL_PREFS_UNITS_INCHES) +#define DEFAULT_PAGE_SIZE "US Letter" + +#define DEFAULT_FONT_FAMILY "Helvetica" +#define DEFAULT_FONT_SIZE 14.0 +#define DEFAULT_FONT_WEIGHT_STRING gl_util_weight_to_string (GNOME_FONT_BOOK) +#define DEFAULT_FONT_ITALIC_FLAG FALSE +#define DEFAULT_TEXT_JUST_STRING gl_util_just_to_string (GTK_JUSTIFY_LEFT) +#define DEFAULT_TEXT_COLOR GNOME_CANVAS_COLOR (0,0,0) + +#define DEFAULT_LINE_WIDTH 1.0 +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) + +#define DEFAULT_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 255) + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ +static GConfClient *gconf_client = NULL; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data); + +static gchar *get_string (GConfClient* client, const gchar* key, const gchar* def); +static gboolean get_bool (GConfClient* client, const gchar* key, gboolean def); +static gint get_int (GConfClient* client, const gchar* key, gint def); +static gdouble get_float (GConfClient* client, const gchar* key, gdouble def); + +static glPrefsUnits string_to_units (const gchar *string); +static const gchar *units_to_string (glPrefsUnits units); + + + +/*****************************************************************************/ +/* Initialize preferences module. */ +/*****************************************************************************/ +void +gl_prefs_init (void) +{ + gl_debug (DEBUG_PREFS, ""); + + gconf_client = gconf_client_get_default (); + + g_return_if_fail (gconf_client != NULL); + + gconf_client_add_dir (gconf_client, + BASE_KEY, + GCONF_CLIENT_PRELOAD_ONELEVEL, + NULL); + + gconf_client_notify_add (gconf_client, + BASE_KEY, + notify_cb, + NULL, NULL, NULL); +} + + +/*****************************************************************************/ +/* Save all settings. */ +/*****************************************************************************/ +void +gl_prefs_save_settings (void) +{ + BonoboWindow* active_window = NULL; + + gl_debug (DEBUG_PREFS, "START"); + + g_return_if_fail (gconf_client != NULL); + g_return_if_fail (gl_prefs != NULL); + + /* Units */ + gconf_client_set_string (gconf_client, + BASE_KEY PREF_UNITS, + units_to_string(gl_prefs->units), + NULL); + + /* Default page size */ + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_PAGE_SIZE, + gl_prefs->default_page_size, + NULL); + + + /* Text properties */ + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_FAMILY, + gl_prefs->default_font_family, + NULL); + + gconf_client_set_float (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_SIZE, + gl_prefs->default_font_size, + NULL); + + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_WEIGHT, + gl_util_weight_to_string(gl_prefs->default_font_weight), + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_COLOR, + gl_prefs->default_text_color, + NULL); + + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_ALIGNMENT, + gl_util_just_to_string(gl_prefs->default_text_alignment), + NULL); + + + /* Line properties */ + gconf_client_set_float (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_WIDTH, + gl_prefs->default_line_width, + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_COLOR, + gl_prefs->default_line_color, + NULL); + + + /* Fill properties */ + gconf_client_set_int (gconf_client, + BASE_KEY PREF_DEFAULT_FILL_COLOR, + gl_prefs->default_fill_color, + NULL); + + + /* Toolbar */ + gconf_client_set_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VISIBLE, + gl_prefs->toolbar_visible, + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_TOOLBAR_BUTTONS_STYLE, + gl_prefs->toolbar_buttons_style, + NULL); + + gconf_client_set_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VIEW_TOOLTIPS, + gl_prefs->toolbar_view_tooltips, + NULL); + + + /* MDI */ + gconf_client_set_int (gconf_client, + BASE_KEY PREF_MDI_MODE, + gl_prefs->mdi_mode, + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_TABS_POSITION, + gl_prefs->mdi_tabs_position, + NULL); + + + /* Recent files */ + gconf_client_set_int (gconf_client, + BASE_KEY PREF_MAX_RECENTS, + gl_prefs->max_recents, + NULL); + + + gconf_client_suggest_sync (gconf_client, NULL); + + gl_debug (DEBUG_PREFS, "END"); +} + +/*****************************************************************************/ +/* Load all settings. */ +/*****************************************************************************/ +void +gl_prefs_load_settings (void) +{ + gchar *string; + + gl_debug (DEBUG_PREFS, "START"); + + if (gl_prefs == NULL) + gl_prefs = g_new0 (glPreferences, 1); + + if (gconf_client == NULL) + { + /* TODO: in any case set default values */ + g_warning ("Cannot load settings."); + return; + } + + + /* Units */ + string = + get_string (gconf_client, + BASE_KEY PREF_UNITS, + DEFAULT_UNITS_STRING); + gl_prefs->units = string_to_units( string ); + g_free( string ); + + + /* Page size */ + gl_prefs->default_page_size = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_PAGE_SIZE, + DEFAULT_PAGE_SIZE); + + /* Text properties */ + gl_prefs->default_font_family = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_FAMILY, + DEFAULT_FONT_FAMILY); + + gl_prefs->default_font_size = + get_float (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_SIZE, + DEFAULT_FONT_SIZE); + + string = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_WEIGHT, + DEFAULT_FONT_WEIGHT_STRING); + gl_prefs->default_font_weight = + gl_util_string_to_weight( string ); + g_free( string ); + + gl_prefs->default_text_color = + get_int (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_COLOR, + DEFAULT_TEXT_COLOR); + + string = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_ALIGNMENT, + DEFAULT_TEXT_JUST_STRING); + gl_prefs->default_font_weight = gl_util_string_to_just( string ); + g_free( string ); + + + /* Line properties */ + gl_prefs->default_line_width = + get_float (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_WIDTH, + DEFAULT_LINE_WIDTH); + gl_prefs->default_line_color = + get_int (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_COLOR, + DEFAULT_LINE_COLOR); + + /* Fill properties */ + gl_prefs->default_fill_color = + get_int (gconf_client, + BASE_KEY PREF_DEFAULT_FILL_COLOR, + DEFAULT_FILL_COLOR); + + + /* User Inferface/Toolbar */ + gl_prefs->toolbar_visible = + get_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VISIBLE, + TRUE); + + gl_prefs->toolbar_buttons_style = + get_int (gconf_client, + BASE_KEY PREF_TOOLBAR_BUTTONS_STYLE, + GL_TOOLBAR_SYSTEM); + + gl_prefs->toolbar_view_tooltips = + get_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VIEW_TOOLTIPS, + TRUE); + + + /* User Inferface/MDI */ + gl_prefs->mdi_mode = + get_int (gconf_client, + BASE_KEY PREF_MDI_MODE, + 0); + + gl_prefs->mdi_tabs_position = + get_int (gconf_client, + BASE_KEY PREF_TABS_POSITION, + 0); + + + /* Recent files */ + gl_prefs->max_recents = + get_int (gconf_client, + BASE_KEY PREF_MAX_RECENTS, + 4); + + + gl_debug (DEBUG_PREFS, "max_recents = %d", gl_prefs->max_recents); + + gl_debug (DEBUG_PREFS, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Key changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) +{ + gl_debug (DEBUG_PREFS, "Key was changed: %s", entry->key); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Utilities to get values with defaults. */ +/*---------------------------------------------------------------------------*/ +static gchar* +get_string (GConfClient* client, + const gchar* key, + const gchar* def) +{ + gchar* val; + + val = gconf_client_get_string (client, key, NULL); + + if (val != NULL) { + + return val; + + } else { + + return def ? g_strdup (def) : NULL; + + } +} + +static gboolean +get_bool (GConfClient* client, + const gchar* key, + gboolean def) +{ + GConfValue* val; + gboolean retval; + + val = gconf_client_get (client, key, NULL); + + if (val != NULL) { + + if ( val->type == GCONF_VALUE_BOOL ) { + retval = gconf_value_get_bool (val); + } else { + retval = def; + } + + gconf_value_free (val); + + return retval; + + } else { + + return def; + + } +} + +static gint +get_int (GConfClient* client, + const gchar* key, + gint def) +{ + GConfValue* val; + gint retval; + + val = gconf_client_get (client, key, NULL); + + if (val != NULL) { + + if ( val->type == GCONF_VALUE_INT) { + retval = gconf_value_get_int(val); + } else { + retval = def; + } + + gconf_value_free (val); + + return retval; + + } else { + + return def; + + } +} + +static gdouble +get_float (GConfClient* client, + const gchar* key, + gdouble def) +{ + GConfValue* val; + gdouble retval; + + val = gconf_client_get (client, key, NULL); + + if (val != NULL) { + + if ( val->type == GCONF_VALUE_FLOAT ) { + retval = gconf_value_get_float(val); + } else { + retval = def; + } + + gconf_value_free (val); + + return retval; + + } else { + + return def; + + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Utilities to deal with units. */ +/*---------------------------------------------------------------------------*/ +static glPrefsUnits string_to_units (const gchar *string) +{ + glPrefsUnits units; + + if (g_strcasecmp (string, "Points") == 0) { + units = GL_PREFS_UNITS_PTS; + } else if (g_strcasecmp (string, "Inches") == 0) { + units = GL_PREFS_UNITS_INCHES; + } else if (g_strcasecmp (string, "Millimeters") == 0) { + units = GL_PREFS_UNITS_MM; + } else { + units = GL_PREFS_UNITS_INCHES; + } + + return units; +} + +static const gchar *units_to_string (glPrefsUnits units) +{ + switch (units) { + case GL_PREFS_UNITS_PTS: + return "Points"; + break; + case GL_PREFS_UNITS_INCHES: + return "Inches"; + break; + case GL_PREFS_UNITS_MM: + return "Millimeters"; + break; + default: + return "Inches"; + break; + } +} + + + +/****************************************************************************/ +/* Get string representing desired units. */ +/****************************************************************************/ +const gchar * +gl_prefs_get_page_size (void) +{ + return (gl_prefs->default_page_size); +} + +/****************************************************************************/ +/* Get desired units. */ +/****************************************************************************/ +glPrefsUnits +gl_prefs_get_units (void) +{ + return gl_prefs->units; +} + +/****************************************************************************/ +/* Get desired units per point. */ +/****************************************************************************/ +gdouble +gl_prefs_get_units_per_point (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return 1.0; /* points */ + case GL_PREFS_UNITS_INCHES: + return 1.0 / 72.0; /* inches */ + case GL_PREFS_UNITS_MM: + return 0.35277778; /* mm */ + default: + g_warning ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get precision for desired units. */ +/****************************************************************************/ +gint +gl_prefs_get_units_precision (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return 1; /* points */ + case GL_PREFS_UNITS_INCHES: + return 3; /* inches */ + case GL_PREFS_UNITS_MM: + return 1; /* mm */ + default: + g_warning ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get step size for desired units. */ +/****************************************************************************/ +gdouble +gl_prefs_get_units_step_size (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return 0.1; /* points */ + case GL_PREFS_UNITS_INCHES: + return 0.001; /* inches */ + case GL_PREFS_UNITS_MM: + return 0.1; /* mm */ + default: + g_warning ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get string representing desired units. */ +/****************************************************************************/ +const gchar * +gl_prefs_get_units_string (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return _("points"); + case GL_PREFS_UNITS_INCHES: + return _("inches"); + case GL_PREFS_UNITS_MM: + return _("mm"); + default: + g_warning ("Illegal units"); /* Should not happen */ + return _("points"); + } +} + diff --git a/glabels2/src/prefs.h b/glabels2/src/prefs.h new file mode 100644 index 00000000..40d6ae24 --- /dev/null +++ b/glabels2/src/prefs.h @@ -0,0 +1,91 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs.h: Application preferences module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PREFS_H__ +#define __PREFS_H__ + +#include + +typedef struct _glPreferences glPreferences; + +typedef enum { + GL_TOOLBAR_SYSTEM = 0, + GL_TOOLBAR_ICONS, + GL_TOOLBAR_ICONS_AND_TEXT +} glToolbarSetting; + +typedef enum { + GL_PREFS_UNITS_PTS, + GL_PREFS_UNITS_INCHES, + GL_PREFS_UNITS_MM, +} glPrefsUnits; + +struct _glPreferences +{ + /* Units */ + glPrefsUnits units; + + /* Page size */ + gchar *default_page_size; + + /* Text properties */ + gchar *default_font_family; + gdouble default_font_size; + GnomeFontWeight default_font_weight; + gboolean default_font_italic_flag; + guint default_text_color; + GtkJustification default_text_alignment; + + /* Line properties */ + gdouble default_line_width; + guint default_line_color; + + /* Fill properties */ + guint default_fill_color; + + /* User Interface/Toolbar */ + gboolean toolbar_visible; + glToolbarSetting toolbar_buttons_style; + gboolean toolbar_view_tooltips; + + /* User Interface/MDI Mode */ + gint mdi_mode; + gint mdi_tabs_position; /* Tabs position in mdi notebook */ + + /* Recent files */ + gint max_recents; +}; + +extern glPreferences *gl_prefs; + +extern void gl_prefs_save_settings (void); +extern void gl_prefs_load_settings (void); +extern void gl_prefs_init (void); + +extern const gchar *gl_prefs_get_page_size (void); +extern glPrefsUnits gl_prefs_get_units (void); +extern const gchar *gl_prefs_get_units_string (void); +extern gdouble gl_prefs_get_units_per_point (void); +extern gdouble gl_prefs_get_units_step_size (void); +extern gint gl_prefs_get_units_precision (void); + +#endif /* __PREFS_H__ */ + diff --git a/glabels2/src/print-dialog.c b/glabels2/src/print-dialog.c new file mode 100644 index 00000000..3943b92b --- /dev/null +++ b/glabels2/src/print-dialog.c @@ -0,0 +1,392 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.c: Print module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "print-dialog.h" +#include "print.h" +#include "label.h" +#include "bc.h" +#include "template.h" +#include "mdi.h" +#include "glabels.h" + +#include "wdgt-print-copies.h" +#include "wdgt-print-merge.h" + +#include "debug.h" + +#define RED(x) ( (((x)>>24) & 0xff) / 255.0 ) +#define GREEN(x) ( (((x)>>16) & 0xff) / 255.0 ) +#define BLUE(x) ( (((x)>>8) & 0xff) / 255.0 ) +#define ALPHA(x) ( ( (x) & 0xff) / 255.0 ) + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals. */ +/*===========================================*/ + +/* remember state of dialog. */ +static gboolean outline_flag = FALSE; +static gboolean reverse_flag = FALSE; +static gboolean collate_flag = FALSE; +static gint first = 1, last = 1, n_sheets = 0, n_copies = 1; + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ +static GtkWidget *job_page_new (GtkWidget *dlg, glLabel *label); +static GtkWidget *printer_page_new (GtkWidget *dlg, glLabel *label); + +static void print_response (GtkDialog *dlg, + gint response, + glLabel *label); + +static void print_sheets (GnomePrintConfig *config, glLabel * label, + gboolean preview_flag, + gint n_sheets, gint first, gint last, + gboolean outline_flag, gboolean reverse_flag); + +static void print_sheets_merge (GnomePrintConfig *config, glLabel * label, + GList *record_list, + gboolean preview_flag, + gint n_copies, gint first, + gboolean collate_flag, + gboolean outline_flag, gboolean reverse_flag); + + +/*****************************************************************************/ +/* "Print" dialog. */ +/*****************************************************************************/ +void +gl_print_dialog (glLabel *label, BonoboWindow *win) +{ + GtkWidget *dlg; + GtkWidget *pp_button, *notebook, *page; + + g_return_if_fail (label != NULL); + g_return_if_fail (win != NULL); + + /* ----- Contstruct basic print dialog with notebook ----- */ + dlg = gtk_dialog_new_with_buttons (_("Print"), GTK_WINDOW(win), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_PRINT, GNOME_PRINT_DIALOG_RESPONSE_PRINT, + + NULL); + pp_button = gtk_dialog_add_button (GTK_DIALOG (dlg), + GTK_STOCK_PRINT_PREVIEW, + GNOME_PRINT_DIALOG_RESPONSE_PREVIEW); + gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (dlg)->action_area), + pp_button, TRUE); + gtk_dialog_set_default_response (GTK_DIALOG (dlg), + GNOME_PRINT_DIALOG_RESPONSE_PRINT); + notebook = gtk_notebook_new (); + gtk_container_set_border_width (GTK_CONTAINER (notebook), 4); + gtk_widget_show (notebook); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), notebook); + + + /* ----- Create Job notebook page ----- */ + page = job_page_new (dlg, label); + gtk_notebook_append_page (GTK_NOTEBOOK(notebook), page, + gtk_label_new_with_mnemonic (_("_Job"))); + + /* ----- Create Printer notebook page ----- */ + page = printer_page_new (dlg, label); + gtk_notebook_append_page (GTK_NOTEBOOK(notebook), page, + gtk_label_new_with_mnemonic (_("P_rinter"))); + + g_signal_connect (G_OBJECT(dlg), "response", + G_CALLBACK (print_response), label); + + gtk_widget_show_all (GTK_WIDGET (dlg)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create "Job" page. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +job_page_new (GtkWidget *dlg, + glLabel *label) +{ + GtkWidget *vbox; + glMerge *merge; + GtkWidget *wframe; + GtkWidget *copies = NULL, *prmerge = NULL; + GtkWidget *wvbox, *outline_check, *reverse_check; + GList *record_list; + gint n_records; + + vbox = gtk_vbox_new (FALSE, 0); + + merge = gl_label_get_merge (label); + if (merge->type == GL_MERGE_NONE) { + + /* ----------- Add simple-copies widget ------------ */ + wframe = gtk_frame_new (_("Copies")); + gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + + copies = gl_wdgt_print_copies_new (label); + gtk_container_set_border_width (GTK_CONTAINER (copies), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), copies); + + if (n_sheets) { + gl_wdgt_print_copies_set_range (GL_WDGT_PRINT_COPIES (copies), + n_sheets, first, last); + } + + } else { + + /* ------- Otherwise add merge control widget ------------ */ + wframe = gtk_frame_new (_("Document merge control")); + gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + + prmerge = gl_wdgt_print_merge_new (label); + gtk_container_set_border_width (GTK_CONTAINER (prmerge), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), prmerge); + + record_list = gl_merge_read_data (merge->type, + merge->field_defs, + merge->src); + n_records = gl_merge_count_records( record_list ); + gl_wdgt_print_merge_set_copies (GL_WDGT_PRINT_MERGE(prmerge), + n_copies, first, n_records, + collate_flag); + } + gtk_widget_show_all (wframe); + g_object_set_data (G_OBJECT(dlg), "copies", copies); + g_object_set_data (G_OBJECT(dlg), "prmerge", prmerge); + + /* ----------- Add custom print options area ------------ */ + wframe = gtk_frame_new (_("Options")); + gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), wvbox); + + /* add Outline check button */ + outline_check = + gtk_check_button_new_with_label ( + _("print outlines (to test printer alignment)")); + gtk_box_pack_start (GTK_BOX (wvbox), outline_check, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (outline_check), + outline_flag); + g_object_set_data (G_OBJECT(dlg), "outline_check", outline_check); + + /* add Reverse check button */ + reverse_check = + gtk_check_button_new_with_label ( + _("print in reverse (i.e. a mirror image)")); + gtk_box_pack_start (GTK_BOX (wvbox), reverse_check, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reverse_check), + reverse_flag); + g_object_set_data (G_OBJECT(dlg), "reverse_check", reverse_check); + + gtk_widget_show_all (wframe); + + return vbox; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create "Printer" page. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +printer_page_new (GtkWidget *dlg, + glLabel *label) +{ + GtkWidget *vbox; + GtkWidget *printer_select; + + vbox = gtk_vbox_new (FALSE, 0); + + printer_select = + gnome_printer_selection_new (gnome_print_config_default ()); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); + gtk_widget_show (printer_select); + gtk_box_pack_start (GTK_BOX(vbox), printer_select, FALSE, FALSE, 0); + + g_object_set_data (G_OBJECT(dlg), "printer_select", printer_select); + + return vbox; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Print "response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +print_response (GtkDialog *dlg, + gint response, + glLabel *label) +{ + GtkWidget *copies, *prmerge; + GtkWidget *outline_check, *reverse_check; + GtkWidget *printer_select; + GnomePrintConfig *config; + glMerge *merge; + GList *record_list; + + switch (response) { + + case GNOME_PRINT_DIALOG_RESPONSE_PRINT: + case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW: + copies = g_object_get_data (G_OBJECT(dlg), "copies"); + prmerge = g_object_get_data (G_OBJECT(dlg), "prmerge"); + outline_check = g_object_get_data (G_OBJECT(dlg), + "outline_check"); + reverse_check = g_object_get_data (G_OBJECT(dlg), + "reverse_check"); + printer_select = g_object_get_data (G_OBJECT(dlg), + "printer_select"); + + config = gnome_printer_selection_get_config (GNOME_PRINTER_SELECTION(printer_select)); + + outline_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (outline_check)); + reverse_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (reverse_check)); + + merge = gl_label_get_merge (label); + + if (merge->type == GL_MERGE_NONE) { + + gl_wdgt_print_copies_get_range (GL_WDGT_PRINT_COPIES (copies), + &n_sheets, &first, &last); + print_sheets (config, label, + (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW), + n_sheets, first, last, + outline_flag, reverse_flag); + + } else { + + record_list = gl_merge_read_data (merge->type, + merge->field_defs, + merge->src); + gl_wdgt_print_merge_get_copies (GL_WDGT_PRINT_MERGE (prmerge), + &n_copies, &first, + &collate_flag); + print_sheets_merge (config, label, record_list, + (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW), + n_copies, first, + collate_flag, + outline_flag, + reverse_flag); + } + + gl_merge_free (&merge); + break; + + default: + break; + + } + + gtk_widget_destroy (GTK_WIDGET (dlg)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. print the sheets */ +/*---------------------------------------------------------------------------*/ +static void +print_sheets (GnomePrintConfig *config, + glLabel * label, + gboolean preview_flag, + gint n_sheets, + gint first, + gint last, + gboolean outline_flag, + gboolean reverse_flag) +{ + GnomePrintMaster *master; + + master = gnome_print_master_new_from_config (config); + gl_print_simple (master, label, n_sheets, first, last, + outline_flag, reverse_flag); + gnome_print_master_close (master); + + if (preview_flag) { + GtkWidget *preview_widget = + gnome_print_master_preview_new (master, _("Print preview")); + gtk_widget_show (GTK_WIDGET (preview_widget)); + } else { + gnome_print_master_print (master); + } + + g_object_unref (G_OBJECT (master)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. print the sheets with merge data */ +/*---------------------------------------------------------------------------*/ +static void +print_sheets_merge (GnomePrintConfig *config, + glLabel * label, + GList * record_list, + gboolean preview_flag, + gint n_copies, + gint first, + gboolean collate_flag, + gboolean outline_flag, + gboolean reverse_flag) +{ + GnomePrintMaster *master; + + master = gnome_print_master_new_from_config (config); + if ( collate_flag ) { + gl_print_merge_collated (master, label, record_list, + n_copies, first, + outline_flag, reverse_flag); + } else { + gl_print_merge_uncollated (master, label, record_list, + n_copies, first, + outline_flag, reverse_flag); + } + gnome_print_master_close (master); + + if (preview_flag) { + GtkWidget *preview_widget = + gnome_print_master_preview_new (master, _("Print preview")); + gtk_widget_show (GTK_WIDGET (preview_widget)); + } else { + gnome_print_master_print (master); + } + + g_object_unref (G_OBJECT (master)); +} + diff --git a/glabels2/src/print-dialog.h b/glabels2/src/print-dialog.h new file mode 100644 index 00000000..af1cd6f4 --- /dev/null +++ b/glabels2/src/print-dialog.h @@ -0,0 +1,31 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_dialog.h: Print dialog module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PRINT_DIALOG_H__ +#define __PRINT_DIALOG_H__ + +#include +#include +#include "label.h" + +extern void gl_print_dialog (glLabel *label, BonoboWindow *win); + +#endif diff --git a/glabels2/src/print.c b/glabels2/src/print.c new file mode 100644 index 00000000..b94765a1 --- /dev/null +++ b/glabels2/src/print.c @@ -0,0 +1,1070 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.c: Print module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include +#include +#include +#include +#include +#include + +#include "print.h" +#include "label.h" +#include "label-text.h" +#include "label-box.h" +#include "label-line.h" +#include "label-ellipse.h" +#include "label-image.h" +#include "label-barcode.h" +#include "bc.h" +#include "template.h" + +#include "debug.h" + +#define GL_PRINT_DEFAULT_PAPER "US Letter" + +#define RED(x) ( (((x)>>24) & 0xff) / 255.0 ) +#define GREEN(x) ( (((x)>>16) & 0xff) / 255.0 ) +#define BLUE(x) ( (((x)>>8) & 0xff) / 255.0 ) +#define ALPHA(x) ( ( (x) & 0xff) / 255.0 ) + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ +typedef struct _PrintInfo { + /* gnome print context */ + GnomePrintContext *pc; + + /* gnome print configuration */ + GnomePrintConfig *config; + + /* gLabels Template */ + const glTemplate *template; + gboolean label_rotate_flag; + +} PrintInfo; + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ +static PrintInfo *print_info_new (GnomePrintMaster * master, glLabel * label); +static void print_info_free (PrintInfo ** pi); + +static void print_label (PrintInfo * pi, glLabel * label, gint i, + glMergeRecord * record, gboolean outline_flag, + gboolean reverse_flag); + +static void draw_label (PrintInfo * pi, glLabel * label, + glMergeRecord * record); + +static void draw_text_object (PrintInfo * pi, glLabelText * object, + glMergeRecord * record); +static void draw_box_object (PrintInfo * pi, glLabelBox * object); +static void draw_line_object (PrintInfo * pi, glLabelLine * object); +static void draw_ellipse_object (PrintInfo * pi, glLabelEllipse * object); +static void draw_image_object (PrintInfo * pi, glLabelImage * object); +static void draw_barcode_object (PrintInfo * pi, glLabelBarcode * object, + glMergeRecord * record); + +static void draw_outline (PrintInfo * pi, glLabel * label); +static void clip_to_outline (PrintInfo * pi, glLabel * label); + +static void create_rectangle_path (GnomePrintContext * pc, + gdouble x0, gdouble y0, + gdouble w, gdouble h); +static void create_ellipse_path (GnomePrintContext * pc, + gdouble x0, gdouble y0, + gdouble rx, gdouble ry); +static void create_rounded_rectangle_path (GnomePrintContext * pc, + gdouble x0, gdouble y0, + gdouble w, gdouble h, gdouble r); + +/*****************************************************************************/ +/* Simple (no merge data) print command. */ +/*****************************************************************************/ +void +gl_print_simple (GnomePrintMaster * master, + glLabel * label, + gint n_sheets, + gint first, + gint last, + gboolean outline_flag, + gboolean reverse_flag) +{ + PrintInfo *pi; + gint i_sheet, i_label; + gchar *page_str = NULL; + + gl_debug (DEBUG_PRINT, "START"); + + pi = print_info_new (master, label); + + for (i_sheet = 0; i_sheet < n_sheets; i_sheet++) { + + page_str = g_strdup_printf ("sheet %d", i_sheet + 1); + gnome_print_beginpage (pi->pc, page_str); + g_free (page_str); + + for (i_label = first - 1; i_label < last; i_label++) { + + print_label (pi, label, i_label, NULL, + outline_flag, reverse_flag); + + } + + gnome_print_showpage (pi->pc); + } + + print_info_free (&pi); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*****************************************************************************/ +/* Merge print command (collated copies) */ +/*****************************************************************************/ +void +gl_print_merge_collated (GnomePrintMaster * master, + glLabel * label, + GList * record_list, + gint n_copies, + gint first, + gboolean outline_flag, + gboolean reverse_flag) +{ + PrintInfo *pi; + gint i_sheet, i_label, n_labels_per_page, i_copy; + gchar *str = NULL; + glMergeRecord *record; + GList *p; + + gl_debug (DEBUG_PRINT, "START"); + + pi = print_info_new (master, label); + + n_labels_per_page = (pi->template->nx) * (pi->template->ny); + + i_sheet = 0; + i_label = first - 1; + + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) { + for (i_copy = 0; i_copy < n_copies; i_copy++) { + + if ((i_label == 0) || (i_sheet == 0)) { + str = g_strdup_printf ("sheet %d", + ++i_sheet); + gnome_print_beginpage (pi->pc, str); + g_free (str); + } + + print_label (pi, label, i_label, record, + outline_flag, reverse_flag); + + i_label = (i_label + 1) % n_labels_per_page; + if (i_label == 0) { + gnome_print_showpage (pi->pc); + } + } + } + } + + if (i_label != 0) { + gnome_print_showpage (pi->pc); + } + + print_info_free (&pi); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*****************************************************************************/ +/* Merge print command (uncollated copies) */ +/*****************************************************************************/ +void +gl_print_merge_uncollated (GnomePrintMaster * master, + glLabel * label, + GList * record_list, + gint n_copies, + gint first, + gboolean outline_flag, + gboolean reverse_flag) +{ + PrintInfo *pi; + gint i_sheet, i_label, n_labels_per_page, i_copy; + gchar *str = NULL; + glMergeRecord *record; + GList *p; + + gl_debug (DEBUG_PRINT, "START"); + + pi = print_info_new (master, label); + + n_labels_per_page = (pi->template->nx) * (pi->template->ny); + + i_sheet = 0; + i_label = first - 1; + + for (i_copy = 0; i_copy < n_copies; i_copy++) { + + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) { + + + if ((i_label == 0) || (i_sheet == 0)) { + str = g_strdup_printf ("sheet %d", + ++i_sheet); + gnome_print_beginpage (pi->pc, str); + g_free (str); + } + + print_label (pi, label, i_label, record, + outline_flag, reverse_flag); + + i_label = (i_label + 1) % n_labels_per_page; + if (i_label == 0) { + gnome_print_showpage (pi->pc); + } + } + } + + } + if (i_label != 0) { + gnome_print_showpage (pi->pc); + } + + print_info_free (&pi); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*****************************************************************************/ +/* Batch print. Call appropriate function above. */ +/*****************************************************************************/ +void +gl_print_batch (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint n_copies, + gboolean outline_flag, gboolean reverse_flag) +{ + gint n_per_page; + GList *record_list = NULL; + glMerge *merge; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + merge = gl_label_get_merge (label); + template = gl_label_get_template (label); + + if ( merge->type == GL_MERGE_NONE ) { + n_per_page = (template->nx)*(template->ny); + + gl_print_simple (master, label, n_sheets, 1, n_per_page, + outline_flag, reverse_flag); + } else { + record_list = gl_merge_read_data (merge->type, + merge->field_defs, + merge->src); + + gl_print_merge_collated (master, label, record_list, + n_copies, 1, + outline_flag, reverse_flag); + } + gl_merge_free (&merge); + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. new print info structure */ +/*---------------------------------------------------------------------------*/ +static PrintInfo * +print_info_new (GnomePrintMaster * master, + glLabel * label) +{ + PrintInfo *pi = g_new0 (PrintInfo, 1); + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + if (template == NULL) { + g_warning ("Label has no template"); + return NULL; + } + + pi->pc = gnome_print_master_get_context (master); + pi->config = gnome_print_master_get_config (master); + + if ((template != NULL) && (template->page_size != NULL)) { + const GnomePrintPaper *paper = NULL; + + gl_debug (DEBUG_PRINT, + "setting page size = \"%s\"", template->page_size); + + + /* Currently cannot set page size directly from name, */ + /* since we must set Ids not Names and there is no */ + /* way to do the reverse lookup of Id from Name. */ + /* Sometimes they are the same, but not always */ + /* (e.g. for the name "US Letter" id="USLetter" */ + /* So we use the "Custom" Id. */ + paper = gnome_print_paper_get_by_name (template->page_size); + gnome_print_config_set (pi->config, + GNOME_PRINT_KEY_PAPER_SIZE, + "Custom"); + gnome_print_config_set_length (pi->config, + GNOME_PRINT_KEY_PAPER_WIDTH, + paper->width, + GNOME_PRINT_PS_UNIT); + gnome_print_config_set_length (pi->config, + GNOME_PRINT_KEY_PAPER_HEIGHT, + paper->height, + GNOME_PRINT_PS_UNIT); + } else { + gnome_print_config_set (pi->config, + GNOME_PRINT_KEY_PAPER_SIZE, + GL_PRINT_DEFAULT_PAPER); + } + +#if 1 + /* gnome_print_config_dump (pi->config); */ + { + GList *p, *list; + GnomePrintPaper *paper; + gchar *name; + + list = gnome_print_paper_get_list(); + for ( p=list; p != NULL; p=p->next ) { + paper = (GnomePrintPaper *)p->data; + gl_debug (DEBUG_PRINT, " \"%s\"", paper->name); + } + gl_debug (DEBUG_PRINT, + "template->page_size = \"%s\"", template->page_size); + + name = gnome_print_config_get (pi->config, + GNOME_PRINT_KEY_PAPER_SIZE); + gl_debug (DEBUG_PRINT, "config = \"%s\"", name); + } +#endif + + pi->template = template; + pi->label_rotate_flag = gl_label_get_rotate_flag (label); + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); + + return pi; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. free print info structure */ +/*---------------------------------------------------------------------------*/ +static void +print_info_free (PrintInfo ** pi) +{ + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_context_close ((*pi)->pc); + + g_free (*pi); + *pi = NULL; + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Print i'th label. */ +/*---------------------------------------------------------------------------*/ +static void +print_label (PrintInfo * pi, + glLabel * label, + gint i_label, + glMergeRecord * record, + gboolean outline_flag, + gboolean reverse_flag) +{ + gdouble a[6]; + gint ix, iy; + gdouble width, height; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + gl_label_get_size (label, &width, &height); + + ix = i_label % (template->nx); + iy = ((template->ny) - 1) - (i_label / (template->nx)); + + gnome_print_gsave (pi->pc); + + /* Transform coordinate system to be relative to upper corner */ + /* of the current label */ + gnome_print_translate (pi->pc, + ix * (template->dx) + template->x0, + iy * (template->dy) + template->y0); + if (gl_label_get_rotate_flag (label)) { + gl_debug (DEBUG_PRINT, "Rotate flag set"); + gnome_print_rotate (pi->pc, 90.0); + gnome_print_scale (pi->pc, 1.0, -1.0); + } else { + gl_debug (DEBUG_PRINT, "Rotate flag NOT set"); + art_affine_scale (a, 1.0, -1.0); + a[5] = height; + gnome_print_concat (pi->pc, a); + } + if ( reverse_flag ) { + gnome_print_translate (pi->pc, width, 0.0); + art_affine_scale (a, -1.0, 1.0); + gnome_print_concat (pi->pc, a); + } + if (outline_flag) { + draw_outline (pi, label); + } + clip_to_outline (pi, label); + draw_label (pi, label, record); + + gnome_print_grestore (pi->pc); + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw label. */ +/*---------------------------------------------------------------------------*/ +static void +draw_label (PrintInfo * pi, + glLabel * label, + glMergeRecord * record) +{ + GList *p_obj; + glLabelObject *object; + + gl_debug (DEBUG_PRINT, "START"); + + for (p_obj = label->objects; p_obj != NULL; p_obj = p_obj->next) { + object = (glLabelObject *) p_obj->data; + + if (GL_IS_LABEL_TEXT(object)) { + draw_text_object (pi, GL_LABEL_TEXT(object), record); + } else if (GL_IS_LABEL_BOX(object)) { + draw_box_object (pi, GL_LABEL_BOX(object)); + } else if (GL_IS_LABEL_LINE(object)) { + draw_line_object (pi, GL_LABEL_LINE(object)); + } else if (GL_IS_LABEL_ELLIPSE(object)) { + draw_ellipse_object (pi, GL_LABEL_ELLIPSE(object)); + } else if (GL_IS_LABEL_IMAGE(object)) { + draw_image_object (pi, GL_LABEL_IMAGE(object)); + } else if (GL_IS_LABEL_BARCODE(object)) { + draw_barcode_object (pi, GL_LABEL_BARCODE(object), + record); + } + + } + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw text object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_text_object (PrintInfo * pi, + glLabelText * object, + glMergeRecord * record) +{ + GnomeFont *font; + gchar **line; + gint i; + gdouble w; + gdouble x_offset, y_offset; + gdouble x, y; + gdouble x0, y0; + gchar *text; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + GnomeGlyphList *glyphlist; + ArtDRect bbox; + gdouble affine[6]; + + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x0, &y0); + lines = gl_label_text_get_lines (object); + gl_label_text_get_props (object, + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + font = gnome_font_find_closest_from_weight_slant ( + font_family, + font_weight, + font_italic_flag, + font_size); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, ALPHA (color)); + + text = gl_text_node_lines_expand (lines, record); + line = g_strsplit (text, "\n", -1); + g_free (text); + + art_affine_identity (affine); + + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, color, + 0.0, 0.0, + line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + w = bbox.x1; + + switch (just) { + case GTK_JUSTIFY_LEFT: + x_offset = 0.0; + break; + case GTK_JUSTIFY_CENTER: + x_offset = -w / 2.0; + break; + case GTK_JUSTIFY_RIGHT: + x_offset = -w; + break; + default: + x_offset = 0.0; + break; /* shouldn't happen */ + } + + y_offset = (i + 1) * font_size + + gnome_font_get_descender (font); + + x = x0 + x_offset; + y = y0 + y_offset; + gnome_print_moveto (pi->pc, x, y); + + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, line[i]); + gnome_print_grestore (pi->pc); + } + + g_strfreev (line); + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw box object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_box_object (PrintInfo * pi, + glLabelBox * object) +{ + gdouble x, y, w, h; + gdouble line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width (object); + line_color = gl_label_box_get_line_color (object); + fill_color = gl_label_box_get_fill_color (object); + + /* Paint fill color */ + create_rectangle_path (pi->pc, x, y, w, h); + gnome_print_setrgbcolor (pi->pc, + RED (fill_color), + GREEN (fill_color), + BLUE (fill_color)); + gnome_print_setopacity (pi->pc, ALPHA (fill_color)); + gnome_print_fill (pi->pc); + + /* Draw outline */ + create_rectangle_path (pi->pc, x, y, w, h); + gnome_print_setrgbcolor (pi->pc, + RED (line_color), + GREEN (line_color), + BLUE (line_color)); + gnome_print_setopacity (pi->pc, ALPHA (line_color)); + gnome_print_setlinewidth (pi->pc, line_width); + gnome_print_stroke (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw line object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_line_object (PrintInfo * pi, + glLabelLine * object) +{ + gdouble x, y, w, h; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width (object); + line_color = gl_label_line_get_line_color (object); + + gnome_print_moveto (pi->pc, x, y); + gnome_print_lineto (pi->pc, x + w, y + h); + gnome_print_setrgbcolor (pi->pc, + RED (line_color), + GREEN (line_color), + BLUE (line_color)); + gnome_print_setopacity (pi->pc, ALPHA (line_color)); + gnome_print_setlinewidth (pi->pc, line_width); + gnome_print_stroke (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw ellipse object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_ellipse_object (PrintInfo * pi, + glLabelEllipse * object) +{ + gdouble x, y, x0, y0, rx, ry, w, h; + gdouble line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width (object); + line_color = gl_label_ellipse_get_line_color (object); + fill_color = gl_label_ellipse_get_fill_color (object); + + rx = w / 2.0; + ry = h / 2.0; + x0 = x + rx; + y0 = y + ry; + + /* Paint fill color */ + create_ellipse_path (pi->pc, x0, y0, rx, ry); + gnome_print_setrgbcolor (pi->pc, + RED (fill_color), + GREEN (fill_color), + BLUE (fill_color)); + gnome_print_setopacity (pi->pc, ALPHA (fill_color)); + gnome_print_fill (pi->pc); + + /* Draw outline */ + create_ellipse_path (pi->pc, x0, y0, rx, ry); + gnome_print_setrgbcolor (pi->pc, + RED (line_color), + GREEN (line_color), + BLUE (line_color)); + gnome_print_setopacity (pi->pc, ALPHA (line_color)); + gnome_print_setlinewidth (pi->pc, line_width); + gnome_print_stroke (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw image object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_image_object (PrintInfo * pi, + glLabelImage * object) +{ + gdouble x, y, w, h; + const GdkPixbuf *pixbuf; + guchar *image_data; + gint image_w, image_h, image_stride; + gboolean image_alpha_flag; + gint ret; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + + pixbuf = gl_label_image_get_pixbuf (object); + image_data = gdk_pixbuf_get_pixels (pixbuf); + image_w = gdk_pixbuf_get_width (pixbuf); + image_h = gdk_pixbuf_get_height (pixbuf); + image_stride = gdk_pixbuf_get_rowstride(pixbuf); + image_alpha_flag = gdk_pixbuf_get_has_alpha(pixbuf); + + gnome_print_gsave (pi->pc); + gnome_print_translate (pi->pc, x, y+h); + gnome_print_scale (pi->pc, w, -h); + if (image_alpha_flag) { + ret = gnome_print_rgbaimage (pi->pc, image_data, + image_w, image_h, image_stride); + gl_debug (DEBUG_PRINT, "Ret a = %d", ret); + } else { + ret = gnome_print_rgbimage (pi->pc, image_data, + image_w, image_h, image_stride); + gl_debug (DEBUG_PRINT, "Ret = %d", ret); + } + gnome_print_grestore (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw box object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_barcode_object (PrintInfo * pi, + glLabelBarcode * object, + glMergeRecord * record) +{ + glBarcode *gbc; + glBarcodeLine *line; + glBarcodeChar *bchar; + GList *li; + gdouble x, y, y_offset; + GnomeFont *font; + gchar *text, *cstring; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + text_node = gl_label_barcode_get_data (object); + gl_label_barcode_get_props (object, + &style, &text_flag, &color, &scale); + + text = gl_text_node_expand (text_node, record); + gbc = gl_barcode_new (style, text_flag, scale, text); + g_free (text); + gl_text_node_free (&text_node); + + if (gbc == NULL) { + + font = gnome_font_find_closest_from_weight_slant ( + GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, 12.0); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, + ALPHA (color)); + + y_offset = 12.0 - gnome_font_get_descender (font); + gnome_print_moveto (pi->pc, x, y + y_offset); + + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, _("Invalid barcode")); + gnome_print_grestore (pi->pc); + + } else { + + for (li = gbc->lines; li != NULL; li = li->next) { + line = (glBarcodeLine *) li->data; + + gnome_print_moveto (pi->pc, x + line->x, y + line->y); + gnome_print_lineto (pi->pc, x + line->x, + y + line->y + line->length); + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, + ALPHA (color)); + gnome_print_setlinewidth (pi->pc, line->width); + gnome_print_stroke (pi->pc); + } + + for (li = gbc->chars; li != NULL; li = li->next) { + bchar = (glBarcodeChar *) li->data; + + font = gnome_font_find_closest_from_weight_slant ( + GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, bchar->fsize); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, + ALPHA (color)); + + y_offset = + bchar->y + bchar->fsize - + gnome_font_get_descender (font); + gnome_print_moveto (pi->pc, x + bchar->x, y + y_offset); + + cstring = g_strdup_printf ("%c", bchar->c); + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, cstring); + gnome_print_grestore (pi->pc); + g_free (cstring); + + } + + gl_barcode_free (&gbc); + + } + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw outline. */ +/*---------------------------------------------------------------------------*/ +static void +draw_outline (PrintInfo * pi, + glLabel * label) +{ + gdouble w, h, r; + gdouble r1, r2; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + gnome_print_setrgbcolor (pi->pc, 0.25, 0.25, 0.25); + gnome_print_setopacity (pi->pc, 1.0); + gnome_print_setlinewidth (pi->pc, 0.25); + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + gl_label_get_size (label, &w, &h); + r = template->label_round; + if (r == 0.0) { + /* simple rectangle */ + create_rectangle_path (pi->pc, 0.0, 0.0, w, h); + } else { + /* rectangle with rounded corners */ + create_rounded_rectangle_path (pi->pc, 0.0, 0.0, + w, h, r); + } + gnome_print_stroke (pi->pc); + break; + + case GL_TEMPLATE_STYLE_ROUND: + /* Round style */ + r1 = template->label_radius; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_stroke (pi->pc); + break; + + case GL_TEMPLATE_STYLE_CD: + /* CD style, round label w/ concentric round hole */ + r1 = template->label_radius; + r2 = template->label_hole; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_stroke (pi->pc); + create_ellipse_path (pi->pc, r1, r1, r2, r2); + gnome_print_stroke (pi->pc); + break; + + default: + g_warning ("Unknown template label style"); + break; + } + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Clip to outline. */ +/*---------------------------------------------------------------------------*/ +static void +clip_to_outline (PrintInfo * pi, + glLabel * label) +{ + gdouble w, h, r; + gdouble r1; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + gl_label_get_size (label, &w, &h); + r = template->label_round; + if (r == 0.0) { + /* simple rectangle */ + create_rectangle_path (pi->pc, 0.0, 0.0, w, h); + } else { + /* rectangle with rounded corners */ + create_rounded_rectangle_path (pi->pc, 0.0, 0.0, + w, h, r); + } + gnome_print_clip (pi->pc); + break; + + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + r1 = template->label_radius; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_clip (pi->pc); + break; + + default: + g_warning ("Unknown template label style"); + break; + } + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Path creation utilities. */ +/*---------------------------------------------------------------------------*/ +static void +create_rectangle_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble w, + gdouble h) +{ + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_newpath (pc); + gnome_print_moveto (pc, x0, y0); + gnome_print_lineto (pc, x0 + w, y0); + gnome_print_lineto (pc, x0 + w, y0 + h); + gnome_print_lineto (pc, x0, y0 + h); + gnome_print_lineto (pc, x0, y0); + gnome_print_closepath (pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +static void +create_ellipse_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble rx, + gdouble ry) +{ + gdouble x, y; + gint i_theta; + + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_newpath (pc); + gnome_print_moveto (pc, x0 + rx, y0); + for (i_theta = 2; i_theta <= 360; i_theta += 2) { + x = x0 + rx * cos (i_theta * M_PI / 180.0); + y = y0 + ry * sin (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + gnome_print_closepath (pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +static void +create_rounded_rectangle_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble w, + gdouble h, + gdouble r) +{ + gdouble x, y; + gint i_theta; + + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_newpath (pc); + + gnome_print_moveto (pc, x0 + r, y0); + for (i_theta = 5; i_theta <= 90; i_theta += 5) { + x = x0 + r - r * sin (i_theta * M_PI / 180.0); + y = y0 + r - r * cos (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + x = x0 + r - r * cos (i_theta * M_PI / 180.0); + y = y0 + (h - r) + r * sin (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + x = x0 + (w - r) + r * sin (i_theta * M_PI / 180.0); + y = y0 + (h - r) + r * cos (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + x = x0 + (w - r) + r * cos (i_theta * M_PI / 180.0); + y = y0 + r - r * sin (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + gnome_print_lineto (pc, x0 + r, y0); + + gnome_print_closepath (pc); + + gl_debug (DEBUG_PRINT, "END"); +} diff --git a/glabels2/src/print.h b/glabels2/src/print.h new file mode 100644 index 00000000..b79e5c55 --- /dev/null +++ b/glabels2/src/print.h @@ -0,0 +1,53 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.h: Print module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PRINT_H__ +#define __PRINT_H__ + +#include +#include +#include +#include "label.h" + +extern void gl_print_simple (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint first, gint last, + gboolean outline_flag, gboolean reverse_flag); + +extern void gl_print_merge_collated (GnomePrintMaster * master, + glLabel * label, + GList *record_list, + gint n_copies, gint first, + gboolean outline_flag, + gboolean reverse_flag); + +extern void gl_print_merge_uncollated (GnomePrintMaster * master, + glLabel * label, + GList *record_list, + gint n_copies, gint first, + gboolean outline_flag, + gboolean reverse_flag); + +extern void gl_print_batch (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint n_copies, + gboolean outline_flag, gboolean reverse_flag); + + +#endif diff --git a/glabels2/src/recent.c b/glabels2/src/recent.c new file mode 100644 index 00000000..6e0e40df --- /dev/null +++ b/glabels2/src/recent.c @@ -0,0 +1,45 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * recent.c: gLabels recent files module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + + +#include "recent.h" +#include "prefs.h" + +#include "debug.h" + +static GnomeRecentModel *model; + + +GnomeRecentModel * +gl_recent_get_model (void) +{ + return model; +} + +void +gl_recent_init (void) +{ + gl_debug (DEBUG_RECENT, "max_recents = %d", gl_prefs->max_recents); + + model = gnome_recent_model_new ("glabels", gl_prefs->max_recents); +} diff --git a/glabels2/src/recent.h b/glabels2/src/recent.h new file mode 100644 index 00000000..0be911d1 --- /dev/null +++ b/glabels2/src/recent.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * recent.h: gLabels recent files module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __RECENT_H__ +#define __RECENT_H__ + +#include "gnome-recent-model.h" + + +GnomeRecentModel * gl_recent_get_model (void); +void gl_recent_init (void); + +#endif /*__RECENT_H__*/ + diff --git a/glabels2/src/splash.c b/glabels2/src/splash.c new file mode 100644 index 00000000..1812455c --- /dev/null +++ b/glabels2/src/splash.c @@ -0,0 +1,115 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * splash.c: Splash screen module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#include "splash.h" + +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define SPLASH_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-logo.png") +#else +#define SPLASH_PIXMAP gnome_pixmap_file("glabels/glabels-logo.png") +#endif + +#define SPLASH_TIMEOUT 2000 + +static GtkWidget *splash = NULL; + +static gint splash_timeout (gpointer not_used); + + +/***************************************************************************/ +/* Create splash screen. */ +/***************************************************************************/ +void +gl_splash (void) +{ + GtkWidget *wimage, *wvbox, *whbox, *wframe1, *wframe2; + gchar *label; + GdkPixbuf *pixbuf; + GError *gerror = NULL; + + if (splash) + return; + + splash = gtk_window_new (GTK_WINDOW_POPUP); + gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER); + + wframe1 = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (wframe1), GTK_SHADOW_OUT); + wframe2 = gtk_frame_new (NULL); + + wvbox = gtk_vbox_new (FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 2); + + whbox = gtk_hbox_new (FALSE, 5); + + if (!g_file_test (SPLASH_PIXMAP, G_FILE_TEST_EXISTS)) { + g_warning ("Could not find %s", SPLASH_PIXMAP); + } + pixbuf = gdk_pixbuf_new_from_file (SPLASH_PIXMAP, &gerror); + if (gerror != NULL) { + g_warning ("cannot open splash pixbuf: %s", gerror->message ); + gtk_widget_destroy (splash); + return; + } + wimage = gtk_image_new_from_pixbuf (pixbuf); + + gtk_container_add (GTK_CONTAINER (splash), wframe1); + gtk_container_add (GTK_CONTAINER (wframe1), wframe2); + gtk_container_add (GTK_CONTAINER (wframe2), wvbox); + + gtk_box_pack_start (GTK_BOX (wvbox), wimage, TRUE, TRUE, 0); + + label = g_strdup_printf ("Version %s", VERSION); + gtk_box_pack_start (GTK_BOX (wvbox), + gtk_label_new (label), TRUE, TRUE, 0); + g_free (label); + + gtk_widget_show_all (splash); + + gtk_timeout_add (SPLASH_TIMEOUT, splash_timeout, NULL); + + while (gtk_events_pending ()) { + gtk_main_iteration (); + } +} + +/*-------------------------------------------------------------------------*/ +/* PRIVATE. Callback to tear-down splash screen once timer has expired. */ +/*-------------------------------------------------------------------------*/ +static gint +splash_timeout (gpointer not_used) +{ + if (splash) { + gtk_widget_destroy (splash); + splash = NULL; + } + + return FALSE; +} + diff --git a/glabels2/src/splash.h b/glabels2/src/splash.h new file mode 100644 index 00000000..25cd5b66 --- /dev/null +++ b/glabels2/src/splash.h @@ -0,0 +1,28 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * splash.c: Splash screen module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __SPLASH_H__ +#define __SPLASH_H__ + +void gl_splash (void); + +#endif diff --git a/glabels2/src/stock-pixmaps/Makefile.am b/glabels2/src/stock-pixmaps/Makefile.am new file mode 100644 index 00000000..fde01153 --- /dev/null +++ b/glabels2/src/stock-pixmaps/Makefile.am @@ -0,0 +1,30 @@ + +IMAGES = \ + stock_arrow_24.png \ + stock_barcode_24.png \ + stock_box_24.png \ + stock_ellipse_24.png \ + stock_image_24.png \ + stock_line_24.png \ + stock_merge_24.png \ + stock_text_24.png + +VARIABLES1 = \ + stock_arrow_24 $(srcdir)/stock_arrow_24.png \ + stock_barcode_24 $(srcdir)/stock_barcode_24.png \ + stock_box_24 $(srcdir)/stock_box_24.png \ + stock_ellipse_24 $(srcdir)/stock_ellipse_24.png \ + stock_image_24 $(srcdir)/stock_image_24.png \ + stock_line_24 $(srcdir)/stock_line_24.png \ + stock_merge_24 $(srcdir)/stock_merge_24.png \ + stock_text_24 $(srcdir)/stock_text_24.png + +noinst_DATA = stockpixbufs.h +CLEANFILES = $(noinst_DATA) + +stockpixbufs.h: $(IMAGES) + gdk-pixbuf-csource \ + --raw --build-list $(VARIABLES1) > $(srcdir)/stockpixbufs.h || \ + ( rm -f $(srcdir)/stockpixbufs.h && false ) + +EXTRA_DIST = $(IMAGES) stockpixbufs.h diff --git a/glabels2/src/stock-pixmaps/Makefile.in b/glabels2/src/stock-pixmaps/Makefile.in new file mode 100644 index 00000000..0a6dfe92 --- /dev/null +++ b/glabels2/src/stock-pixmaps/Makefile.in @@ -0,0 +1,207 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +IMAGES = stock_arrow_24.png stock_barcode_24.png stock_box_24.png stock_ellipse_24.png stock_image_24.png stock_line_24.png stock_merge_24.png stock_text_24.png + + +VARIABLES1 = stock_arrow_24 $(srcdir)/stock_arrow_24.png stock_barcode_24 $(srcdir)/stock_barcode_24.png stock_box_24 $(srcdir)/stock_box_24.png stock_ellipse_24 $(srcdir)/stock_ellipse_24.png stock_image_24 $(srcdir)/stock_image_24.png stock_line_24 $(srcdir)/stock_line_24.png stock_merge_24 $(srcdir)/stock_merge_24.png stock_text_24 $(srcdir)/stock_text_24.png + + +noinst_DATA = stockpixbufs.h +CLEANFILES = $(noinst_DATA) + +EXTRA_DIST = $(IMAGES) stockpixbufs.h +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/stock-pixmaps/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/stock-pixmaps + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +stockpixbufs.h: $(IMAGES) + gdk-pixbuf-csource \ + --raw --build-list $(VARIABLES1) > $(srcdir)/stockpixbufs.h || \ + ( rm -f $(srcdir)/stockpixbufs.h && false ) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/src/stock-pixmaps/stock_arrow_24.png b/glabels2/src/stock-pixmaps/stock_arrow_24.png new file mode 100644 index 0000000000000000000000000000000000000000..fcd7e5771f5b7bcde5c771686c433156f9ebd164 GIT binary patch literal 328 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G^tAk28_ZrvZCAbW|YuPgf{b{Q5iS?8#rM4-@BPZ!6KiaBpD8~QaFO0<8RFT}=M z_>n=b;p7ozi$+fC)!aOC2eTK1e~?+%#>ti>BCh5X!`pb}pisxf_rE8s?|$ex%Ov-g z-QWGbH#aLYp1so4a2klqvK$?>w=Vcn_E&{thnKE~uIDs`2PW$eI5HkA-!k07n1!SMI`a=*f%6o!9Yw_}4l|TXSC?K{^yPd=;j`7( zS1*x$&A#v8Prau55yuMGA2`1*C-M)+`-&sNZ8N57Mz|ehk$;h2S$DqviSShs=ld0` Ss~!M7$l&Sf=d#Wzp$Py6B!LtF literal 0 HcmV?d00001 diff --git a/glabels2/src/stock-pixmaps/stock_barcode_24.png b/glabels2/src/stock-pixmaps/stock_barcode_24.png new file mode 100644 index 0000000000000000000000000000000000000000..f92e5d785d70fc7eeb3c1e74e5fd335713fdf8ab GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G^tAk28_ZrvZCAbW|YuPgf{b{Q5Kjw=~)KoN%Bo-U3d6?5KBJxFU?~9MN+pf4732?3S3j3^P6m9fg!jyVG zG8HkHm)^Q^Rq5KNZxT-IcN)uAah}oeXg$pJ;|ddFyC?_$50M)_3JFExE9ZVP5Aqeb zR%g@5I`4q%k=!d!LW|w&ue;3@o!>2AYr#>e=<3JSZpB}tdi}{vqvfycKDXb~t~>i# V$ls6eMkCP044$rjF6*2UngBvtX6yg} literal 0 HcmV?d00001 diff --git a/glabels2/src/stock-pixmaps/stock_ellipse_24.png b/glabels2/src/stock-pixmaps/stock_ellipse_24.png new file mode 100644 index 0000000000000000000000000000000000000000..8ff2494c482b59c7149e8b32cb25987e201398ec GIT binary patch literal 741 zcmV=C`rS16_ftDqR?XAs?#N%Rb1BTS#&dtj-tgolBF^KN>lgSz+r@piQ zP`A}*E06$YmJ(PEgn^d;{r9fX)!9z5SVYq_08G=w=kww5co=vyY!}%H49I@TErJEr zNsL9&b=@UMfysE1SnLDck(0`_3m5@r0cvdP530`nyM4=&12k>ifL7zPnvMV&U>M5N ztRLX~xl`=!>R6UsAsB4n`jrc67?Hg7P7weQ3N=?uuF%=JLv;hdX2c!j9Un@#HB_~L zrY+iQ9pZiijsj~|1*#%9j2wl6X*C6wtN{a1aEpe0zRNvaM5TE4Vt~U(BWlbGGfy-nVZWoJ)Ppg!>87%Ge7~Dk|K_! z!V7c&QDwM&;}YSPE$DhJS;HWkF&K=!qvvd|)$cT-JiJG|f!9FZt(tBE4ggnO=Iyu$ zd_){i8c510Np^wr^NQ8|yz};Ed7%Id=AOSsw zIEkG&DWWV`I-Pw!|Ns4tW5a)M;`Q~9u@gX3Ka%Bt!;xnKa1PjH8=$+Xa5t5%=>y>O zM+B~-7I>`hwE-~LNRVfOs%?>6+-tPoAV|~LOcNYH)gmInck+SrslXDjRVV?ZrC>5@ zgD)1VilkIh=1oQ(I01nG>p;O|1P@Q~J#Q)_*D9a47C02g{ww$o@|Rk2c2X{CRISeE^T5aQN;4)HUjf7L6j`rt zdL-D6_{_}}YlYY;>T1{5N71;N(EC$B8WPx^>N;Tr_IVZeIUv)5IQslDRGio8p} zgxB?q*52z_k!9q+m^q8Z3XCh@H6*ZY935}I!dnH@1gqY=D7rXOK&MJrZ}lE*C?Eko zLIviRBt%Jefy5^`0fxYi8?T)y_1i5#3hcQGzg)aLIiJoFH%?>JXTUzigORue?;eOa iE5Q?&I|xL%2j?4FSiNgEM;}`N0000mqo8aZqv=Z$^EPMb# zK^rZ0gPRnl*sa7LmgSto`Dd7&9scP=5Z6BPw{})OfMM23clhx!n!2;Tox1gF?KLfO1_rJ&#{T7P_isWv6RTKuq~X! zaE`bd<*PmNEulS!a^x_MRwe{bA z>PJnu{%OtILMu+^h&wcNw_@8*D;A+6{}5`vhM7|G$teHCiO~1W9AWP?J&gOAFcqKi oloOzLcHH3w_c6d@j{I-%4K`Ugj}m>_5&!@I07*qoM6N<$f;%Fl9RL6T literal 0 HcmV?d00001 diff --git a/glabels2/src/stock-pixmaps/stock_merge_24.png b/glabels2/src/stock-pixmaps/stock_merge_24.png new file mode 100644 index 0000000000000000000000000000000000000000..94622922ef170839a7a0d3691752686187f300f4 GIT binary patch literal 537 zcmV+!0_OdRP)Yj1wpnJedd}j6A-HZ>7^GAO;1sw79_J-k zvlkD70Dve8%8=Uy_7_b`5(t3r`v5qOkJfz#g9rev`x$TW4%8MUP)UL?jF~%*PZS08 zdQL%zi&6^U47dVr7bO7@kx)F(6VLO~cH)B|5D`hojN%L6xU>S1FqbV1EuT?v4qO8_ zl@wSEm$7mRl75fAiy~7h=i6&#>d~Q0eArp3u-X5)VQgV zil<3{hE)S0`|jlV%(nT!J@7#MY$t2gfTrn>>oY;i?C~4WW_pXqz$?%IRFYt?)oPuL zMxzhl3z!%d>%bG!AIp~cCcrlE3`Aypj8)W>x7Bfg9gE#J@Cj^~_QWKt84^w6m*9@L bpt<+~=P?|fet20200000NkvXXu0mjfHu2uh literal 0 HcmV?d00001 diff --git a/glabels2/src/stock-pixmaps/stock_text_24.png b/glabels2/src/stock-pixmaps/stock_text_24.png new file mode 100644 index 0000000000000000000000000000000000000000..7be40b4f450cdccc2fb05a00a9063901403de0f4 GIT binary patch literal 355 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G^tAk28_ZrvZCAbW|YuPgf{b{Q5+(fGNK?0`ZaJY5_^D(1YsveAp#QJ~?W{w#%Q zY=K{RYnZF&JLs_J=GM5zA3SvKl-nW+7RA;DZQhHH&f6d(oxl0msXqoX#v4ArKezF8 zSN+-N{2$vQr^uhl-ZV{d*MY*tWo?r+?(2)rS$t?g;QeFCD)%%5OIiZ&ToK&dSAOTA zP;g1G@1&z0**2=LrW*WCkKt5*m9%Mv!c`eNgJa&Z-#<$|`SV1?IMHYA6s~12{w`gx zYX90vK?lwMrgEBjUw_WUC;d~d%Q94!-)@P2y3RB-4$9 y(>}cGS^P_2{h^a}svZ}GkC_O*JJxmdCsVbo>5|J?$FzWcXYh3Ob6Mw<&;$TqER@{< literal 0 HcmV?d00001 diff --git a/glabels2/src/stock.c b/glabels2/src/stock.c new file mode 100644 index 00000000..653a68c1 --- /dev/null +++ b/glabels2/src/stock.c @@ -0,0 +1,137 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * stock.h: Stock image module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include "stock.h" +#include "stock-pixmaps/stockpixbufs.h" + +void +gl_stock_init (void) +{ + GdkPixbuf *pixbuf; + GtkIconFactory *factory; + GtkIconSet *icon_set; + GdkPixdata *pixdata; + + static GtkStockItem items[] = { + { GL_STOCK_ARROW, "Arrow", 0, 0, NULL }, + { GL_STOCK_TEXT, "Text", 0, 0, NULL }, + { GL_STOCK_LINE, "Line", 0, 0, NULL }, + { GL_STOCK_BOX, "Box", 0, 0, NULL }, + { GL_STOCK_ELLIPSE, "Ellipse", 0, 0, NULL }, + { GL_STOCK_IMAGE, "Image", 0, 0, NULL }, + { GL_STOCK_BARCODE, "Barcode", 0, 0, NULL }, + { GL_STOCK_MERGE, "Merge", 0, 0, NULL }, + }; + + gtk_stock_add (items, G_N_ELEMENTS (items)); + + factory = gtk_icon_factory_new (); + gtk_icon_factory_add_default (factory); + + pixdata = g_new0 (GdkPixdata, 1); + + /* Arrow */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_arrow_24), stock_arrow_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_ARROW, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Text */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_text_24), stock_text_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_TEXT, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Line */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_line_24), stock_line_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_LINE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Box */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_box_24), stock_box_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_BOX, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Ellipse */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_ellipse_24), stock_ellipse_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_ELLIPSE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Image */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_image_24), stock_image_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_IMAGE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Barcode */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_barcode_24), stock_barcode_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_BARCODE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Merge */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_merge_24), stock_merge_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_MERGE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + g_free (pixdata); + g_object_unref (G_OBJECT(factory)); +} diff --git a/glabels2/src/stock.h b/glabels2/src/stock.h new file mode 100644 index 00000000..c24f577d --- /dev/null +++ b/glabels2/src/stock.h @@ -0,0 +1,39 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * stock.h: Stock image module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __STOCK_H__ +#define __STOCK_H__ + +/* Stock names */ + +#define GL_STOCK_ARROW "gl_stock_arrow" +#define GL_STOCK_TEXT "gl_stock_text" +#define GL_STOCK_LINE "gl_stock_line" +#define GL_STOCK_BOX "gl_stock_box" +#define GL_STOCK_ELLIPSE "gl_stock_ellipse" +#define GL_STOCK_IMAGE "gl_stock_image" +#define GL_STOCK_BARCODE "gl_stock_barcode" +#define GL_STOCK_MERGE "gl_stock_merge" + +void gl_stock_init (void); + +#endif diff --git a/glabels2/src/template.c b/glabels2/src/template.c new file mode 100644 index 00000000..55627866 --- /dev/null +++ b/glabels2/src/template.c @@ -0,0 +1,804 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * template.c: template module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "template.h" + +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define GL_DATA_DIR (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "glabels") +#else +#define GL_DATA_DIR gnome_datadir_file("glabels") +#endif + +#define FULL_PAGE "Full-page" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GList *templates = NULL; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ +static glTemplate *template_full_page (const gchar *page_size); + +static GList *read_templates (void); + +static gchar *get_home_data_dir (void); +static GList *read_template_files_from_dir (GList * templates, + const gchar * dirname); +static GList *read_templates_from_file (GList * templates, + gchar * xml_filename); + +static void xml_parse_label (xmlNodePtr label_node, glTemplate * template); +static void xml_parse_layout (xmlNodePtr layout_node, glTemplate * template); +static void xml_parse_markup (xmlNodePtr markup_node, glTemplate * template); +static void xml_parse_alias (xmlNodePtr alias_node, glTemplate * template); + +static void xml_add_label (glTemplate *template, xmlNodePtr root, xmlNsPtr ns); +static void xml_add_layout (glTemplate *template, xmlNodePtr root, xmlNsPtr ns); +static void xml_add_markup_margin (glTemplate *template, xmlNodePtr root, xmlNsPtr ns); +static void xml_add_alias (gchar *name, xmlNodePtr root, xmlNsPtr ns); + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_template_init (void) +{ + GList *page_sizes, *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + templates = read_templates (); + + page_sizes = gl_template_get_page_size_list (); + for ( p=page_sizes; p != NULL; p=p->next ) { + templates = g_list_append (templates, + template_full_page (p->data)); + } + gl_template_free_page_size_list (&page_sizes); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*****************************************************************************/ +/* Get a list of valid page size names */ +/*****************************************************************************/ +GList * +gl_template_get_page_size_list (void) +{ + GList *names = NULL; + GList *p, *paper_list; + GnomePrintPaper *paper; + + gl_debug (DEBUG_TEMPLATE, "START"); + + paper_list = gnome_print_paper_get_list(); + for ( p=paper_list; p != NULL; p=p->next ) { + paper = (GnomePrintPaper *)p->data; + if ( g_strcasecmp(paper->name, "custom") != 0 ) { + names = g_list_append (names, g_strdup (paper->name)); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); + return names; +} + +/*****************************************************************************/ +/* Free a list of page size names. */ +/*****************************************************************************/ +void +gl_template_free_page_size_list (GList ** names) +{ + GList *p_name; + + gl_debug (DEBUG_TEMPLATE, "START"); + + for (p_name = *names; p_name != NULL; p_name = p_name->next) { + g_free (p_name->data); + p_name->data = NULL; + } + + g_list_free (*names); + *names = NULL; + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*****************************************************************************/ +/* Get a list of valid template names for given page size */ +/*****************************************************************************/ +GList * +gl_template_get_name_list (const gchar * page_size) +{ + GList *p_tmplt, *p_name; + glTemplate *template; + gchar *str; + GList *names = NULL; + + gl_debug (DEBUG_TEMPLATE, "START"); + + for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { + template = (glTemplate *) p_tmplt->data; + if (g_strcasecmp (page_size, template->page_size) == 0) { + for (p_name = template->name; p_name != NULL; + p_name = p_name->next) { + str = g_strdup_printf("%s: %s", + (gchar *) p_name->data, + template->description); + names = g_list_insert_sorted (names, str, + (GCompareFunc)g_strcasecmp); + } + } + } + + gl_debug (DEBUG_TEMPLATE, "templates = %p", templates); + gl_debug (DEBUG_TEMPLATE, "names = %p", names); + + gl_debug (DEBUG_TEMPLATE, "END"); + return names; +} + +/*****************************************************************************/ +/* Free a list of template names. */ +/*****************************************************************************/ +void +gl_template_free_name_list (GList ** names) +{ + GList *p_name; + + gl_debug (DEBUG_TEMPLATE, "START"); + + for (p_name = *names; p_name != NULL; p_name = p_name->next) { + g_free (p_name->data); + p_name->data = NULL; + } + + g_list_free (*names); + *names = NULL; + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*****************************************************************************/ +/* Return a template structure from a name. */ +/*****************************************************************************/ +glTemplate * +gl_template_from_name (const gchar * name) +{ + GList *p_tmplt, *p_name; + glTemplate *template; + gchar **split_name; + + gl_debug (DEBUG_TEMPLATE, "START"); + + if (name == NULL) { + /* If no name, return first template as a default */ + return (glTemplate *) templates->data; + } + + split_name = g_strsplit (name, ":", 2); + + for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { + template = (glTemplate *) p_tmplt->data; + for (p_name = template->name; p_name != NULL; + p_name = p_name->next) { + if (g_strcasecmp (p_name->data, split_name[0]) == 0) { + g_strfreev (split_name); + gl_debug (DEBUG_TEMPLATE, "END"); + return gl_template_dup (template); + } + } + } + + g_strfreev (split_name); + + gl_debug (DEBUG_TEMPLATE, "END"); + return NULL; +} + +/*****************************************************************************/ +/* Copy a template. */ +/*****************************************************************************/ +glTemplate *gl_template_dup (const glTemplate *orig_template) +{ + glTemplate *template; + GList *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + template = g_new0 (glTemplate,1); + + /* Shallow copy first */ + *template = *orig_template; + + /* Now the deep stuff */ + template->name = NULL; + for ( p=orig_template->name; p != NULL; p=p->next ) { + template->name = g_list_append (template->name, + g_strdup (p->data)); + } + template->description = g_strdup (orig_template->description); + template->page_size = g_strdup (orig_template->page_size); + + gl_debug (DEBUG_TEMPLATE, "END"); + return template; +} + +/*****************************************************************************/ +/* Free up a template. */ +/*****************************************************************************/ +void gl_template_free (glTemplate **template) +{ + GList *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + if ( *template != NULL ) { + + for ( p=(*template)->name; p != NULL; p=p->next ) { + g_free (p->data); + p->data = NULL; + } + g_list_free ((*template)->name); + (*template)->name = NULL; + + g_free ((*template)->description); + (*template)->description = NULL; + + g_free ((*template)->page_size); + (*template)->page_size = NULL; + + g_free (*template); + *template = NULL; + + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Make a template for a full page of the given page size. */ +/*--------------------------------------------------------------------------*/ +static glTemplate * +template_full_page (const gchar *page_size) +{ + const GnomePrintPaper *paper; + glTemplate *template; + + paper = gnome_print_paper_get_by_name (page_size); + if ( paper == NULL ) { + return NULL; + } + + template = g_new0 (glTemplate, 1); + + template->name = g_list_append (template->name, + g_strdup_printf("*%s", page_size)); + template->page_size = g_strdup(page_size); + template->description = g_strdup(FULL_PAGE); + + template->style = GL_TEMPLATE_STYLE_RECT; + + template->nx = 1; + template->ny = 1; + + template->label_width = paper->width; + template->label_height = paper->height; + template->label_round = 0.0; + + template->label_margin = 5.0; + + return template; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read templates from various files. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_templates (void) +{ + gchar *home_data_dir = get_home_data_dir (); + GList *templates = NULL; + + gl_debug (DEBUG_TEMPLATE, "START"); + + LIBXML_TEST_VERSION; + + templates = read_template_files_from_dir (templates, GL_DATA_DIR); + templates = read_template_files_from_dir (templates, home_data_dir); + + g_free (home_data_dir); + + if (templates == NULL) { + g_warning (_("No template files found!")); + } + + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. get '~/.glabels' directory path. */ +/*--------------------------------------------------------------------------*/ +static gchar * +get_home_data_dir (void) +{ + gchar *dir = gnome_util_prepend_user_home (".glabels"); + + gl_debug (DEBUG_TEMPLATE, "START"); + + /* Try to create ~/.glabels directory. If it exists, no problem. */ + mkdir (dir, 0775); + + gl_debug (DEBUG_TEMPLATE, "END"); + return dir; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read all template files from given directory. Append to list. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_template_files_from_dir (GList * templates, + const gchar * dirname) +{ + GDir *dp; + const gchar *filename, *extension; + gchar *full_filename = NULL; + GError *gerror = NULL; + + gl_debug (DEBUG_TEMPLATE, "START"); + + if (dirname == NULL) + return templates; + + dp = g_dir_open (dirname, 0, &gerror); + if (gerror != NULL) { + g_warning ("cannot open data directory: %s", gerror->message ); + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; + } + + while ((filename = g_dir_read_name (dp)) != NULL) { + + extension = strrchr (filename, '.'); + + if (extension != NULL) { + + if (strcasecmp (extension, ".template") == 0) { + + full_filename = + g_build_filename (dirname, filename, NULL); + templates = + read_templates_from_file (templates, + full_filename); + g_free (full_filename); + + } + + } + + } + + g_dir_close (dp); + + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read templates from template file. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_templates_from_file (GList * templates, + gchar * xml_filename) +{ + xmlDocPtr doc; + xmlNodePtr root, node; + glTemplate *template; + + gl_debug (DEBUG_TEMPLATE, "START"); + + doc = xmlParseFile (xml_filename); + if (!doc) { + g_warning ("\"%s\" is not a glabels template file (not XML)", + xml_filename); + return templates; + } + + root = xmlDocGetRootElement (doc); + if (!root || !root->name) { + g_warning ("\"%s\" is not a glabels template file (no root node)", + xml_filename); + xmlFreeDoc (doc); + return templates; + } + if (g_strcasecmp (root->name, "glabels-templates") != 0) { + g_warning ("\"%s\" is not a glabels template file (wrong root node)", + xml_filename); + xmlFreeDoc (doc); + return templates; + } + + for (node = root->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Sheet") == 0) { + template = gl_template_xml_parse_sheet (node); + templates = g_list_append (templates, template); + } else { + if ( !xmlNodeIsText(node) ) { + if (g_strcasecmp (node->name,"comment") != 0) { + g_warning ("bad node = \"%s\"",node->name); + } + } + } + } + + xmlFreeDoc (doc); + + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; +} + +/*****************************************************************************/ +/* Parse XML template Node. */ +/*****************************************************************************/ +glTemplate * +gl_template_xml_parse_sheet (xmlNodePtr sheet_node) +{ + glTemplate *template; + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + template = g_new0 (glTemplate, 1); + + template->name = g_list_append (template->name, + xmlGetProp (sheet_node, "name")); + template->page_size = xmlGetProp (sheet_node, "size"); + if ( strcmp (template->page_size,"US-Letter") == 0 ) { + /* Compatibility with old pre-1.0 template files.*/ + template->page_size = "US Letter"; + } + template->description = xmlGetProp (sheet_node, "description"); + + for (node = sheet_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "Label") == 0) { + xml_parse_label (node, template); + } else if (g_strcasecmp (node->name, "Alias") == 0) { + xml_parse_alias (node, template); + } else { + if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); + + return template; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_label (xmlNodePtr label_node, + glTemplate * template) +{ + xmlNodePtr node; + gchar *style; + + gl_debug (DEBUG_TEMPLATE, "START"); + + style = xmlGetProp (label_node, "style"); + if (g_strcasecmp (style, "rectangle") == 0) { + template->style = GL_TEMPLATE_STYLE_RECT; + } else if (g_strcasecmp (style, "round") == 0) { + template->style = GL_TEMPLATE_STYLE_ROUND; + } else if (g_strcasecmp (style, "cd") == 0) { + template->style = GL_TEMPLATE_STYLE_CD; + } else { + g_warning ("Unknown label style in template"); + } + + if (template->style == GL_TEMPLATE_STYLE_RECT) { + template->label_width = + g_strtod (xmlGetProp (label_node, "width"), NULL); + template->label_height = + g_strtod (xmlGetProp (label_node, "height"), NULL); + template->label_round = + g_strtod (xmlGetProp (label_node, "round"), NULL); + } else if (template->style == GL_TEMPLATE_STYLE_ROUND) { + template->label_radius = + g_strtod (xmlGetProp (label_node, "radius"), NULL); + template->label_width = 2.0 * template->label_radius; + template->label_height = 2.0 * template->label_radius; + } else if (template->style == GL_TEMPLATE_STYLE_CD) { + template->label_radius = + g_strtod (xmlGetProp (label_node, "radius"), NULL); + template->label_hole = + g_strtod (xmlGetProp (label_node, "hole"), NULL); + template->label_width = 2.0 * template->label_radius; + template->label_height = 2.0 * template->label_radius; + } + + for (node = label_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "Layout") == 0) { + xml_parse_layout (node, template); + } else if (g_strcasecmp (node->name, "Markup") == 0) { + xml_parse_markup (node, template); + } else if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label->Layout Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_layout (xmlNodePtr layout_node, + glTemplate * template) +{ + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + sscanf (xmlGetProp (layout_node, "nx"), "%d", &(template->nx)); + sscanf (xmlGetProp (layout_node, "ny"), "%d", &(template->ny)); + template->x0 = g_strtod (xmlGetProp (layout_node, "x0"), NULL); + template->y0 = g_strtod (xmlGetProp (layout_node, "y0"), NULL); + template->dx = g_strtod (xmlGetProp (layout_node, "dx"), NULL); + template->dy = g_strtod (xmlGetProp (layout_node, "dy"), NULL); + + for (node = layout_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label->Markup Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_markup (xmlNodePtr markup_node, + glTemplate * template) +{ + gchar *type; + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + type = xmlGetProp (markup_node, "type"); + if (g_strcasecmp (type, "margin") == 0) { + template->label_margin = + g_strtod (xmlGetProp (markup_node, "size"), NULL); + } + + for (node = markup_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Alias Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_alias (xmlNodePtr alias_node, + glTemplate * template) +{ + gl_debug (DEBUG_TEMPLATE, "START"); + + template->name = g_list_append (template->name, + xmlGetProp (alias_node, "name")); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/****************************************************************************/ +/* Add XML Template Node */ +/****************************************************************************/ +void +gl_template_xml_add_sheet (glTemplate * template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + GList *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild (root, ns, "Sheet", NULL); + + xmlSetProp (node, "name", template->name->data); + xmlSetProp (node, "size", template->page_size); + xmlSetProp (node, "description", template->description); + + xml_add_label (template, node, ns); + + for ( p=template->name->next; p != NULL; p=p->next ) { + xml_add_alias( p->data, node, ns ); + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_label (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild(root, ns, "Label", NULL); + + xmlSetProp (node, "id", "0"); + + switch (template->style) { + case GL_TEMPLATE_STYLE_RECT: + xmlSetProp (node, "style", "rectangle"); + string = g_strdup_printf ("%g", template->label_width); + xmlSetProp (node, "width", string); + g_free (string); + string = g_strdup_printf ("%g", template->label_height); + xmlSetProp (node, "height", string); + g_free (string); + string = g_strdup_printf ("%g", template->label_round); + xmlSetProp (node, "round", string); + g_free (string); + break; + case GL_TEMPLATE_STYLE_ROUND: + xmlSetProp (node, "style", "round"); + string = g_strdup_printf ("%g", template->label_radius); + xmlSetProp (node, "radius", string); + g_free (string); + break; + case GL_TEMPLATE_STYLE_CD: + xmlSetProp (node, "style", "cd"); + string = g_strdup_printf ("%g", template->label_radius); + xmlSetProp (node, "radius", string); + g_free (string); + string = g_strdup_printf ("%g", template->label_hole); + xmlSetProp (node, "hole", string); + g_free (string); + break; + default: + g_warning ("Unknown label style"); + break; + } + + xml_add_markup_margin (template, node, ns); + xml_add_layout (template, node, ns); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label->Layout Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_layout (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild(root, ns, "Layout", NULL); + string = g_strdup_printf ("%d", template->nx); + xmlSetProp (node, "nx", string); + g_free (string); + string = g_strdup_printf ("%d", template->ny); + xmlSetProp (node, "ny", string); + g_free (string); + string = g_strdup_printf ("%g", template->x0); + xmlSetProp (node, "x0", string); + g_free (string); + string = g_strdup_printf ("%g", template->y0); + xmlSetProp (node, "y0", string); + g_free (string); + string = g_strdup_printf ("%g", template->dx); + xmlSetProp (node, "dx", string); + g_free (string); + string = g_strdup_printf ("%g", template->dy); + xmlSetProp (node, "dy", string); + g_free (string); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label->Markup Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_markup_margin (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild(root, ns, "Markup", NULL); + xmlSetProp (node, "type", "margin"); + + string = g_strdup_printf ("%g", template->label_margin); + xmlSetProp (node, "size", string); + g_free (string); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Alias Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_alias (gchar *name, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild (root, ns, "Alias", NULL); + xmlSetProp (node, "name", name); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + diff --git a/glabels2/src/template.h b/glabels2/src/template.h new file mode 100644 index 00000000..4ec025f9 --- /dev/null +++ b/glabels2/src/template.h @@ -0,0 +1,74 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * template.h: template module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __TEMPLATE_H__ +#define __TEMPLATE_H__ + +#include +#include +#include + +typedef enum { + GL_TEMPLATE_STYLE_RECT, + GL_TEMPLATE_STYLE_ROUND, + GL_TEMPLATE_STYLE_CD, +} glTemplateStyle; + +typedef struct { + GList *name; + gchar *description; + gchar *page_size; + glTemplateStyle style; + + /* Suggested margin */ + gdouble label_margin; + + /* Simple and rounded rectangles. */ + gdouble label_width, label_height, label_round; + + /* CD/DVD labels */ + gdouble label_radius, label_hole; + + /* Layout */ + gint nx, ny; + gdouble x0, y0, dx, dy; +} glTemplate; + +extern void gl_template_init (void); + +extern GList *gl_template_get_page_size_list (void); +extern void gl_template_free_page_size_list (GList **sizes); + +extern GList *gl_template_get_name_list (const gchar *page_size); +extern void gl_template_free_name_list (GList **names); + +extern glTemplate *gl_template_from_name (const gchar * name); + +extern glTemplate *gl_template_dup (const glTemplate *orig); +extern void gl_template_free (glTemplate **template); + +extern glTemplate *gl_template_xml_parse_sheet (xmlNodePtr sheet_node); + +extern void gl_template_xml_add_sheet (glTemplate * template, + xmlNodePtr root, + xmlNsPtr ns); +#endif diff --git a/glabels2/src/text-node.c b/glabels2/src/text-node.c new file mode 100644 index 00000000..7c5ba20f --- /dev/null +++ b/glabels2/src/text-node.c @@ -0,0 +1,268 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * text_node.c: text node module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "text-node.h" + +#include "merge.h" + +#include "debug.h" + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static glTextNode *extract_text_node (gchar * text, gint * n); + + +/*--------------------------------------------------------------------------*/ +/* Expand single node into representative string. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_text_node_expand (glTextNode * text_node, + glMergeRecord * record) +{ + gchar *text; + + if (text_node->field_flag) { + text = gl_merge_eval_key (text_node->data, record); + if (text != NULL) { + return text; + } else { + return g_strdup_printf ("FIELD{%s}", text_node->data); + } + } else { + return g_strdup (text_node->data); + } +} + +/*--------------------------------------------------------------------------*/ +/* Create a single text node from given text. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_text_node_new_from_text (gchar * text) +{ + gint n; + + return extract_text_node (text, &n); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create a single text node from given text. n = characters used */ +/*--------------------------------------------------------------------------*/ +static glTextNode * +extract_text_node (gchar * text, + gint * n) +{ + glTextNode *text_node; + gchar *p; + gint m; + + text_node = g_new0 (glTextNode, 1); + + if (strncmp (text, "FIELD{", strlen ("FIELD{")) == 0) { + /* We are at the beginning of a "FIELD" node */ + text_node->field_flag = TRUE; + *n = strlen ("FIELD{"); + text += *n; + for (p = text, m = 0; *p != 0; p++, m++, (*n)++) { + if (*p == '}') { + (*n)++; + break; + } + } + text_node->data = g_strndup (text, m); + } else { + /* We are at the beginning of a literal node */ + text_node->field_flag = FALSE; + for (p = text, *n = 0; *p != 0; p++, (*n)++) { + if (strncmp (p, "FIELD{", strlen ("FIELD{")) == 0) + break; + if (*p == '\n') + break; + } + text_node->data = g_strndup (text, *n); + } + + return text_node; +} + +/*--------------------------------------------------------------------------*/ +/* Copy a single text node. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_text_node_dup (glTextNode *src) +{ + glTextNode *dst; + + dst = g_new0 (glTextNode, 1); + + dst->field_flag = src->field_flag; + dst->data = g_strdup (src->data); + + return dst; +} + +/*--------------------------------------------------------------------------*/ +/* Free a single text node. */ +/*--------------------------------------------------------------------------*/ +void +gl_text_node_free (glTextNode ** text_node) +{ + if ( *text_node == NULL ) return; + + g_free ((*text_node)->data); + (*text_node)->data = NULL; + g_free (*text_node); + *text_node = NULL; +} + +/*--------------------------------------------------------------------------*/ +/* Expand text lines into single string. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_text_node_lines_expand (GList * lines, + glMergeRecord * record) +{ + GList *p_line, *p_node; + glTextNode *text_node; + gchar *text, *old_text, *expanded_node; + + text = g_strdup (""); /* prime pointer for concatenation */ + for (p_line = lines; p_line != NULL; p_line = p_line->next) { + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + text_node = (glTextNode *) p_node->data; + old_text = text; + expanded_node = gl_text_node_expand (text_node, record); + text = g_strconcat (text, expanded_node, NULL); + g_free (old_text); + g_free (expanded_node); + } + if ( p_line->next != NULL ) { + old_text = text; + text = g_strconcat (text, "\n", NULL); + g_free (old_text); + } + } + + return text; +} + +/*--------------------------------------------------------------------------*/ +/* Parse a string back into text lines. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_text_node_lines_new_from_text (gchar * text) +{ + GList *lines, *nodes; + glTextNode *text_node; + gchar *p; + gint n; + + lines = NULL; + nodes = NULL; + for (p = text; *p != 0; p += n) { + if (*p != '\n') { + text_node = extract_text_node (p, &n); + nodes = g_list_append (nodes, text_node); + } else { + n = 1; + lines = g_list_append (lines, nodes); + nodes = NULL; + } + } + if (*(p - 1) != '\n') { + lines = g_list_append (lines, nodes); + } + + return lines; +} + +/*--------------------------------------------------------------------------*/ +/* Copy a list of text lines. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_text_node_lines_dup (GList * src_lines) +{ + GList *dst_lines=NULL; + GList *p_line, *line, *p_node; + glTextNode *node; + + for (p_line = src_lines; p_line != NULL; p_line = p_line->next) { + line = NULL; + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + node = gl_text_node_dup ((glTextNode *)p_node->data); + line = g_list_append (line, node); + } + dst_lines = g_list_append (dst_lines, line); + } + + return dst_lines; +} + +/*--------------------------------------------------------------------------*/ +/* Free a list of text lines. */ +/*--------------------------------------------------------------------------*/ +void +gl_text_node_lines_free (GList ** lines) +{ + GList *p_line, *p_node; + + for (p_line = *lines; p_line != NULL; p_line = p_line->next) { + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + gl_text_node_free ( (glTextNode **) &(p_node->data) ); + } + g_list_free ((GList *) p_line->data); + p_line->data = NULL; + } + + g_list_free (*lines); + *lines = NULL; +} + +/****************************************************************************/ +/* For debugging: descend and print lines list. */ +/****************************************************************************/ +void +gl_text_node_lines_print (GList * lines ) +{ + GList *p_line, *p_node; + glTextNode *text_node; + gint i_line, i_node; + + for (p_line=lines, i_line=0; p_line != NULL; p_line=p_line->next, i_line++) { + for (p_node = (GList *) p_line->data, i_node=0; p_node != NULL; + p_node = p_node->next, i_node++) { + text_node = (glTextNode *) p_node->data; + g_print( "LINE[%d], NODE[%d] = { %d, \"%s\" }\n", + i_line, i_node, + text_node->field_flag, text_node->data ); + + } + } + +} + diff --git a/glabels2/src/text-node.h b/glabels2/src/text-node.h new file mode 100644 index 00000000..2cd8509d --- /dev/null +++ b/glabels2/src/text-node.h @@ -0,0 +1,48 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * text_node.h: text node module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TEXT_NODE_H__ +#define __TEXT_NODE_H__ + +#include +#include "merge.h" + +typedef struct { + gboolean field_flag; + gchar *data; +} glTextNode; + +extern gchar *gl_text_node_expand (glTextNode * text_node, + glMergeRecord * record); +extern glTextNode *gl_text_node_new_from_text (gchar * text); +extern glTextNode *gl_text_node_dup (glTextNode * text_node); +extern void gl_text_node_free (glTextNode ** text_node); + +extern gchar *gl_text_node_lines_expand (GList * lines, + glMergeRecord * record); +extern GList *gl_text_node_lines_new_from_text (gchar * text); +extern GList *gl_text_node_lines_dup (GList *lines); +extern void gl_text_node_lines_free (GList ** lines); + +/* debug function */ +extern void gl_text_node_lines_print (GList * lines ); + +#endif diff --git a/glabels2/src/tools.c b/glabels2/src/tools.c new file mode 100644 index 00000000..d93aafe4 --- /dev/null +++ b/glabels2/src/tools.c @@ -0,0 +1,230 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * tools.c: toolbar module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "tools.h" +#include "glabels.h" +#include "merge-properties.h" + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals. */ +/*===========================================*/ + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ + + + +/*****************************************************************************/ +/* arrow callback. */ +/*****************************************************************************/ +void +gl_tools_arrow (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_arrow_mode (view); + } +} + +/*****************************************************************************/ +/* text callback. */ +/*****************************************************************************/ +void +gl_tools_text (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_TEXT); + } +} + +/*****************************************************************************/ +/* box callback. */ +/*****************************************************************************/ +void +gl_tools_box (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_BOX); + } +} + +/*****************************************************************************/ +/* line callback. */ +/*****************************************************************************/ +void +gl_tools_line (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_LINE); + } +} + +/*****************************************************************************/ +/* ellipse callback. */ +/*****************************************************************************/ +void +gl_tools_ellipse (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, + GL_LABEL_OBJECT_ELLIPSE); + } +} + +/*****************************************************************************/ +/* image callback. */ +/*****************************************************************************/ +void +gl_tools_image (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_IMAGE); + } +} + +/*****************************************************************************/ +/* barcode callback. */ +/*****************************************************************************/ +void +gl_tools_barcode (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, + GL_LABEL_OBJECT_BARCODE); + } +} + +/*****************************************************************************/ +/* zoom in callback. */ +/*****************************************************************************/ +void +gl_tools_zoomin (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_zoom_in (view); + } +} + +/*****************************************************************************/ +/* zoom out callback. */ +/*****************************************************************************/ +void +gl_tools_zoomout (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_zoom_out (view); + } +} + +/*****************************************************************************/ +/* zoom 1:1 callback. */ +/*****************************************************************************/ +void +gl_tools_zoom1to1 (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_set_zoom (view, 1.0); + } +} + +/*****************************************************************************/ +/* edit merge properties callback. */ +/*****************************************************************************/ +void +gl_tools_merge_properties (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_merge_properties_dialog (view); + } +} + diff --git a/glabels2/src/tools.h b/glabels2/src/tools.h new file mode 100644 index 00000000..955c513e --- /dev/null +++ b/glabels2/src/tools.h @@ -0,0 +1,71 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * tools.h: toolbar module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TOOLS_H__ +#define __TOOLS_H__ + +#include + +extern void gl_tools_arrow (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_text (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_box (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_line (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_ellipse (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_image (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_barcode (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_zoomin (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_zoomout (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_zoom1to1 (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_merge_properties (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +#endif diff --git a/glabels2/src/util.c b/glabels2/src/util.c new file mode 100644 index 00000000..d762a7cb --- /dev/null +++ b/glabels2/src/util.c @@ -0,0 +1,252 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * util.c: various small utility functions + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include +#include +#include + +#include "util.h" + +#define FRAC_DELTA 0.00005 + + +/****************************************************************************/ +/* Append ".glabels" extension to filename if needed. */ +/****************************************************************************/ +gchar * +gl_util_add_extension (const gchar * orig_filename) +{ + gchar *new_filename, *extension; + + extension = strrchr (orig_filename, '.'); + if (extension == NULL) { + new_filename = g_strconcat (orig_filename, ".glabels", NULL); + } else { + if (g_strcasecmp (extension, ".glabels") != 0) { + new_filename = + g_strconcat (orig_filename, ".glabels", NULL); + } else { + new_filename = g_strdup (orig_filename); + } + } + + return new_filename; +} + +/****************************************************************************/ +/* Make sure we have an absolute path to filename. */ +/****************************************************************************/ +gchar * +gl_util_make_absolute (const gchar * filename) +{ + gchar *pwd, *absolute_filename; + + if (g_path_is_absolute (filename)) { + absolute_filename = g_strdup (filename); + } else { + pwd = g_get_current_dir (); + absolute_filename = + g_strjoin (G_DIR_SEPARATOR_S, pwd, filename, NULL); + g_free (pwd); + } + + return absolute_filename; +} + +/****************************************************************************/ +/* Create fractional representation of number, if possible. */ +/****************************************************************************/ +gchar * +gl_util_fraction( gdouble x ) +{ + static gdouble denom[] = { 1., 2., 3., 4., 8., 16., 32., 0. }; + gint i; + gdouble product, remainder; + gint n, d; + + for ( i=0; denom[i] != 0.0; i++ ) { + product = x * denom[i]; + remainder = fabs(product - ((gint)(product+0.5))); + if ( remainder < FRAC_DELTA ) break; + } + + if ( denom[i] == 0.0 ) { + /* None of our denominators work. */ + return g_strdup_printf ("%.5g", x); + } + if ( denom[i] == 1.0 ) { + /* Simple integer. */ + return g_strdup_printf ("%d", (gint)x); + } + n = (gint)( x * denom[i] + 0.5 ); + d = (gint)denom[i]; + if ( n > d ) { + return g_strdup_printf ("%d_%d/%d", (n/d), (n%d), d); + } else { + return g_strdup_printf ("%d/%d", (n%d), d); + } +} + +/****************************************************************************/ +/* Create button w/ both text and stock image. */ +/****************************************************************************/ +GtkWidget* +gl_button_new_with_stock_image (const gchar* text, const gchar* stock_id) +{ + GtkWidget *button; + GtkStockItem item; + GtkWidget *label; + GtkWidget *image; + GtkWidget *hbox; + GtkWidget *align; + + button = gtk_button_new (); + + if (GTK_BIN (button)->child) + gtk_container_remove (GTK_CONTAINER (button), + GTK_BIN (button)->child); + + if (gtk_stock_lookup (stock_id, &item)) + { + label = gtk_label_new_with_mnemonic (text); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button)); + + image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON); + hbox = gtk_hbox_new (FALSE, 2); + + align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + gtk_container_add (GTK_CONTAINER (button), align); + gtk_container_add (GTK_CONTAINER (align), hbox); + gtk_widget_show_all (align); + + return button; + } + + label = gtk_label_new_with_mnemonic (text); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button)); + + gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); + + gtk_widget_show (label); + gtk_container_add (GTK_CONTAINER (button), label); + + return button; +} + +/****************************************************************************/ +/* Add button to gtk_dialog w/ text and stock image. */ +/****************************************************************************/ +GtkWidget* +gl_util_dialog_add_button (GtkDialog *dialog, + const gchar* text, + const gchar* stock_id, + gint response_id) +{ + GtkWidget *button; + + g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL); + g_return_val_if_fail (text != NULL, NULL); + g_return_val_if_fail (stock_id != NULL, NULL); + + button = gl_button_new_with_stock_image (text, stock_id); + g_return_val_if_fail (button != NULL, NULL); + + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + + gtk_widget_show (button); + + gtk_dialog_add_action_widget (dialog, button, response_id); + + return button; +} + +/****************************************************************************/ +/* Utilities to deal with GTK_JUSTIFICATION types. */ +/****************************************************************************/ +const gchar * +gl_util_just_to_string (GtkJustification just) +{ + switch (just) { + case GTK_JUSTIFY_LEFT: + return "Left"; + case GTK_JUSTIFY_CENTER: + return "Center"; + case GTK_JUSTIFY_RIGHT: + return "Right"; + default: + return "?"; + } +} + +GtkJustification +gl_util_string_to_just (const gchar * string) +{ + + if (g_strcasecmp (string, "Left") == 0) { + return GTK_JUSTIFY_LEFT; + } else if (g_strcasecmp (string, "Center") == 0) { + return GTK_JUSTIFY_CENTER; + } else if (g_strcasecmp (string, "Right") == 0) { + return GTK_JUSTIFY_RIGHT; + } else { + return GTK_JUSTIFY_LEFT; + } + +} + +/****************************************************************************/ +/* Utilities to deal with GNOME_FONT_WEIGHT types */ +/****************************************************************************/ +const gchar * +gl_util_weight_to_string (GnomeFontWeight weight) +{ + switch (weight) { + case GNOME_FONT_BOOK: + return "Regular"; + case GNOME_FONT_BOLD: + return "Bold"; + default: + return "?"; + } +} + +GnomeFontWeight +gl_util_string_to_weight (const gchar * string) +{ + + if (g_strcasecmp (string, "Regular") == 0) { + return GNOME_FONT_BOOK; + } else if (g_strcasecmp (string, "Bold") == 0) { + return GNOME_FONT_BOLD; + } else { + return GNOME_FONT_BOOK; + } + +} diff --git a/glabels2/src/util.h b/glabels2/src/util.h new file mode 100644 index 00000000..33f5867a --- /dev/null +++ b/glabels2/src/util.h @@ -0,0 +1,49 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * util.h: various small utility functions + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __UTIL_H__ +#define __UTIL_H__ + +#include +#include + +extern gchar *gl_util_add_extension (const gchar * orig_filename); + +extern gchar *gl_util_make_absolute (const gchar * filename); + +extern gchar *gl_util_fraction( gdouble x ); + +extern GtkWidget* gl_util_button_new_with_stock_image (const gchar* text, + const gchar* stock_id); + +extern GtkWidget* gl_util_dialog_add_button (GtkDialog *dialog, + const gchar* text, + const gchar* stock_id, + gint response_id); + +extern const gchar *gl_util_just_to_string (GtkJustification just); +extern GtkJustification gl_util_string_to_just (const gchar * string); + +extern const gchar *gl_util_weight_to_string (GnomeFontWeight weight); +extern GnomeFontWeight gl_util_string_to_weight (const gchar * string); + +#endif /* __UTIL_H__ */ diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c new file mode 100644 index 00000000..49bae837 --- /dev/null +++ b/glabels2/src/view-barcode.c @@ -0,0 +1,835 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_barcode.c: GLabels label barcode object widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "view-barcode.h" +#include "canvas-hacktext.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-bc-data.h" +#include "wdgt-bc-props.h" +#include "wdgt-bc-style.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_barcode.xbm" +#include "pixmaps/cursor_barcode_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewBarcodePrivate { + + GList *item_list; + + /* Page 0 widgets */ + GtkWidget *bc_data; + + /* Page 1 widgets */ + GtkWidget *bc_props; + GtkWidget *bc_style; + + /* Page 2 widgets */ + GtkWidget *position; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_barcode_class_init (glViewBarcodeClass *klass); +static void gl_view_barcode_instance_init (glViewBarcode *view_barcode); +static void gl_view_barcode_finalize (GObject *object); + +static void update_view_barcode_cb (glLabelObject *object, + glViewBarcode *view_barcode); + +static GtkWidget *construct_properties_dialog (glViewBarcode *view_barcode); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewBarcode *view_barcode); + +static void bc_data_changed_cb (glWdgtBCData *bc_data, + glViewBarcode *view_barcode); + +static void bc_props_changed_cb (glWdgtBCProps *bc_props, + glViewBarcode *view_barcode); + +static void bc_style_changed_cb (glWdgtBCStyle *bc_style, + glViewBarcode *view_barcode); + +static void position_changed_cb (glWdgtPosition *position, + glViewBarcode *view_barcode); + +static void update_dialog_cb (glLabelObject *object, + glViewBarcode *view_barcode); + +static void draw_barcode (glViewBarcode *view_barcode); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_barcode_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewBarcodeClass), + NULL, + NULL, + (GClassInitFunc) gl_view_barcode_class_init, + NULL, + NULL, + sizeof (glViewBarcode), + 0, + (GInstanceInitFunc) gl_view_barcode_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewBarcode", &info, 0); + } + + return type; +} + +static void +gl_view_barcode_class_init (glViewBarcodeClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_barcode_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_barcode_instance_init (glViewBarcode *view_barcode) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_barcode->private = g_new0 (glViewBarcodePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_barcode_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_BARCODE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW barcode object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_barcode_new (glLabelBarcode *object, + glView *view) +{ + glViewBarcode *view_barcode; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_BARCODE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_barcode = g_object_new (gl_view_barcode_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_barcode), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_barcode), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_SIMPLE); + + /* Create analogous canvas items. */ + draw_barcode (view_barcode); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_barcode_cb), view_barcode); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_barcode); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_barcode), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_barcode); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_barcode_cb (glLabelObject *object, + glViewBarcode *view_barcode) +{ + glView *view; + GnomeCanvasItem *group; + + gl_debug (DEBUG_VIEW, "START"); + + view = gl_view_object_get_view (GL_VIEW_OBJECT(view_barcode)); + + /* Adjust appearance of analogous canvas items. */ + draw_barcode (view_barcode); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_barcode)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a barcode object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewBarcode *view_barcode) +{ + GtkWidget *dialog, *notebook, *wvbox, *wbutton; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble x, y, w, h, label_width, label_height; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + glMerge *merge; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + gl_debug (DEBUG_VIEW, "Creating dialog..."); + dialog = gtk_dialog_new_with_buttons ( _("Edit barcode object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_barcode); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Data Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating data tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Data"))); + + /* barcode data */ + gl_debug (DEBUG_VIEW, "Creating data entry..."); + view_barcode->private->bc_data = + gl_wdgt_bc_data_new (_("Barcode data"), merge->field_defs); + gl_debug (DEBUG_VIEW, "1"); + gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data), + (merge->type != GL_MERGE_NONE), + text_node); + gl_debug (DEBUG_VIEW, "2"); + gtk_box_pack_start (GTK_BOX (wvbox), view_barcode->private->bc_data, + FALSE, FALSE, 0); + gl_debug (DEBUG_VIEW, "3"); + g_signal_connect ( G_OBJECT(view_barcode->private->bc_data), + "changed", G_CALLBACK (bc_data_changed_cb), + view_barcode); + + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating props tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* barcode props entry */ + gl_debug (DEBUG_VIEW, "Creating props entry..."); + view_barcode->private->bc_props = + gl_wdgt_bc_props_new (_("Barcode Properties")); + gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props), + scale, color); + gtk_box_pack_start (GTK_BOX (wvbox), view_barcode->private->bc_props, + FALSE, FALSE, 0); + g_signal_connect ( G_OBJECT(view_barcode->private->bc_props), + "changed", G_CALLBACK (bc_props_changed_cb), + view_barcode); + + /* ------ Barcode Style Frame ------ */ + view_barcode->private->bc_style = gl_wdgt_bc_style_new (_("Style")); + gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE (view_barcode->private->bc_style), + style, text_flag); + gtk_box_pack_start (GTK_BOX (wvbox), view_barcode->private->bc_style, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_barcode->private->bc_style), + "changed", G_CALLBACK (bc_style_changed_cb), + view_barcode); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + gl_debug (DEBUG_VIEW, "Creating position tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position"))); + + /* ------ Position Frame ------ */ + gl_debug (DEBUG_VIEW, "Creating position entry..."); + view_barcode->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_barcode->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_barcode->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_barcode->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_barcode); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_barcode); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewBarcode *view_barcode) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. barcode data "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +bc_data_changed_cb (glWdgtBCData *bc_data, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + glTextNode *text_node; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + text_node = gl_wdgt_bc_data_get_data (bc_data); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. barcode props "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +bc_props_changed_cb (glWdgtBCProps *text_props, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_wdgt_bc_props_get_params (text_props, &scale, &color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + style, text_flag, color, scale); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. barcode style "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +bc_style_changed_cb (glWdgtBCStyle *bc_style, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_wdgt_bc_style_get_params (bc_style, &style, &text_flag); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + style, text_flag, color, scale); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewBarcode *view_barcode) +{ + gdouble x, y; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + glMerge *merge; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_data), + bc_data_changed_cb, view_barcode); + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_props), + bc_props_changed_cb, view_barcode); + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_style), + bc_style_changed_cb, view_barcode); + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->position), + position_changed_cb, view_barcode); + + /* Update widgets in property dialog */ + + gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data), + (merge->type != GL_MERGE_NONE), + text_node); + gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props), + scale, color); + gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE(view_barcode->private->bc_style), + style, text_flag); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_barcode->private->position), + x, y); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_data), + bc_data_changed_cb, view_barcode); + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_props), + bc_props_changed_cb, view_barcode); + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_style), + bc_style_changed_cb, view_barcode); + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->position), + position_changed_cb, view_barcode); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_barcode_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_barcode_bits, + cursor_barcode_width, + cursor_barcode_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_barcode_mask_bits, + cursor_barcode_mask_width, + cursor_barcode_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_barcode_x_hot, + cursor_barcode_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating barcode objects. */ +/*****************************************************************************/ +int +gl_view_barcode_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_barcode; + static GObject *object; + gdouble x, y; + glTextNode *text_node; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_barcode_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + text_node = gl_text_node_new_from_text ("123456789"); + gl_label_barcode_set_data (GL_LABEL_BARCODE(object), + text_node); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + GL_BARCODE_STYLE_POSTNET, + FALSE, + GNOME_CANVAS_COLOR_A (0,0,0,255), + 1.0); + view_barcode = gl_view_barcode_new (GL_LABEL_BARCODE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_barcode)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw barcode to item (group). */ +/*--------------------------------------------------------------------------*/ +static void +draw_barcode (glViewBarcode *view_barcode) +{ + glLabelObject *object; + GnomeCanvasItem *group, *item; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + glBarcodeLine *line; + glBarcodeChar *bchar; + glBarcode *gbc; + GList *li; + GList *item_list = NULL; + GnomeCanvasPoints *points; + gchar *digits, *cstring; + GnomeFont *font; + GnomeGlyphList *glyphlist; + gdouble y_offset; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query label object and properties */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); + if (text_node->field_flag) { + digits = gl_barcode_default_digits (style); + } else { + digits = gl_text_node_expand (text_node, NULL); + } + + /* get parent item/group to render to. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_barcode)); + + /* remove previous items from group. */ + for (li = view_barcode->private->item_list; li!=NULL; li = li->next) { + gl_debug (DEBUG_VIEW, "in loop"); + gtk_object_destroy (GTK_OBJECT (li->data)); + } + gl_debug (DEBUG_VIEW, "1"); + g_list_free (view_barcode->private->item_list); + view_barcode->private->item_list = NULL; + gl_debug (DEBUG_VIEW, "2"); + + /* get Gnome Font */ + font = gnome_font_find_closest_from_weight_slant (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, + 10.0); + + gbc = gl_barcode_new (style, text_flag, scale, digits); + if (gbc == NULL) { + + cstring = _("Invalid barcode"); + glyphlist = gnome_glyphlist_from_text_sized_dumb (font, + color, + 0.0, 0.0, + cstring, + strlen + (cstring)); + y_offset = 10.0 - gnome_font_get_descender (font); + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gl_canvas_hacktext_get_type (), + "x", 0.0, + "y", y_offset, + "glyphlist", glyphlist, NULL); + + view_barcode->private->item_list = + g_list_prepend (view_barcode->private->item_list, item); + } else { + + points = gnome_canvas_points_new (2); + for (li = gbc->lines; li != NULL; li = li->next) { + line = (glBarcodeLine *) li->data; + + points->coords[0] = line->x; + points->coords[1] = line->y; + points->coords[2] = line->x; + points->coords[3] = line->y + line->length; + + item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_line_get_type + (), "points", points, + "width_units", line->width, + "fill_color_rgba", color, + NULL); + view_barcode->private->item_list = + g_list_prepend (view_barcode->private->item_list, item); + } + gnome_canvas_points_free (points); + + for (li = gbc->chars; li != NULL; li = li->next) { + bchar = (glBarcodeChar *) li->data; + + font = gnome_font_find_closest_from_weight_slant ( + GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, bchar->fsize); + glyphlist = gnome_glyphlist_from_text_sized_dumb (font, + color, + 0.0, + 0.0, + & + (bchar-> + c), + 1); + y_offset = + bchar->fsize - gnome_font_get_descender (font); + item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_hacktext_get_type + (), "x", bchar->x, "y", + bchar->y + y_offset, + "glyphlist", glyphlist, + NULL); + + view_barcode->private->item_list = + g_list_prepend (view_barcode->private->item_list, item); + + } + + } + + /* clean up */ + gl_barcode_free (&gbc); + g_free (digits); + + gl_debug (DEBUG_VIEW, "END"); +} + diff --git a/glabels2/src/view-barcode.h b/glabels2/src/view-barcode.h new file mode 100644 index 00000000..7bb9112d --- /dev/null +++ b/glabels2/src/view-barcode.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_barcode.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_BARCODE_H__ +#define __VIEW_BARCODE_H__ + +#include "view-object.h" +#include "label-barcode.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_BARCODE (gl_view_barcode_get_type ()) +#define GL_VIEW_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_BARCODE, glViewBarcode)) +#define GL_VIEW_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_BARCODE, glViewBarcodeClass)) +#define GL_IS_VIEW_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_BARCODE)) +#define GL_IS_VIEW_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_BARCODE)) + +typedef struct _glViewBarcode glViewBarcode; +typedef struct _glViewBarcodeClass glViewBarcodeClass; + +typedef struct _glViewBarcodePrivate glViewBarcodePrivate; + +struct _glViewBarcode { + glViewObject parent_object; + + glViewBarcodePrivate *private; +}; + +struct _glViewBarcodeClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_barcode_get_type (void); + +extern glViewObject *gl_view_barcode_new (glLabelBarcode *object, + glView *view); + + +/* cursor for creating barcode objects */ +extern GdkCursor *gl_view_barcode_get_create_cursor (void); + +/* event handler for creating barcode objects */ +extern gint gl_view_barcode_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_BARCODE_H__ */ diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c new file mode 100644 index 00000000..545fd8db --- /dev/null +++ b/glabels2/src/view-box.c @@ -0,0 +1,707 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_box.c: GLabels label box object widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "view-box.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-size.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_box.xbm" +#include "pixmaps/cursor_box_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define CREATE_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 192) +#define CREATE_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 192) + +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) +#define DEFAULT_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 255) + +#define DELTA 0.01 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewBoxPrivate { + GnomeCanvasItem *item; + + /* Property dialog Page 0 widgets */ + GtkWidget *line; + GtkWidget *fill; + + /* Property dialog Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_box_class_init (glViewBoxClass *klass); +static void gl_view_box_instance_init (glViewBox *view_box); +static void gl_view_box_finalize (GObject *object); + +static void update_view_box_cb (glLabelObject *object, + glViewBox *view_box); + +static GtkWidget *construct_properties_dialog (glViewBox *view_box); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewBox *view_box); + +static void line_changed_cb (glWdgtLine *line, + glViewBox *view_box); + +static void fill_changed_cb (glWdgtFill *fill, + glViewBox *view_box); + +static void position_changed_cb (glWdgtPosition *position, + glViewBox *view_box); + +static void size_changed_cb (glWdgtSize *size, + glViewBox *view_box); + +static void update_dialog_cb (glLabelObject *object, + glViewBox *view_box); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_box_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewBoxClass), + NULL, + NULL, + (GClassInitFunc) gl_view_box_class_init, + NULL, + NULL, + sizeof (glViewBox), + 0, + (GInstanceInitFunc) gl_view_box_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewBox", &info, 0); + } + + return type; +} + +static void +gl_view_box_class_init (glViewBoxClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_box_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_box_instance_init (glViewBox *view_box) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_box->private = g_new0 (glViewBoxPrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_box_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_BOX (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW box object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_box_new (glLabelBox *object, + glView *view) +{ + glViewBox *view_box; + GnomeCanvasItem *group; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_BOX (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_box = g_object_new (gl_view_box_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_box), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_box), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_BOX_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(object); + line_color = gl_label_box_get_line_color(object); + fill_color = gl_label_box_get_fill_color(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_box)); + view_box->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_box_cb), view_box); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_box); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_box), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_box); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_box_cb (glLabelObject *object, + glViewBox *view_box) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + + /* Adjust appearance of analogous canvas item. */ + gnome_canvas_item_set (view_box->private->item, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_box)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a box object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewBox *view_box) +{ + GtkWidget *dialog, *notebook, *wvbox; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit box object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_box); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line box ------ */ + view_box->private->line = gl_wdgt_line_new (_("Outline")); + gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line), + line_width, + line_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->line, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->line), "changed", + G_CALLBACK(line_changed_cb), view_box); + + /* ------ Fill box ------ */ + view_box->private->fill = gl_wdgt_fill_new (_("Fill")); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill), + fill_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->fill, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->fill), "changed", + G_CALLBACK(fill_changed_cb), view_box); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_box->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_box->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->position), "changed", + G_CALLBACK(position_changed_cb), view_box); + + + /* ------ Size Frame ------ */ + view_box->private->size = gl_wdgt_size_new (_("Size")); + gl_wdgt_size_set_params (GL_WDGT_SIZE (view_box->private->size), + w, h, + TRUE, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->size, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->size), "changed", + G_CALLBACK(size_changed_cb), view_box); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_box); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewBox *view_box) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. line properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +line_changed_cb (glWdgtLine *line, + glViewBox *view_box) +{ + glLabelObject *object; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + gl_wdgt_line_get_params (GL_WDGT_LINE (line), + &line_width, + &line_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_box_set_line_width(GL_LABEL_BOX(object), line_width); + gl_label_box_set_line_color(GL_LABEL_BOX(object), line_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. fill properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +fill_changed_cb (glWdgtFill *fill, + glViewBox *view_box) +{ + glLabelObject *object; + guint fill_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + gl_wdgt_fill_get_params (GL_WDGT_FILL (fill), + &fill_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_box_set_fill_color(GL_LABEL_BOX(object), fill_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewBox *view_box) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_changed_cb (glWdgtSize *size, + glViewBox *view_box) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_size_get_size (GL_WDGT_SIZE (size), + &w, &h, &keep_aspect_ratio_flag); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewBox *view_box) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->line), + line_changed_cb, view_box); + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->fill), + fill_changed_cb, view_box); + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->position), + position_changed_cb, view_box); + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->size), + size_changed_cb, view_box); + + /* Update widgets in property dialog */ + gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line), + line_width, + line_color); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill), + fill_color); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_box->private->position), + x, y); + gl_wdgt_size_set_size (GL_WDGT_SIZE(view_box->private->size), w, h); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->line), + line_changed_cb, view_box); + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->fill), + fill_changed_cb, view_box); + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->position), + position_changed_cb, view_box); + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->size), + size_changed_cb, view_box); + + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_box_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_box_bits, + cursor_box_width, + cursor_box_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_box_mask_bits, + cursor_box_mask_width, + cursor_box_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_box_x_hot, + cursor_box_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating box objects. */ +/*****************************************************************************/ +int +gl_view_box_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_box; + static GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_debug (DEBUG_VIEW, "BUTTON_PRESS (%f, %f) -> (%f, %f)", event->button.x, event->button.y, x, y); + object = gl_label_box_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + line_width = 1.0; + line_color = CREATE_LINE_COLOR; + fill_color = CREATE_FILL_COLOR; + gl_label_box_set_line_width (GL_LABEL_BOX(object), + line_width); + gl_label_box_set_line_color (GL_LABEL_BOX(object), + line_color); + gl_label_box_set_fill_color (GL_LABEL_BOX(object), + fill_color); + view_box = gl_view_box_new (GL_LABEL_BOX(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE (%f, %f) -> (%f, %f)", event->button.x, event->button.y, x, y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + line_color = DEFAULT_LINE_COLOR; + fill_color = DEFAULT_FILL_COLOR; + gl_label_box_set_line_color (GL_LABEL_BOX(object), + line_color); + gl_label_box_set_fill_color (GL_LABEL_BOX(object), + fill_color); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_box)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + gl_debug (DEBUG_VIEW, "BUTTON_MOTION (%f, %f) -> (%f, %f)", event->button.x, event->button.y, x, y); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-box.h b/glabels2/src/view-box.h new file mode 100644 index 00000000..12cb9047 --- /dev/null +++ b/glabels2/src/view-box.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_box.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_BOX_H__ +#define __VIEW_BOX_H__ + +#include "view-object.h" +#include "label-box.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_BOX (gl_view_box_get_type ()) +#define GL_VIEW_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_BOX, glViewBox)) +#define GL_VIEW_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_BOX, glViewBoxClass)) +#define GL_IS_VIEW_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_BOX)) +#define GL_IS_VIEW_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_BOX)) + +typedef struct _glViewBox glViewBox; +typedef struct _glViewBoxClass glViewBoxClass; + +typedef struct _glViewBoxPrivate glViewBoxPrivate; + +struct _glViewBox { + glViewObject parent_object; + + glViewBoxPrivate *private; +}; + +struct _glViewBoxClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_box_get_type (void); + +extern glViewObject *gl_view_box_new (glLabelBox *object, + glView *view); + + +/* cursor for creating box objects */ +extern GdkCursor *gl_view_box_get_create_cursor (void); + +/* event handler for creating box objects */ +extern gint gl_view_box_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_BOX_H__ */ diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c new file mode 100644 index 00000000..b21c646f --- /dev/null +++ b/glabels2/src/view-ellipse.c @@ -0,0 +1,706 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_ellipse.c: GLabels label ellipse object widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "view-ellipse.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-size.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_ellipse.xbm" +#include "pixmaps/cursor_ellipse_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define CREATE_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 192) +#define CREATE_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 192) + +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) +#define DEFAULT_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 255) + +#define DELTA 0.01 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewEllipsePrivate { + GnomeCanvasItem *item; + + /* Property dialog Page 0 widgets */ + GtkWidget *line; + GtkWidget *fill; + + /* Property dialog Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_ellipse_class_init (glViewEllipseClass *klass); +static void gl_view_ellipse_instance_init (glViewEllipse *view_ellipse); +static void gl_view_ellipse_finalize (GObject *object); + +static void update_view_ellipse_cb (glLabelObject *object, + glViewEllipse *view_ellipse); + +static GtkWidget *construct_properties_dialog (glViewEllipse *view_ellipse); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewEllipse *view_ellipse); + +static void line_changed_cb (glWdgtLine *line, + glViewEllipse *view_ellipse); + +static void fill_changed_cb (glWdgtFill *fill, + glViewEllipse *view_ellipse); + +static void position_changed_cb (glWdgtPosition *position, + glViewEllipse *view_ellipse); + +static void size_changed_cb (glWdgtSize *size, + glViewEllipse *view_ellipse); + +static void update_dialog_cb (glLabelObject *object, + glViewEllipse *view_ellipse); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_ellipse_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewEllipseClass), + NULL, + NULL, + (GClassInitFunc) gl_view_ellipse_class_init, + NULL, + NULL, + sizeof (glViewEllipse), + 0, + (GInstanceInitFunc) gl_view_ellipse_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewEllipse", &info, 0); + } + + return type; +} + +static void +gl_view_ellipse_class_init (glViewEllipseClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_ellipse_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_ellipse_instance_init (glViewEllipse *view_ellipse) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_ellipse->private = g_new0 (glViewEllipsePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_ellipse_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_ELLIPSE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW ellipse object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_ellipse_new (glLabelEllipse *object, + glView *view) +{ + glViewEllipse *view_ellipse; + GnomeCanvasItem *group; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_ELLIPSE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_ellipse = g_object_new (gl_view_ellipse_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_ellipse), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_ellipse), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(object); + line_color = gl_label_ellipse_get_line_color(object); + fill_color = gl_label_ellipse_get_fill_color(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_ellipse)); + view_ellipse->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_ellipse_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_ellipse_cb), view_ellipse); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_ellipse); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_ellipse), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_ellipse); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_ellipse_cb (glLabelObject *object, + glViewEllipse *view_ellipse) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + + /* Adjust appearance of analogous canvas item. */ + gnome_canvas_item_set (view_ellipse->private->item, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_ellipse)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a ellipse object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewEllipse *view_ellipse) +{ + GtkWidget *dialog, *notebook, *wvbox; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit ellipse object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_ellipse); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line ellipse ------ */ + view_ellipse->private->line = gl_wdgt_line_new (_("Outline")); + gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line), + line_width, + line_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->line, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->line), "changed", + G_CALLBACK(line_changed_cb), view_ellipse); + + /* ------ Fill ellipse ------ */ + view_ellipse->private->fill = gl_wdgt_fill_new (_("Fill")); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill), + fill_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->fill, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->fill), "changed", + G_CALLBACK(fill_changed_cb), view_ellipse); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_ellipse->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_ellipse->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_ellipse->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_ellipse); + + + /* ------ Size Frame ------ */ + view_ellipse->private->size = gl_wdgt_size_new (_("Size")); + gl_wdgt_size_set_params (GL_WDGT_SIZE (view_ellipse->private->size), + w, h, + TRUE, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->size, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->size), "changed", + G_CALLBACK(size_changed_cb), view_ellipse); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewEllipse *view_ellipse) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. line properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +line_changed_cb (glWdgtLine *line, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + gl_wdgt_line_get_params (GL_WDGT_LINE (line), + &line_width, + &line_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_ellipse_set_line_width(GL_LABEL_ELLIPSE(object), line_width); + gl_label_ellipse_set_line_color(GL_LABEL_ELLIPSE(object), line_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. fill properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +fill_changed_cb (glWdgtFill *fill, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + guint fill_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + gl_wdgt_fill_get_params (GL_WDGT_FILL (fill), + &fill_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_ellipse_set_fill_color(GL_LABEL_ELLIPSE(object), fill_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_changed_cb (glWdgtSize *size, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_size_get_size (GL_WDGT_SIZE (size), + &w, &h, &keep_aspect_ratio_flag); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewEllipse *view_ellipse) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->line), + line_changed_cb, view_ellipse); + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->fill), + fill_changed_cb, view_ellipse); + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->position), + position_changed_cb, view_ellipse); + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->size), + size_changed_cb, view_ellipse); + + /* Update widgets in property dialog */ + gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line), + line_width, + line_color); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill), + fill_color); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_ellipse->private->position), + x, y); + gl_wdgt_size_set_size (GL_WDGT_SIZE(view_ellipse->private->size), w, h); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->line), + line_changed_cb, view_ellipse); + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->fill), + fill_changed_cb, view_ellipse); + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->position), + position_changed_cb, view_ellipse); + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->size), + size_changed_cb, view_ellipse); + + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_ellipse_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_ellipse_bits, + cursor_ellipse_width, + cursor_ellipse_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_ellipse_mask_bits, + cursor_ellipse_mask_width, + cursor_ellipse_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_ellipse_x_hot, + cursor_ellipse_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating ellipse objects. */ +/*****************************************************************************/ +int +gl_view_ellipse_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_ellipse; + static GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_ellipse_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + line_width = 1.0; + line_color = CREATE_LINE_COLOR; + fill_color = CREATE_FILL_COLOR; + gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), + line_width); + gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), + line_color); + gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), + fill_color); + view_ellipse = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + line_color = DEFAULT_LINE_COLOR; + fill_color = DEFAULT_FILL_COLOR; + gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), + line_color); + gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), + fill_color); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_ellipse)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-ellipse.h b/glabels2/src/view-ellipse.h new file mode 100644 index 00000000..ad0ce23f --- /dev/null +++ b/glabels2/src/view-ellipse.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_ellipse.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_ELLIPSE_H__ +#define __VIEW_ELLIPSE_H__ + +#include "view-object.h" +#include "label-ellipse.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_ELLIPSE (gl_view_ellipse_get_type ()) +#define GL_VIEW_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_ELLIPSE, glViewEllipse)) +#define GL_VIEW_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_ELLIPSE, glViewEllipseClass)) +#define GL_IS_VIEW_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_ELLIPSE)) +#define GL_IS_VIEW_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_ELLIPSE)) + +typedef struct _glViewEllipse glViewEllipse; +typedef struct _glViewEllipseClass glViewEllipseClass; + +typedef struct _glViewEllipsePrivate glViewEllipsePrivate; + +struct _glViewEllipse { + glViewObject parent_object; + + glViewEllipsePrivate *private; +}; + +struct _glViewEllipseClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_ellipse_get_type (void); + +extern glViewObject *gl_view_ellipse_new (glLabelEllipse *object, + glView *view); + + +/* cursor for creating ellipse objects */ +extern GdkCursor *gl_view_ellipse_get_create_cursor (void); + +/* event handler for creating ellipse objects */ +extern gint gl_view_ellipse_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_ELLIPSE_H__ */ diff --git a/glabels2/src/view-highlight.c b/glabels2/src/view-highlight.c new file mode 100644 index 00000000..5c148b72 --- /dev/null +++ b/glabels2/src/view-highlight.c @@ -0,0 +1,1637 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_highlight.c: GLabels Resizable Highlight module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "view-highlight.h" + +#include "debug.h" + +#define MIN_ITEM_SIZE 1.0 +#define FG_COLOR GNOME_CANVAS_COLOR_A (0, 0, 255, 255) +#define BG_COLOR GNOME_CANVAS_COLOR_A (255, 255, 255, 255) + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static GnomeCanvasItem *highlight_resizable_box (glViewObject *view_object, + glViewHighlightStyle style); +static GnomeCanvasItem *highlight_resizable_line (glViewObject *view_object); +static GnomeCanvasItem *highlight_simple (glViewObject *view_object); + +static void update_resizable_box (GnomeCanvasItem *highlight, + glViewHighlightStyle style); +static void update_resizable_line (GnomeCanvasItem *highlight); +static void update_simple (GnomeCanvasItem *highlight); + +static int tl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int tr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int bl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int br_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +static int sl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int sr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int st_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int sb_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +static int p1_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int p2_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +static int passthrough_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +/*****************************************************************************/ +/* Create a resizable highlight for given object. */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_view_highlight_new (glViewObject *view_object, + glViewHighlightStyle style) +{ + GnomeCanvasItem *highlight; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT(view_object)); + + switch (style) { + + case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: + case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: + highlight = highlight_resizable_box (view_object, style); + break; + + case GL_VIEW_HIGHLIGHT_LINE_RESIZABLE: + highlight = highlight_resizable_line (view_object); + break; + + case GL_VIEW_HIGHLIGHT_SIMPLE: + highlight = highlight_simple (view_object); + break; + + default: + g_warning ("Invalid resizable highlight style"); + + } + + g_object_set_data (G_OBJECT(highlight), "style", + GINT_TO_POINTER(style)); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*****************************************************************************/ +/* Update a resizable highlight for given item. */ +/*****************************************************************************/ +void +gl_view_highlight_update (GnomeCanvasItem * highlight) +{ + glViewHighlightStyle style; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + style = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(highlight), + "style")); + + switch (style) { + + case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: + case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: + update_resizable_box (highlight, style); + break; + + case GL_VIEW_HIGHLIGHT_LINE_RESIZABLE: + update_resizable_line (highlight); + break; + + case GL_VIEW_HIGHLIGHT_SIMPLE: + update_simple (highlight); + break; + + default: + g_warning ("Invalid resizable highlight style"); + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create a resizable box highlight. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +highlight_resizable_box (glViewObject *view_object, + glViewHighlightStyle style) +{ + GnomeCanvasItem *highlight; + glLabelObject *object; + glView *view; + gdouble x, y, w, h; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *tl, *tr, *bl, *br; /* Handles at four corners */ + GnomeCanvasItem *sl, *sr, *st, *sb; /* Handles at each side */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + view = gl_view_object_get_view (view_object); + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (view->canvas)), + gnome_canvas_group_get_type (), + "x", x, "y", y, NULL); + + gnome_canvas_item_hide (highlight); + + switch (style) { + case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: + outline = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + "width_pixels", 2, + "outline_color_rgba", FG_COLOR, + NULL); + break; + case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: + outline = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_ellipse_get_type (), + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + "width_pixels", 2, + "outline_color_rgba", FG_COLOR, + NULL); + break; + default: + outline = NULL; + g_warning ("Invalid resizable highlight style"); + } + + tl = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + tr = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w - 1.0, + "y1", -1.0, + "x2", w + 1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + bl = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", h - 1.0, + "x2", +1.0, + "y2", h + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + br = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w - 1.0, + "y1", h - 1.0, + "x2", w + 1.0, + "y2", h + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + sl = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", h / 2.0 - 1.0, + "x2", +1.0, + "y2", h / 2.0 + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + sr = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w - 1.0, + "y1", h / 2.0 - 1.0, + "x2", w + 1.0, + "y2", h / 2.0 + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + st = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w / 2.0 - 1.0, + "y1", -1.0, + "x2", w / 2.0 + 1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + sb = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w / 2.0 - 1.0, + "y1", h - 1.0, + "x2", w / 2.0 + 1.0, + "y2", h + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + g_object_set_data (G_OBJECT (highlight), "object", object); + + g_object_set_data (G_OBJECT (highlight), "outline", outline); + + g_object_set_data (G_OBJECT (highlight), "tl", tl); + g_object_set_data (G_OBJECT (highlight), "tr", tr); + g_object_set_data (G_OBJECT (highlight), "bl", bl); + g_object_set_data (G_OBJECT (highlight), "br", br); + g_object_set_data (G_OBJECT (highlight), "sl", sl); + g_object_set_data (G_OBJECT (highlight), "sr", sr); + g_object_set_data (G_OBJECT (highlight), "st", st); + g_object_set_data (G_OBJECT (highlight), "sb", sb); + + g_signal_connect (G_OBJECT (tl), "event", + G_CALLBACK (tl_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (tr), "event", + G_CALLBACK (tr_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (bl), "event", + G_CALLBACK (bl_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (br), "event", + G_CALLBACK (br_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (sl), "event", + G_CALLBACK (sl_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (sr), "event", + G_CALLBACK (sr_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (st), "event", + G_CALLBACK (st_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (sb), "event", + G_CALLBACK (sb_resize_event_handler), view_object); + + g_signal_connect (G_OBJECT (outline), "event", + G_CALLBACK (passthrough_event_handler), view_object); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create a resizable line highlight. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +highlight_resizable_line (glViewObject *view_object) +{ + GnomeCanvasItem *highlight; + glLabelObject *object; + glView *view; + gdouble x, y, dx, dy; + GnomeCanvasPoints *points; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *p1, *p2; /* Handles at endpoints */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &dx, &dy); + + view = gl_view_object_get_view (view_object); + + points = gnome_canvas_points_new (2); + + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (view->canvas)), + gnome_canvas_group_get_type (), + "x", x, "y", y, NULL); + + gnome_canvas_item_hide (highlight); + + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = dx; + points->coords[3] = dy; + outline = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_line_get_type (), + "points", points, + "width_pixels", 3, + "fill_color_rgba", FG_COLOR, + NULL); + + p1 = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + p2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", dx - 1.0, + "y1", dy - 1.0, + "x2", dx + 1.0, + "y2", dy + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + g_object_set_data (G_OBJECT (highlight), "object", object); + + g_object_set_data (G_OBJECT (highlight), "outline", outline); + + g_object_set_data (G_OBJECT (highlight), "p1", p1); + g_object_set_data (G_OBJECT (highlight), "p2", p2); + + g_signal_connect (G_OBJECT (p1), "event", + G_CALLBACK (p1_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (p2), "event", + G_CALLBACK (p2_resize_event_handler), view_object); + + g_signal_connect (G_OBJECT (outline), "event", + G_CALLBACK (passthrough_event_handler), view_object); + + gnome_canvas_points_free (points); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create a simple box highlight. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +highlight_simple (glViewObject *view_object) +{ + GnomeCanvasItem *highlight, *outline; + glLabelObject *object; + glView *view; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + view = gl_view_object_get_view (view_object); + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (view->canvas)), + gnome_canvas_group_get_type (), + "x", x, "y", y, NULL); + + gnome_canvas_item_hide (highlight); + + outline = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(highlight), + gnome_canvas_rect_get_type (), + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + "width_pixels", 2, + "outline_color_rgba", FG_COLOR, + NULL); + + + g_object_set_data (G_OBJECT (highlight), "outline", outline); + + g_object_set_data (G_OBJECT (highlight), "object", object); + + g_signal_connect (G_OBJECT (highlight), "event", + G_CALLBACK (passthrough_event_handler), view_object); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a resizable box highlight. */ +/*---------------------------------------------------------------------------*/ +static void +update_resizable_box (GnomeCanvasItem *highlight, + glViewHighlightStyle style) +{ + glLabelObject *object; + gdouble w, h; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *tl, *tr, *bl, *br; /* Handles at four corners */ + GnomeCanvasItem *sl, *sr, *st, *sb; /* Handles at each side */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + object = g_object_get_data (G_OBJECT (highlight), "object"); + gl_label_object_get_size (object, &w, &h); + + outline = g_object_get_data (G_OBJECT (highlight), "outline"); + + tl = g_object_get_data (G_OBJECT (highlight), "tl"); + tr = g_object_get_data (G_OBJECT (highlight), "tr"); + bl = g_object_get_data (G_OBJECT (highlight), "bl"); + br = g_object_get_data (G_OBJECT (highlight), "br"); + sl = g_object_get_data (G_OBJECT (highlight), "sl"); + sr = g_object_get_data (G_OBJECT (highlight), "sr"); + st = g_object_get_data (G_OBJECT (highlight), "st"); + sb = g_object_get_data (G_OBJECT (highlight), "sb"); + + gnome_canvas_item_set (outline, + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + NULL); + + gnome_canvas_item_set (tl, + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (tr, + "x1", w - 1.0, + "y1", -1.0, + "x2", w + 1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (bl, + "x1", -1.0, + "y1", h - 1.0, + "x2", +1.0, + "y2", h + 1.0, + NULL); + + gnome_canvas_item_set (br, + "x1", w - 1.0, + "y1", h - 1.0, + "x2", w + 1.0, + "y2", h + 1.0, + NULL); + + gnome_canvas_item_set (sl, + "x1", -1.0, + "y1", h / 2.0 - 1.0, + "x2", +1.0, + "y2", h / 2.0 + 1.0, + NULL); + + gnome_canvas_item_set (sr, + "x1", w - 1.0, + "y1", h / 2.0 - 1.0, + "x2", w + 1.0, + "y2", h / 2.0 + 1.0, + NULL); + + gnome_canvas_item_set (st, + "x1", w / 2.0 - 1.0, + "y1", -1.0, + "x2", w / 2.0 + 1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (sb, + "x1", w / 2.0 - 1.0, + "y1", h - 1.0, + "x2", w / 2.0 + 1.0, + "y2", h + 1.0, + NULL); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a resizable line highlight. */ +/*---------------------------------------------------------------------------*/ +static void +update_resizable_line (GnomeCanvasItem *highlight) +{ + glLabelObject *object; + gdouble dx, dy; + GnomeCanvasPoints *points; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *p1, *p2; /* Handles at endpoints */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + object = g_object_get_data (G_OBJECT (highlight), "object"); + gl_label_object_get_size (object, &dx, &dy); + + points = gnome_canvas_points_new (2); + + outline = g_object_get_data (G_OBJECT (highlight), "outline"); + + p1 = g_object_get_data (G_OBJECT (highlight), "p1"); + p2 = g_object_get_data (G_OBJECT (highlight), "p2"); + + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = dx; + points->coords[3] = dy; + gnome_canvas_item_set (outline, "points", points, NULL); + + gnome_canvas_item_set (p1, + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (p2, + "x1", dx - 1.0, + "y1", dy - 1.0, + "x2", dx + 1.0, + "y2", dy + 1.0, + NULL); + + gnome_canvas_points_free (points); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a simple box highlight. */ +/*---------------------------------------------------------------------------*/ +static void +update_simple (GnomeCanvasItem *highlight) +{ + glLabelObject *object; + gdouble w, h; + GnomeCanvasItem *outline; /* Outline around item */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + object = g_object_get_data (G_OBJECT (highlight), "object"); + gl_label_object_get_size (object, &w, &h); + + outline = g_object_get_data (G_OBJECT (highlight), "outline"); + + gnome_canvas_item_set (outline, + "x2", w + 0.5, + "y2", h + 0.5, + NULL); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-left" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +tl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x2, y2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to bottom-right corner */ + x2 = x + w; + y2 = y + h; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-right" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +tr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x1, y2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to bottom-left corner */ + x1 = x; + y2 = y + h; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x1; + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x1; + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-left" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +bl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x2, y1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to top-right corner */ + x2 = x + w; + y1 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = y1; + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = y1; + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-right" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +br_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x1, y1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + gl_debug (DEBUG_VIEW, ""); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to top-left corner */ + x1 = x; + y1 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x1; + y = y1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x1; + y = y1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Left-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to right side */ + x2 = x + w; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Right-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to left side */ + x1 = x; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +st_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble y2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to bottom-right corner */ + y2 = y + h; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sb_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble y1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to top side */ + y1 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + y = y1; + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + y = y1; + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Resize "P1" event handler. */ +/*---------------------------------------------------------------------------*/ +static int +p1_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, dx, dy; + static gdouble x0, y0; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &dx, &dy); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to P2 */ + x0 = x + dx; + y0 = y + dy; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Resize "P2" event handler. */ +/*---------------------------------------------------------------------------*/ +static int +p2_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, dx, dy; + static gdouble x0, y0; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &dx, &dy); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to P1 */ + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Passthrough event handler. */ +/*---------------------------------------------------------------------------*/ +static int +passthrough_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + GnomeCanvasItem *group; + + gl_debug (DEBUG_VIEW, ""); + + group = gl_view_object_get_group (view_object); + return gl_view_item_event_handler (group, event, view_object); + +} diff --git a/glabels2/src/view-highlight.h b/glabels2/src/view-highlight.h new file mode 100644 index 00000000..269b6eee --- /dev/null +++ b/glabels2/src/view-highlight.h @@ -0,0 +1,41 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_highlight.h: GLabels Resizable Highlight module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __VIEW_HIGHLIGHT_H__ +#define __VIEW_HIGHLIGHT_H__ + +#include + +typedef enum { + GL_VIEW_HIGHLIGHT_BOX_RESIZABLE, + GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE, + GL_VIEW_HIGHLIGHT_LINE_RESIZABLE, + GL_VIEW_HIGHLIGHT_SIMPLE, +} glViewHighlightStyle; + +#include "view-object.h" + +extern GnomeCanvasItem *gl_view_highlight_new (glViewObject *view_object, + glViewHighlightStyle style); + +extern void gl_view_highlight_update (GnomeCanvasItem * highlight); + +#endif diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c new file mode 100644 index 00000000..a00db395 --- /dev/null +++ b/glabels2/src/view-image.c @@ -0,0 +1,685 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_image.c: GLabels label image object widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "view-image.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-size.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_image.xbm" +#include "pixmaps/cursor_image_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define DELTA 0.01 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewImagePrivate { + GnomeCanvasItem *item; + + /* Page 0 widgets */ + GtkWidget *pixmap_entry; + + /* Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + +/* Save state of image file entry */ +static gchar *image_path = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_image_class_init (glViewImageClass *klass); +static void gl_view_image_instance_init (glViewImage *view_image); +static void gl_view_image_finalize (GObject *object); + +static void update_view_image_cb (glLabelObject *object, + glViewImage *view_image); + +static GtkWidget *construct_properties_dialog (glViewImage *view_image); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewImage *view_image); + +static void file_changed_cb (GtkEntry *pixmap_entry, + glViewImage *view_image); + +static void position_changed_cb (glWdgtPosition *position, + glViewImage *view_image); + +static void size_changed_cb (glWdgtSize *size, + glViewImage *view_image); + +static void size_reset_cb (GtkButton *button, + glViewImage *view_image); + +static void update_dialog_cb (glLabelObject *object, + glViewImage *view_image); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_image_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewImageClass), + NULL, + NULL, + (GClassInitFunc) gl_view_image_class_init, + NULL, + NULL, + sizeof (glViewImage), + 0, + (GInstanceInitFunc) gl_view_image_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewImage", &info, 0); + } + + return type; +} + +static void +gl_view_image_class_init (glViewImageClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_image_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_image_instance_init (glViewImage *view_image) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_image->private = g_new0 (glViewImagePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_image_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_IMAGE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW image object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_image_new (glLabelImage *object, + glView *view) +{ + glViewImage *view_image; + GnomeCanvasItem *group; + const GdkPixbuf *pixbuf; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_IMAGE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_image = g_object_new (gl_view_image_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_image), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_image), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_BOX_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + pixbuf = gl_label_image_get_pixbuf(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_image)); + view_image->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_pixbuf_get_type (), + "x", 0.0, + "y", 0.0, + "width_set", TRUE, + "height_set", TRUE, + "width", w, + "height", h, + "pixbuf", pixbuf, + NULL); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_image_cb), view_image); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_image); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_image), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_image); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_image_cb (glLabelObject *object, + glViewImage *view_image) +{ + const GdkPixbuf *pixbuf; + gdouble w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object)); + + /* Adjust appearance of analogous canvas item. */ + gnome_canvas_item_set (view_image->private->item, + "width_set", TRUE, + "height_set", TRUE, + "width", w, + "height", h, + "pixbuf", pixbuf, + NULL); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_image)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a image object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewImage *view_image) +{ + GtkWidget *dialog, *notebook, *wvbox, *wbutton; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble x, y, w, h, label_width, label_height; + gchar *filename; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit image object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_image); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Image Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Image"))); + + /* image entry */ + view_image->private->pixmap_entry = + gnome_pixmap_entry_new ("image", "Load image", TRUE); + gnome_pixmap_entry_set_preview_size (GNOME_PIXMAP_ENTRY + (view_image->private->pixmap_entry), + 128, 128); + + /* Set default path for image entry */ + if (filename != NULL) { + /* Set default path to the directory containing image. */ + if (image_path != NULL) + g_free (image_path); + image_path = g_path_get_dirname (filename); + if (image_path != NULL) { + image_path = g_strconcat (image_path, "/", NULL); + } + } else if (image_path == NULL) { + /* First time, set it to our CWD. */ + image_path = g_get_current_dir (); + } + + gtk_box_pack_start (GTK_BOX (wvbox), view_image->private->pixmap_entry, + FALSE, FALSE, 0); + g_signal_connect ( G_OBJECT(gnome_file_entry_gtk_entry + (GNOME_FILE_ENTRY (view_image->private->pixmap_entry))), + "changed", G_CALLBACK (file_changed_cb), + view_image); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_image->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_image->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_image->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_image->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_image); + + + /* ------ Size Frame ------ */ + view_image->private->size = gl_wdgt_size_new (_("Size")); + gl_wdgt_size_set_params (GL_WDGT_SIZE (view_image->private->size), + w, h, + TRUE, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_image->private->size, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_image->private->size), "changed", + G_CALLBACK(size_changed_cb), view_image); + + /* ------ Size Reset Button ------ */ + wbutton = gtk_button_new_with_label (_("Reset image size")); + gtk_box_pack_start (GTK_BOX (wvbox), wbutton, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (wbutton), "clicked", + G_CALLBACK (size_reset_cb), view_image); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_image); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewImage *view_image) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. file "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +file_changed_cb (GtkEntry *pixmap_entry, + glViewImage *view_image) +{ + glLabelObject *object; + gchar *filename; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + filename = gnome_pixmap_entry_get_filename (GNOME_PIXMAP_ENTRY(view_image->private->pixmap_entry)); + gl_debug (DEBUG_VIEW, "filename = %s", filename); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + gl_label_image_set_filename(GL_LABEL_IMAGE(object), filename); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + + g_free (filename); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewImage *view_image) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_changed_cb (glWdgtSize *size, + glViewImage *view_image) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_size_get_size (GL_WDGT_SIZE (size), + &w, &h, &keep_aspect_ratio_flag); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_reset_cb (GtkButton *button, + glViewImage *view_image) +{ + glLabelObject *object; + gdouble image_w, image_h; + const GdkPixbuf *pixbuf; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object)); + + image_w = gdk_pixbuf_get_width (pixbuf); + image_h = gdk_pixbuf_get_height (pixbuf); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), image_w, image_h); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewImage *view_image) +{ + gchar *filename; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_image->private->pixmap_entry), + file_changed_cb, view_image); + g_signal_handlers_block_by_func (G_OBJECT(view_image->private->position), + position_changed_cb, view_image); + g_signal_handlers_block_by_func (G_OBJECT(view_image->private->size), + size_changed_cb, view_image); + + /* Update widgets in property dialog */ + + if ( filename != NULL ) { + gnome_file_entry_set_filename (GNOME_FILE_ENTRY (view_image->private->pixmap_entry), + filename); + } + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_image->private->position), + x, y); + gl_wdgt_size_set_size (GL_WDGT_SIZE(view_image->private->size), w, h); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->pixmap_entry), + file_changed_cb, view_image); + g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->position), + position_changed_cb, view_image); + g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->size), + size_changed_cb, view_image); + + g_free (filename); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_image_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_image_bits, + cursor_image_width, + cursor_image_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_image_mask_bits, + cursor_image_mask_width, + cursor_image_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_image_x_hot, + cursor_image_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating image objects. */ +/*****************************************************************************/ +int +gl_view_image_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_image; + static GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_image_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + view_image = gl_view_image_new (GL_LABEL_IMAGE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_image)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-image.h b/glabels2/src/view-image.h new file mode 100644 index 00000000..e36154ad --- /dev/null +++ b/glabels2/src/view-image.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_image.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_IMAGE_H__ +#define __VIEW_IMAGE_H__ + +#include "view-object.h" +#include "label-image.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_IMAGE (gl_view_image_get_type ()) +#define GL_VIEW_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_IMAGE, glViewImage)) +#define GL_VIEW_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_IMAGE, glViewImageClass)) +#define GL_IS_VIEW_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_IMAGE)) +#define GL_IS_VIEW_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_IMAGE)) + +typedef struct _glViewImage glViewImage; +typedef struct _glViewImageClass glViewImageClass; + +typedef struct _glViewImagePrivate glViewImagePrivate; + +struct _glViewImage { + glViewObject parent_object; + + glViewImagePrivate *private; +}; + +struct _glViewImageClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_image_get_type (void); + +extern glViewObject *gl_view_image_new (glLabelImage *object, + glView *view); + + +/* cursor for creating image objects */ +extern GdkCursor *gl_view_image_get_create_cursor (void); + +/* event handler for creating image objects */ +extern gint gl_view_image_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_IMAGE_H__ */ diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c new file mode 100644 index 00000000..27dc8003 --- /dev/null +++ b/glabels2/src/view-line.c @@ -0,0 +1,652 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_line.c: GLabels label line object widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "view-line.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-vector.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_line.xbm" +#include "pixmaps/cursor_line_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define CREATE_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 192) + +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewLinePrivate { + GnomeCanvasItem *item; + + /* Property dialog Page 0 widgets */ + GtkWidget *line; + + /* Property dialog Page 1 widgets */ + GtkWidget *position; + GtkWidget *vector; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_line_class_init (glViewLineClass *klass); +static void gl_view_line_instance_init (glViewLine *view_line); +static void gl_view_line_finalize (GObject *object); + +static void update_view_line_cb (glLabelObject *object, + glViewLine *view_line); + +static GtkWidget *construct_properties_dialog (glViewLine *view_line); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewLine *view_line); + +static void line_changed_cb (glWdgtLine *line, + glViewLine *view_line); + +static void position_changed_cb (glWdgtPosition *position, + glViewLine *view_line); + +static void vector_changed_cb (glWdgtVector *vector, + glViewLine *view_line); + +static void update_dialog_cb (glLabelObject *object, + glViewLine *view_line); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_line_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewLineClass), + NULL, + NULL, + (GClassInitFunc) gl_view_line_class_init, + NULL, + NULL, + sizeof (glViewLine), + 0, + (GInstanceInitFunc) gl_view_line_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewLine", &info, 0); + } + + return type; +} + +static void +gl_view_line_class_init (glViewLineClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_line_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_line_instance_init (glViewLine *view_line) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_line->private = g_new0 (glViewLinePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_line_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_LINE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW line object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_line_new (glLabelLine *object, + glView *view) +{ + glViewLine *view_line; + GnomeCanvasItem *group; + gdouble line_width; + guint line_color; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + GnomeCanvasPoints *points; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_LINE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_line = g_object_new (gl_view_line_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_line), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_line), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_LINE_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(object); + line_color = gl_label_line_get_line_color(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_line)); + + points = gnome_canvas_points_new (2); + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = w; + points->coords[3] = h; + view_line->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_line_get_type (), + "points", points, + "width_units", line_width, + "fill_color_rgba", line_color, + NULL); + gnome_canvas_points_free (points); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_line_cb), view_line); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_line); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_line), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_line); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_line_cb (glLabelObject *object, + glViewLine *view_line) +{ + gdouble line_width; + guint line_color; + gdouble w, h; + GnomeCanvasPoints *points; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + + /* Adjust appearance of analogous canvas item. */ + points = gnome_canvas_points_new (2); + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = w; + points->coords[3] = h; + gnome_canvas_item_set (view_line->private->item, + "points", points, + "width_units", line_width, + "fill_color_rgba", line_color, + NULL); + gnome_canvas_points_free (points); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_line)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a line object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewLine *view_line) +{ + GtkWidget *dialog, *notebook, *wvbox; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble line_width; + guint line_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit line object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_line); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line line ------ */ + view_line->private->line = gl_wdgt_line_new (_("Outline")); + gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line), + line_width, + line_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_line->private->line, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_line->private->line), "changed", + G_CALLBACK(line_changed_cb), view_line); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_line->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_line->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_line->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_line->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_line); + + + /* ------ Size Frame ------ */ + view_line->private->vector = gl_wdgt_vector_new (_("Size")); + gl_wdgt_vector_set_params (GL_WDGT_VECTOR (view_line->private->vector), + w, h, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_line->private->vector, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_line->private->vector), "changed", + G_CALLBACK(vector_changed_cb), view_line); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_line); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewLine *view_line) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. line properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +line_changed_cb (glWdgtLine *line, + glViewLine *view_line) +{ + glLabelObject *object; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + gl_wdgt_line_get_params (GL_WDGT_LINE (line), + &line_width, + &line_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + gl_label_line_set_line_width(GL_LABEL_LINE(object), line_width); + gl_label_line_set_line_color(GL_LABEL_LINE(object), line_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewLine *view_line) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. vector "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +vector_changed_cb (glWdgtVector *vector, + glViewLine *view_line) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_vector_get_params (GL_WDGT_VECTOR (vector), &w, &h); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewLine *view_line) +{ + gdouble line_width; + guint line_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_line->private->line), + line_changed_cb, view_line); + g_signal_handlers_block_by_func (G_OBJECT(view_line->private->position), + position_changed_cb, view_line); + g_signal_handlers_block_by_func (G_OBJECT(view_line->private->vector), + vector_changed_cb, view_line); + + /* Update widgets in property dialog */ + gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line), + line_width, + line_color); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_line->private->position), + x, y); + gl_wdgt_vector_set_params (GL_WDGT_VECTOR(view_line->private->vector), + w, h, label_width, label_height); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->line), + line_changed_cb, view_line); + g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->position), + position_changed_cb, view_line); + g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->vector), + vector_changed_cb, view_line); + + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_line_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_line_bits, + cursor_line_width, + cursor_line_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_line_mask_bits, + cursor_line_mask_width, + cursor_line_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_line_x_hot, + cursor_line_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating line objects. */ +/*****************************************************************************/ +int +gl_view_line_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_line; + static GObject *object; + gdouble line_width; + guint line_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_line_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + line_width = 1.0; + line_color = CREATE_LINE_COLOR; + gl_label_line_set_line_width (GL_LABEL_LINE(object), + line_width); + gl_label_line_set_line_color (GL_LABEL_LINE(object), + line_color); + view_line = gl_view_line_new (GL_LABEL_LINE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + w = x - x0; + h = y - y0; + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + line_color = DEFAULT_LINE_COLOR; + gl_label_line_set_line_color (GL_LABEL_LINE(object), + line_color); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_line)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + w = x - x0; + h = y - y0; + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-line.h b/glabels2/src/view-line.h new file mode 100644 index 00000000..23618996 --- /dev/null +++ b/glabels2/src/view-line.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_line.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_LINE_H__ +#define __VIEW_LINE_H__ + +#include "view-object.h" +#include "label-line.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_LINE (gl_view_line_get_type ()) +#define GL_VIEW_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_LINE, glViewLine)) +#define GL_VIEW_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_LINE, glViewLineClass)) +#define GL_IS_VIEW_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_LINE)) +#define GL_IS_VIEW_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_LINE)) + +typedef struct _glViewLine glViewLine; +typedef struct _glViewLineClass glViewLineClass; + +typedef struct _glViewLinePrivate glViewLinePrivate; + +struct _glViewLine { + glViewObject parent_object; + + glViewLinePrivate *private; +}; + +struct _glViewLineClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_line_get_type (void); + +extern glViewObject *gl_view_line_new (glLabelLine *object, + glView *view); + + +/* cursor for creating line objects */ +extern GdkCursor *gl_view_line_get_create_cursor (void); + +/* event handler for creating line objects */ +extern gint gl_view_line_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_LINE_H__ */ diff --git a/glabels2/src/view-object.c b/glabels2/src/view-object.c new file mode 100644 index 00000000..9897b3f5 --- /dev/null +++ b/glabels2/src/view-object.c @@ -0,0 +1,524 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_object.c: GLabels label object base class + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "view-object.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewObjectPrivate { + + glView *view; + glLabelObject *object; + + GnomeCanvasItem *group; + GnomeCanvasItem *highlight; + + GtkWidget *menu; + GtkWidget *property_dialog; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_object_class_init (glViewObjectClass *klass); +static void gl_view_object_instance_init (glViewObject *view_object); +static void gl_view_object_finalize (GObject *object); + +static GtkMenu *new_menu (glViewObject *view_object); + +static void object_moved_cb (glLabelObject *object, + gdouble x, gdouble y, + glViewObject *view_object); +static void raise_object_cb (GtkWidget * widget, glViewObject *view_object); +static void lower_object_cb (GtkWidget * widget, glViewObject *view_object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_object_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewObjectClass), + NULL, + NULL, + (GClassInitFunc) gl_view_object_class_init, + NULL, + NULL, + sizeof (glViewObject), + 0, + (GInstanceInitFunc) gl_view_object_instance_init, + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "glViewObject", &info, 0); + } + + return type; +} + +static void +gl_view_object_class_init (glViewObjectClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_object_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_object_instance_init (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_object->private = g_new0 (glViewObjectPrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_object_finalize (GObject *object) +{ + glLabel *parent; + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_OBJECT (object)); + + view = GL_VIEW_OBJECT(object)->private->view; + view->object_list = g_list_remove (view->object_list, object); + view->selected_object_list = + g_list_remove (view->selected_object_list, object); + + g_object_unref (GL_VIEW_OBJECT(object)->private->object); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->group)); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->highlight)); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->menu)); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->property_dialog)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW object view. */ +/*****************************************************************************/ +GObject * +gl_view_object_new (void) +{ + glViewObject *view_object; + + gl_debug (DEBUG_VIEW, "START"); + + view_object = g_object_new (gl_view_object_get_type(), NULL); + + gl_debug (DEBUG_VIEW, "END"); + + return G_OBJECT (view_object); +} + +/*****************************************************************************/ +/* Set parent view to which this object view belongs. */ +/*****************************************************************************/ +void +gl_view_object_set_view (glViewObject *view_object, + glView *view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_object->private->view = view; + + view->object_list = g_list_prepend (view->object_list, view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set Label object to follow. */ +/*****************************************************************************/ +void +gl_view_object_set_object (glViewObject *view_object, + glLabelObject *object, + glViewHighlightStyle style) +{ + GnomeCanvas *canvas; + GnomeCanvasGroup *root; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + view_object->private->object = object; + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + + /* create canvas group to contain items representing object */ + canvas = GNOME_CANVAS (view_object->private->view->canvas); + root = gnome_canvas_root (canvas); + view_object->private->group = + gnome_canvas_item_new (root, gnome_canvas_group_get_type (), + "x", x, + "y", y, + NULL); + + /* Create appropriate selection highlight canvas item. */ + view_object->private->highlight = + gl_view_highlight_new (view_object, style); + + view_object->private->menu = GTK_WIDGET(new_menu (view_object)); + + g_signal_connect (G_OBJECT (object), "moved", + G_CALLBACK (object_moved_cb), + view_object); + + g_signal_connect (G_OBJECT (object), "top", + G_CALLBACK (raise_object_cb), + view_object); + + g_signal_connect (G_OBJECT (object), "bottom", + G_CALLBACK (lower_object_cb), + view_object); + + g_signal_connect (G_OBJECT (view_object->private->group), "event", + G_CALLBACK (gl_view_item_event_handler), + view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set dialog for controlling/viewing object properties. */ +/*****************************************************************************/ +void +gl_view_object_set_dialog (glViewObject *view_object, + GtkWidget *dialog) + +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (dialog && GTK_IS_WIDGET (dialog)); + + view_object->private->property_dialog = dialog; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return parent view associated with this view. */ +/*****************************************************************************/ +glView * +gl_view_object_get_view (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->view; +} + +/*****************************************************************************/ +/* Return label object that we are following. */ +/*****************************************************************************/ +glLabelObject * +gl_view_object_get_object (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->object; +} + +/*****************************************************************************/ +/* Return canvas item representing our object in this view. */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_view_object_get_group (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->group; +} + +/*****************************************************************************/ +/* Return dialog for controlling/viewing object properties. */ +/*****************************************************************************/ +GtkWidget * +gl_view_object_get_dialog (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->property_dialog; +} + +/*****************************************************************************/ +/* Popup menu for this object. */ +/*****************************************************************************/ +GtkMenu * +gl_view_object_get_menu (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return GTK_MENU(view_object->private->menu); +} + +/*****************************************************************************/ +/* Update Highlight of object. */ +/*****************************************************************************/ +void +gl_view_object_update_highlight (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view_object->private->highlight); + + gl_view_highlight_update (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Highlight view of object. */ +/*****************************************************************************/ +void +gl_view_object_show_highlight (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view_object->private->highlight); + + gnome_canvas_item_show (view_object->private->highlight); + gnome_canvas_item_raise_to_top (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Remove highlight from view of object. */ +/*****************************************************************************/ +void +gl_view_object_hide_highlight (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view_object->private->highlight); + + gnome_canvas_item_hide (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + + +/*---------------------------------------------------------------------------*/ +/* Create a popup menu for this object view. */ +/*---------------------------------------------------------------------------*/ +static GtkMenu * +new_menu (glViewObject *view_object) +{ + GtkWidget *menu, *menuitem; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_val_if_fail (view_object && GL_VIEW_OBJECT(view_object), NULL); + + menu = gtk_menu_new (); + + menuitem = gtk_menu_item_new_with_label (_("Edit properties...")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_view_object_show_dialog), + view_object); + + menuitem = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Delete")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (g_object_unref), view_object); + + menuitem = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Bring to front")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_label_object_raise_to_top), + view_object->private->object); + + menuitem = gtk_menu_item_new_with_label (_("Send to back")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_label_object_lower_to_bottom), + view_object->private->object); + + gl_debug (DEBUG_VIEW, "END"); + + return GTK_MENU(menu); +} + +/*****************************************************************************/ +/* Show property dialog. */ +/*****************************************************************************/ +void +gl_view_object_show_dialog (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gtk_widget_show_all (view_object->private->property_dialog); + + gl_debug (DEBUG_VIEW, "END"); +} + + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Object moved callback. */ +/*---------------------------------------------------------------------------*/ +static void +object_moved_cb (glLabelObject *object, + gdouble dx, + gdouble dy, + glViewObject *view_object) +{ + GnomeCanvasItem *item, *highlight; + + gl_debug (DEBUG_VIEW, "START"); + + /* Adjust location of analogous canvas group. */ + gnome_canvas_item_move (view_object->private->group, dx, dy); + + /* Adjust location of highlight group */ + gnome_canvas_item_move (view_object->private->highlight, dx, dy); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. raise item to front callback. */ +/*---------------------------------------------------------------------------*/ +static void +raise_object_cb (GtkWidget * widget, + glViewObject *view_object) +{ + glLabelObject *object; + + gl_debug (DEBUG_VIEW, "START"); + + gnome_canvas_item_raise_to_top (view_object->private->group); + gnome_canvas_item_raise_to_top (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. lower item to back callback. */ +/*---------------------------------------------------------------------------*/ +static void +lower_object_cb (GtkWidget * widget, + glViewObject *view_object) +{ + glLabelObject *object; + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + /* Send to bottom */ + gnome_canvas_item_lower_to_bottom (view_object->private->group); + + /* now raise it above all items that form the backgound */ + gnome_canvas_item_raise (view_object->private->group, + view_object->private->view->n_bg_items); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Select object. */ +/*****************************************************************************/ +void +gl_view_object_select (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + gl_view_select_object(view_object->private->view, view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + diff --git a/glabels2/src/view-object.h b/glabels2/src/view-object.h new file mode 100644 index 00000000..4defc538 --- /dev/null +++ b/glabels2/src/view-object.h @@ -0,0 +1,85 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_object.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_OBJECT_H__ +#define __VIEW_OBJECT_H__ + +#include +#include +#include "label-object.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_OBJECT (gl_view_object_get_type ()) +#define GL_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_OBJECT, glViewObject)) +#define GL_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_OBJECT, glViewObjectClass)) +#define GL_IS_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_OBJECT)) +#define GL_IS_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_OBJECT)) + +typedef struct _glViewObject glViewObject; +typedef struct _glViewObjectClass glViewObjectClass; + +typedef struct _glViewObjectPrivate glViewObjectPrivate; + + +#include "view.h" +#include "view-highlight.h" + +struct _glViewObject { + GObject parent_object; + + glViewObjectPrivate *private; +}; + +struct _glViewObjectClass { + GObjectClass parent_class; +}; + +extern GType gl_view_object_get_type (void); + +extern GObject *gl_view_object_new (void); + +extern void gl_view_object_set_view (glViewObject *view_object, + glView *view); +extern void gl_view_object_set_object (glViewObject *view_object, + glLabelObject *object, + glViewHighlightStyle style); +extern void gl_view_object_set_dialog (glViewObject *view_object, + GtkWidget *dialog); + +extern glView *gl_view_object_get_view (glViewObject *view_object); +extern glLabelObject *gl_view_object_get_object (glViewObject *view_object); +extern GnomeCanvasItem *gl_view_object_get_group (glViewObject *view_object); +extern GtkMenu *gl_view_object_get_menu (glViewObject *view_object); + +extern void gl_view_object_update_highlight (glViewObject *view_object); +extern void gl_view_object_show_highlight (glViewObject *view_object); +extern void gl_view_object_hide_highlight (glViewObject *view_object); + +extern void gl_view_object_show_dialog (glViewObject *view_object); + +extern void gl_view_object_select (glViewObject *view_object); + +G_END_DECLS + +#endif /* __VIEW_OBJECT_H__ */ diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c new file mode 100644 index 00000000..228f0c76 --- /dev/null +++ b/glabels2/src/view-text.c @@ -0,0 +1,759 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_text.c: GLabels label text object widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "view-text.h" +#include "canvas-hacktext.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-text-entry.h" +#include "wdgt-text-props.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_text.xbm" +#include "pixmaps/cursor_text_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewTextPrivate { + + GList *item_list; + + /* Page 0 widgets */ + GtkWidget *text_entry; + + /* Page 1 widgets */ + GtkWidget *text_props; + + /* Page 2 widgets */ + GtkWidget *position; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_text_class_init (glViewTextClass *klass); +static void gl_view_text_instance_init (glViewText *view_text); +static void gl_view_text_finalize (GObject *object); + +static void update_view_text_cb (glLabelObject *object, + glViewText *view_text); + +static GtkWidget *construct_properties_dialog (glViewText *view_text); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewText *view_text); + +static void text_entry_changed_cb (glWdgtTextEntry *text_entry, + glViewText *view_text); + +static void text_props_changed_cb (glWdgtTextProps *text_props, + glViewText *view_text); + +static void position_changed_cb (glWdgtPosition *position, + glViewText *view_text); + +static void update_dialog_cb (glLabelObject *object, + glViewText *view_text); + +static void draw_hacktext (glViewText *view_text); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_text_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewTextClass), + NULL, + NULL, + (GClassInitFunc) gl_view_text_class_init, + NULL, + NULL, + sizeof (glViewText), + 0, + (GInstanceInitFunc) gl_view_text_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewText", &info, 0); + } + + return type; +} + +static void +gl_view_text_class_init (glViewTextClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_text_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_text_instance_init (glViewText *view_text) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_text->private = g_new0 (glViewTextPrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_text_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_TEXT (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW text object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_text_new (glLabelText *object, + glView *view) +{ + glViewText *view_text; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_TEXT (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_text = g_object_new (gl_view_text_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_text), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_text), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_SIMPLE); + + /* Create analogous canvas item. */ + draw_hacktext (view_text); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_text_cb), view_text); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_text); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_text), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_text); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_text_cb (glLabelObject *object, + glViewText *view_text) +{ + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + view = gl_view_object_get_view (GL_VIEW_OBJECT(view_text)); + + /* Adjust appearance of analogous canvas item. */ + draw_hacktext (view_text); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_text)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a text object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewText *view_text) +{ + GtkWidget *dialog, *notebook, *wvbox, *wbutton; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble x, y, w, h, label_width, label_height; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + glMerge *merge; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + lines = gl_label_text_get_lines(GL_LABEL_TEXT(object)); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, + &font_weight, &font_italic_flag, + &color, &just); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + gl_debug (DEBUG_VIEW, "Creating dialog..."); + dialog = gtk_dialog_new_with_buttons ( _("Edit text object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_text); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Text Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating text tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Text"))); + + /* text entry */ + gl_debug (DEBUG_VIEW, "Creating text entry..."); + view_text->private->text_entry = + gl_wdgt_text_entry_new ("Text", merge->field_defs); + gl_debug (DEBUG_VIEW, "1"); + gl_wdgt_text_entry_set_text (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry), + (merge->type != GL_MERGE_NONE), + lines); + gl_debug (DEBUG_VIEW, "2"); + gtk_box_pack_start (GTK_BOX (wvbox), view_text->private->text_entry, + FALSE, FALSE, 0); + gl_debug (DEBUG_VIEW, "3"); + g_signal_connect ( G_OBJECT(view_text->private->text_entry), + "changed", G_CALLBACK (text_entry_changed_cb), + view_text); + + + /*---------------------------*/ + /* Text Props Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating props tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* text props entry */ + gl_debug (DEBUG_VIEW, "Creating props entry..."); + view_text->private->text_props = + gl_wdgt_text_props_new ("Text Properties"); + gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props), + font_family, font_size, font_weight, + font_italic_flag, color, just); + gtk_box_pack_start (GTK_BOX (wvbox), view_text->private->text_props, + FALSE, FALSE, 0); + g_signal_connect ( G_OBJECT(view_text->private->text_props), + "changed", G_CALLBACK (text_props_changed_cb), + view_text); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + gl_debug (DEBUG_VIEW, "Creating position tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position"))); + + /* ------ Position Frame ------ */ + gl_debug (DEBUG_VIEW, "Creating position entry..."); + view_text->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_text->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_text->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_text->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_text); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_text); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewText *view_text) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. text_entry "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +text_entry_changed_cb (glWdgtTextEntry *text_entry, + glViewText *view_text) +{ + glLabelObject *object; + GList *lines; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + lines = gl_wdgt_text_entry_get_text (text_entry); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + + gl_text_node_lines_free (&lines); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. text_props "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +text_props_changed_cb (glWdgtTextProps *text_props, + glViewText *view_text) +{ + glLabelObject *object; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + gl_wdgt_text_props_get_params (text_props, + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + gl_label_text_set_props (GL_LABEL_TEXT(object), + font_family, font_size, font_weight, + font_italic_flag, + color, just); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + + g_free (font_family); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewText *view_text) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewText *view_text) +{ + gdouble x, y; + GList *lines; + glMerge *merge; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + lines = gl_label_text_get_lines(GL_LABEL_TEXT(object)); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, + &font_weight, &font_italic_flag, + &color, &just); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_text->private->text_entry), + text_entry_changed_cb, view_text); + g_signal_handlers_block_by_func (G_OBJECT(view_text->private->text_props), + text_props_changed_cb, view_text); + g_signal_handlers_block_by_func (G_OBJECT(view_text->private->position), + position_changed_cb, view_text); + + /* Update widgets in property dialog */ + + gl_wdgt_text_entry_set_text (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry), + (merge->type != GL_MERGE_NONE), + lines); + gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props), + font_family, font_size, font_weight, + font_italic_flag, color, just); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_text->private->position), + x, y); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->text_entry), + text_entry_changed_cb, view_text); + g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->text_props), + text_props_changed_cb, view_text); + g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->position), + position_changed_cb, view_text); + + gl_text_node_lines_free (&lines); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_text_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_text_bits, + cursor_text_width, + cursor_text_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_text_mask_bits, + cursor_text_mask_width, + cursor_text_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_text_x_hot, + cursor_text_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating text objects. */ +/*****************************************************************************/ +int +gl_view_text_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_text; + static GObject *object; + gdouble x, y; + GList *lines; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_text_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + lines = gl_text_node_lines_new_from_text (_("Text")); + gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); + view_text = gl_view_text_new (GL_LABEL_TEXT(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_text)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw hacktext to item (group). */ +/*--------------------------------------------------------------------------*/ +static void +draw_hacktext (glViewText *view_text) +{ + glLabelObject *object; + GnomeCanvasItem *group, *item; + GList *lines; + gchar *text; + gchar *font_family; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + gdouble font_size; + guint color; + GtkJustification just; + GnomeFont *font; + GnomeGlyphList *glyphlist; + ArtDRect bbox; + gdouble affine[6]; + gdouble x_offset, y_offset, w, object_w, object_h; + gint i; + gchar **line; + GList *li; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query label object and properties */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + gl_label_object_get_size (object, &object_w, &object_h); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, + &font_weight, &font_italic_flag, + &color, &just); + lines = gl_label_text_get_lines(GL_LABEL_TEXT(object)); + text = gl_text_node_lines_expand (lines, NULL); + line = g_strsplit (text, "\n", -1); + + /* get parent item/group to render to. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_text)); + + /* remove previous items from group. */ + for (li = view_text->private->item_list; li != NULL; li = li->next) { + gl_debug (DEBUG_VIEW, "in loop"); + gtk_object_destroy (GTK_OBJECT (li->data)); + } + gl_debug (DEBUG_VIEW, "1"); + g_list_free (view_text->private->item_list); + view_text->private->item_list = NULL; + gl_debug (DEBUG_VIEW, "2"); + + /* get Gnome Font */ + font = gnome_font_find_closest_from_weight_slant (font_family, + font_weight, + font_italic_flag, + font_size); + art_affine_identity (affine); + + /* render to group, one item per line. */ + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, color, + 0.0, 0.0, + line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + w = bbox.x1; + + switch (just) { + case GTK_JUSTIFY_LEFT: + x_offset = 0.0; + break; + case GTK_JUSTIFY_CENTER: + x_offset = (object_w - w) / 2.0; + break; + case GTK_JUSTIFY_RIGHT: + x_offset = object_w - w; + break; + default: + x_offset = 0.0; + break; /* shouldn't happen */ + } + + y_offset = + (i + 1) * font_size + gnome_font_get_descender (font); + + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gl_canvas_hacktext_get_type (), + "x", x_offset, + "y", y_offset, + "glyphlist", glyphlist, NULL); + view_text->private->item_list = + g_list_prepend (view_text->private->item_list, item); + + } + + /* clean up */ + g_strfreev (line); + gl_text_node_lines_free (&lines); + g_free (text); + + gl_debug (DEBUG_VIEW, "END"); +} + diff --git a/glabels2/src/view-text.h b/glabels2/src/view-text.h new file mode 100644 index 00000000..392f4674 --- /dev/null +++ b/glabels2/src/view-text.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_text.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_TEXT_H__ +#define __VIEW_TEXT_H__ + +#include "view-object.h" +#include "label-text.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_TEXT (gl_view_text_get_type ()) +#define GL_VIEW_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_TEXT, glViewText)) +#define GL_VIEW_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_TEXT, glViewTextClass)) +#define GL_IS_VIEW_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_TEXT)) +#define GL_IS_VIEW_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_TEXT)) + +typedef struct _glViewText glViewText; +typedef struct _glViewTextClass glViewTextClass; + +typedef struct _glViewTextPrivate glViewTextPrivate; + +struct _glViewText { + glViewObject parent_object; + + glViewTextPrivate *private; +}; + +struct _glViewTextClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_text_get_type (void); + +extern glViewObject *gl_view_text_new (glLabelText *object, + glView *view); + + +/* cursor for creating text objects */ +extern GdkCursor *gl_view_text_get_create_cursor (void); + +/* event handler for creating text objects */ +extern gint gl_view_text_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_TEXT_H__ */ diff --git a/glabels2/src/view.c b/glabels2/src/view.c new file mode 100644 index 00000000..d6e3a3dc --- /dev/null +++ b/glabels2/src/view.c @@ -0,0 +1,1885 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view.c: GLabels View module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include +#include + +#include "view.h" +#include "view-object.h" +#include "view-box.h" +#include "view-ellipse.h" +#include "view-line.h" +#include "view-image.h" +#include "view-text.h" +#include "view-barcode.h" +#include "xml-label.h" + +#include "debug.h" + +#define SEL_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 255, 128) +#define SEL_FILL_COLOR GNOME_CANVAS_COLOR_A (192, 192, 255, 128) + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +/* "CLIPBOARD" selection */ +static GdkAtom clipboard_atom = GDK_NONE; + +#define HOME_SCALE 2.0 +static gdouble scales[] = { 8.0, 6.0, 4.0, 3.0, + 2.0, + 1.5, 1.0, 0.5, 0.25, + 0.0 +}; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_view_class_init (glViewClass *class); +static void gl_view_init (glView * view); +static void gl_view_finalize (GObject * object); + +static void gl_view_construct (glView *view); +static GtkWidget *gl_view_construct_canvas (glView *view); +static void gl_view_construct_selection (glView *view); + +static gdouble get_apropriate_scale (gdouble w, gdouble h); + +static void draw_rect_bg (glView * view); +static void draw_rounded_rect_bg (glView * view); +static void draw_round_bg (glView * view); +static void draw_cd_bg (glView * view); + +static int canvas_event (GnomeCanvas * canvas, + GdkEvent * event, + glView *view); +static int canvas_event_arrow_mode (GnomeCanvas * canvas, + GdkEvent * event, glView *view); + +static void select_region (glView * view, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); +static void select_object (glViewObject *view_object); +static void unselect_object (glViewObject *view_object); +static gboolean object_at (glView * view, + gdouble x, gdouble y); +static gboolean object_selected (glViewObject *view_object); +static gboolean multiple_items_selected (glView * view); + +static int item_event_arrow_mode (GnomeCanvasItem * item, + GdkEvent * event, + glViewObject *view_object); + +static GtkWidget *new_selection_menu (glView * view); + +static void popup_selection_menu (glView *view, + glViewObject *view_object, GdkEvent *event); + +static void move_selected_items (glView * view, gdouble dx, gdouble dy); +static void move_item (GnomeCanvasItem * item, gdouble dx, gdouble dy); + +static void raise_selection_cb (GtkWidget * widget, glView * view); +static void lower_selection_cb (GtkWidget * widget, glView * view); + +static void selection_clear_cb (GtkWidget * widget, + GdkEventSelection * event, gpointer data); + +static void selection_get_cb (GtkWidget * widget, + GtkSelectionData * selection_data, guint info, + guint time, gpointer data); + +static void selection_received_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint time, gpointer data); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_view_get_type (void) +{ + static guint view_type = 0; + + if (!view_type) { + GTypeInfo view_info = { + sizeof (glViewClass), + NULL, + NULL, + (GClassInitFunc) gl_view_class_init, + NULL, + NULL, + sizeof (glView), + 0, + (GInstanceInitFunc) gl_view_init, + }; + + view_type = + g_type_register_static (gtk_vbox_get_type (), + "glView", &view_info, 0); + } + + return view_type; +} + +static void +gl_view_class_init (glViewClass * class) +{ + GObjectClass *object_class = (GObjectClass *) class; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (class); + + object_class->finalize = gl_view_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_init (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + view->label = NULL; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_finalize (GObject * object) +{ + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_VIEW (object)); + + view = GL_VIEW (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +GtkWidget * +gl_view_new (glLabel * label) +{ + glView *view = g_object_new (gl_view_get_type (), NULL); + + gl_debug (DEBUG_VIEW, "START"); + + view->label = label; + + gl_view_construct (view); + + gl_debug (DEBUG_VIEW, "END"); + + return GTK_WIDGET (view); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_view_construct (glView * view) +{ + GtkWidget *wvbox, *wscroll; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + wvbox = GTK_WIDGET (view); + + view->state = GL_VIEW_STATE_ARROW; + view->object_list = NULL; + + gl_view_construct_canvas (view); + wscroll = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (wvbox), wscroll, TRUE, TRUE, 0); + gtk_container_add (GTK_CONTAINER (wscroll), view->canvas); + + gl_view_construct_selection (view); + + view->menu = new_selection_menu (view); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create canvas w/ a background in the shape of the label/card. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +gl_view_construct_canvas (glView * view) +{ + gdouble scale; + glLabel *label = view->label; + gdouble label_width, label_height; + glTemplate *label_template; + GList *p_obj; + glLabelObject *object; + glViewObject *view_object; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_val_if_fail (GL_IS_VIEW (view), NULL); + g_return_val_if_fail (label != NULL, NULL); + + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + view->canvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + + gl_label_get_size (label, &label_width, &label_height); + gl_debug (DEBUG_VIEW, "Label size: w=%lf, h=%lf", + label_width, label_height); + label_template = gl_label_get_template (label); + + scale = get_apropriate_scale (label_width, label_height); + gl_debug (DEBUG_VIEW, "scale =%lf", scale); + + gl_debug (DEBUG_VIEW, "Canvas size: w=%lf, h=%lf", + scale * label_width + 40, + scale * label_height + 40); + gtk_widget_set_size_request (GTK_WIDGET(view->canvas), + scale * label_width + 40, + scale * label_height + 40); + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas), + scale); + view->scale = scale; + + gnome_canvas_set_scroll_region (GNOME_CANVAS (view->canvas), + 0.0, 0.0, label_width, label_height); + + /* Draw background shape of label/card */ + switch (label_template->style) { + + case GL_TEMPLATE_STYLE_RECT: + if (label_template->label_round == 0.0) { + /* Square corners. */ + draw_rect_bg (view); + } else { + /* Rounded corners. */ + draw_rounded_rect_bg (view); + } + break; + + case GL_TEMPLATE_STYLE_ROUND: + draw_round_bg (view); + break; + + case GL_TEMPLATE_STYLE_CD: + draw_cd_bg (view); + break; + + default: + g_warning ("Unknown template label style"); + break; + } + + g_signal_connect (G_OBJECT (view->canvas), "event", + G_CALLBACK (canvas_event), view); + + for (p_obj = label->objects; p_obj != NULL; p_obj = p_obj->next) { + object = (glLabelObject *) p_obj->data; + + if (GL_IS_LABEL_BOX (object)) { + view_object = gl_view_box_new (GL_LABEL_BOX(object), + view); + } else if (GL_IS_LABEL_ELLIPSE (object)) { + view_object = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), + view); + } else if (GL_IS_LABEL_LINE (object)) { + view_object = gl_view_line_new (GL_LABEL_LINE(object), + view); + } else if (GL_IS_LABEL_IMAGE (object)) { + view_object = gl_view_image_new (GL_LABEL_IMAGE(object), + view); + } else if (GL_IS_LABEL_TEXT (object)) { + view_object = gl_view_text_new (GL_LABEL_TEXT(object), + view); + } else if (GL_IS_LABEL_BARCODE (object)) { + view_object = gl_view_barcode_new (GL_LABEL_BARCODE(object), + view); + } else { + /* Should not happen! */ + view_object = NULL; + g_warning ("Invalid label object type."); + } + } + + gl_debug (DEBUG_VIEW, "END"); + + return view->canvas; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create selection targets. */ +/*---------------------------------------------------------------------------*/ +static void +gl_view_construct_selection (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + view->have_selection = FALSE; + view->selection_data = NULL; + view->invisible = gtk_invisible_new (); + + view->selected_object_list = NULL; + + if (!clipboard_atom) { + clipboard_atom = gdk_atom_intern ("GLABELS_CLIPBOARD", FALSE); + } + + gtk_selection_add_target (view->invisible, + clipboard_atom, GDK_SELECTION_TYPE_STRING, 1); + + g_signal_connect (G_OBJECT (view->invisible), + "selection_clear_event", + G_CALLBACK (selection_clear_cb), view); + + g_signal_connect (G_OBJECT (view->invisible), "selection_get", + G_CALLBACK (selection_get_cb), view); + + g_signal_connect (G_OBJECT (view->invisible), + "selection_received", + G_CALLBACK (selection_received_cb), view); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Determine an apropriate scale for given label & screen size */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_apropriate_scale (gdouble w, gdouble h) +{ + gdouble w_screen, h_screen; + gint i; + gdouble k; + + gl_debug (DEBUG_VIEW, ""); + + w_screen = (gdouble) gdk_screen_width (); + h_screen = (gdouble) gdk_screen_height (); + + for (i = 0; scales[i] > 0.0; i++) { + k = scales[i]; + if (k <= HOME_SCALE) { + if ((k * w < (w_screen - 256)) + && (k * h < (h_screen - 256))) + return k; + } + } + + return 0.25; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw simple recangular background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_rect_bg (glView * view) +{ + glLabel *label = view->label; + glTemplate *template; + gdouble w, h, margin; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + gl_label_get_size (label, &w, &h); + template = gl_label_get_template (label); + margin = template->label_margin; + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", w, + "y2", h, + "fill_color", "white", + NULL); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", margin, + "y1", margin, + "x2", w - margin, + "y2", h - margin, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw rounded recangular background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_rounded_rect_bg (glView * view) +{ + glLabel *label = view->label; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + glTemplate *template; + gdouble r, w, h, m; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + gl_label_get_size (label, &w, &h); + template = gl_label_get_template (label); + r = template->label_round; + m = template->label_margin; + + points = gnome_canvas_points_new (4 * (1 + 90 / 5)); + i_coords = 0; + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + r - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r - r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + r - r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + (h - r) + r * sin (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + (w - r) + r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + (h - r) + r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + (w - r) + r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r - r * sin (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "fill_color", "white", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + if (template->label_margin >= template->label_round) { + /* simple rectangle */ + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", m, + "y1", m, + "x2", w - m, + "y2", h - m, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + view->n_bg_items++; + view->bg_item_list = + g_list_append (view->bg_item_list, item); + } else { + r = r - m; + w = w - 2 * m; + h = h - 2 * m; + + /* rectangle with rounded corners */ + points = gnome_canvas_points_new (4 * (1 + 90 / 5)); + i_coords = 0; + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + r - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + r - r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + r - r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + (h - r) + r * sin (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + (w - r) + r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + (h - r) + r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + (w - r) + r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + r - r * sin (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = + g_list_append (view->bg_item_list, item); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw round background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_round_bg (glView * view) +{ + glLabel *label = view->label; + glTemplate *template; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, r1; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + template = gl_label_get_template (label); + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + r1 = template->label_radius; + points = gnome_canvas_points_new (1 + 360/2); + i_coords = 0; + for (i_theta = 0; i_theta <= 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r1 * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r1 * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "fill_color", "white", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + r = template->label_radius - template->label_margin; + points = gnome_canvas_points_new (360 / 2); + i_coords = 0; + for (i_theta = 0; i_theta < 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw CD style background, circular w/ concentric hole. */ +/*---------------------------------------------------------------------------*/ +static void +draw_cd_bg (glView * view) +{ + glLabel *label = view->label; + glTemplate *template; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, r1, r2; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + template = gl_label_get_template (label); + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + r1 = template->label_radius; + r2 = template->label_hole; + points = gnome_canvas_points_new (2 * (1 + 360 / 2)); + i_coords = 0; + for (i_theta = 0; i_theta <= 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r1 * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r1 * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r2 * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r2 * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "fill_color", "white", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + /* outer margin */ + r = template->label_radius - template->label_margin; + points = gnome_canvas_points_new (360 / 2); + i_coords = 0; + for (i_theta = 0; i_theta < 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* inner margin */ + r = template->label_hole + template->label_margin; + points = gnome_canvas_points_new (360 / 2); + i_coords = 0; + for (i_theta = 0; i_theta < 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set arrow mode. */ +/*****************************************************************************/ +void +gl_view_arrow_mode (glView * view) +{ + static GdkCursor *cursor = NULL; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (!cursor) { + cursor = gdk_cursor_new (GDK_LEFT_PTR); + } + + gdk_window_set_cursor (view->canvas->window, cursor); + + view->state = GL_VIEW_STATE_ARROW; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set create text object mode. */ +/*****************************************************************************/ +void +gl_view_object_create_mode (glView * view, + glLabelObjectType type) +{ + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + switch (type) { + case GL_LABEL_OBJECT_BOX: + cursor = gl_view_box_get_create_cursor (); + break; + case GL_LABEL_OBJECT_ELLIPSE: + cursor = gl_view_ellipse_get_create_cursor (); + break; + case GL_LABEL_OBJECT_LINE: + cursor = gl_view_line_get_create_cursor (); + break; + case GL_LABEL_OBJECT_IMAGE: + cursor = gl_view_image_get_create_cursor (); + break; + case GL_LABEL_OBJECT_TEXT: + cursor = gl_view_text_get_create_cursor (); + break; + case GL_LABEL_OBJECT_BARCODE: + cursor = gl_view_barcode_get_create_cursor (); + break; + default: + g_warning ("Invalid label object type.");/*Should not happen!*/ + break; + } + + gdk_window_set_cursor (view->canvas->window, cursor); + + view->state = GL_VIEW_STATE_OBJECT_CREATE; + view->create_type = type; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Select given object. */ +/*****************************************************************************/ +void +gl_view_select_object (glView *view, glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + select_object (view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Select all items. */ +/*****************************************************************************/ +void +gl_view_select_all (glView * view) +{ + GList *p; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + gl_view_unselect_all (view); + + for (p = view->object_list; p != NULL; p = p->next) { + select_object (GL_VIEW_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Remove all selections */ +/*****************************************************************************/ +void +gl_view_unselect_all (glView * view) +{ + GList *p, *p_next; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p_next) { + p_next = p->next; + unselect_object (GL_VIEW_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* "Cut" selected items and place in clipboard selections. */ +/*****************************************************************************/ +void +gl_view_cut (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + gl_view_copy (view); + gl_view_delete_selection (view); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* "Copy" selected items to clipboard selections. */ +/*****************************************************************************/ +void +gl_view_copy (glView * view) +{ + GList *p; + glViewObject *view_object; + glLabelObject *object; + glTemplate *template; + gboolean rotate_flag; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (view->selected_object_list) { + + if ( view->selection_data ) { + g_object_unref (view->selection_data); + } + template = gl_label_get_template (view->label); + rotate_flag = gl_label_get_rotate_flag (view->label); + view->selection_data = GL_LABEL(gl_label_new ()); + gl_label_set_template (view->selection_data, template); + gl_label_set_rotate_flag (view->selection_data, rotate_flag); + gl_template_free (&template); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + + view_object = GL_VIEW_OBJECT (p->data); + object = gl_view_object_get_object (view_object); + + gl_debug (DEBUG_VIEW, "Object copied"); + + if (GL_IS_LABEL_BOX (object)) { + gl_label_box_dup (GL_LABEL_BOX(object), + view->selection_data); + } else if (GL_IS_LABEL_ELLIPSE (object)) { + gl_label_ellipse_dup (GL_LABEL_ELLIPSE(object), + view->selection_data); + } else if (GL_IS_LABEL_LINE (object)) { + gl_label_line_dup (GL_LABEL_LINE(object), + view->selection_data); + } else if (GL_IS_LABEL_IMAGE (object)) { + gl_label_image_dup (GL_LABEL_IMAGE(object), + view->selection_data); + } else if (GL_IS_LABEL_TEXT (object)) { + gl_label_text_dup (GL_LABEL_TEXT(object), + view->selection_data); + } else if (GL_IS_LABEL_BARCODE (object)) { + gl_label_barcode_dup (GL_LABEL_BARCODE(object), + view->selection_data); + } else { + /* Should not happen! */ + g_warning ("Invalid label object type."); + } + + + } + + gtk_selection_owner_set (view->invisible, + clipboard_atom, GDK_CURRENT_TIME); + view->have_selection = TRUE; + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* "Paste" from private clipboard selection. */ +/*****************************************************************************/ +void +gl_view_paste (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + gtk_selection_convert (GTK_WIDGET (view->invisible), + clipboard_atom, GDK_SELECTION_TYPE_STRING, + GDK_CURRENT_TIME); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler. */ +/*---------------------------------------------------------------------------*/ +static int +canvas_event (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + gl_debug (DEBUG_VIEW, ""); + + switch (view->state) { + + case GL_VIEW_STATE_ARROW: + return canvas_event_arrow_mode (canvas, event, view); + + case GL_VIEW_STATE_OBJECT_CREATE: + switch (view->create_type) { + case GL_LABEL_OBJECT_BOX: + return gl_view_box_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_ELLIPSE: + return gl_view_ellipse_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_LINE: + return gl_view_line_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_IMAGE: + return gl_view_image_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_TEXT: + return gl_view_text_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_BARCODE: + return gl_view_barcode_create_event_handler (canvas, + event, + view); + break; + default: + /*Should not happen!*/ + g_warning ("Invalid label object type."); + return FALSE; + } + + default: + g_warning ("Invalid view state."); /*Should not happen!*/ + return FALSE; + + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler (arrow mode) */ +/*---------------------------------------------------------------------------*/ +static int +canvas_event_arrow_mode (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + gdouble x, y, x1, y1, x2, y2; + GnomeCanvasGroup *group; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + switch (event->button.button) { + case 1: + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + + if (!object_at (view, x, y)) { + if (!(event->button.state & GDK_CONTROL_MASK)) { + gl_view_unselect_all (view); + } + + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)-> + window, FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, NULL, + NULL, event->button.time); + group = + gnome_canvas_root (GNOME_CANVAS + (view->canvas)); + item = + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", x, "y1", y, + "x2", x, "y2", y, + "width_pixels", 2, + "outline_color_rgba", + SEL_LINE_COLOR, + "fill_color_rgba", + SEL_FILL_COLOR, + NULL); + x0 = x; + y0 = y; + + } + return FALSE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + if (dragging) { + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, + &x, &y); + x1 = MIN (x, x0); + y1 = MIN (y, y0); + x2 = MAX (x, x0); + y2 = MAX (y, y0); + select_region (view, x1, y1, x2, y2); + gtk_object_destroy (GTK_OBJECT (item)); + return TRUE; + } + return FALSE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + + gnome_canvas_item_set (item, + "x1", MIN (x, x0), + "y1", MIN (y, y0), + "x2", MAX (x, x0), + "y2", MAX (y, y0), NULL); + return TRUE; + } else { + return FALSE; + } + + case GDK_KEY_PRESS: + gl_debug (DEBUG_VIEW, "KEY_PRESS"); + if (!dragging) { + switch (event->key.keyval) { + case GDK_Left: + case GDK_KP_Left: + move_selected_items (view, + -1.0 / (view->scale), + 0.0); + break; + case GDK_Up: + case GDK_KP_Up: + move_selected_items (view, 0.0, + -1.0 / (view->scale)); + break; + case GDK_Right: + case GDK_KP_Right: + move_selected_items (view, + 1.0 / (view->scale), + 0.0); + break; + case GDK_Down: + case GDK_KP_Down: + move_selected_items (view, 0.0, + 1.0 / (view->scale)); + break; + case GDK_Delete: + case GDK_KP_Delete: + gl_view_delete_selection (view); + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, + cursor); + gdk_cursor_unref (cursor); + break; + default: + return FALSE; + } + } + return TRUE; /* We handled this or we were dragging. */ + + default: + gl_debug (DEBUG_VIEW, "default"); + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Select all objects within given rectangular region. */ +/*---------------------------------------------------------------------------*/ +static void +select_region (glView * view, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) +{ + GList *p; + glViewObject *view_object; + glLabelObject *object; + gdouble i_x1, i_y1, i_x2, i_y2, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail ((x1 <= x2) && (y1 <= y2)); + + for (p = view->object_list; p != NULL; p = p->next) { + view_object = GL_VIEW_OBJECT(p->data); + if (!object_selected (view_object)) { + + object = gl_view_object_get_object (view_object); + + gl_label_object_get_position (object, &i_x1, &i_y1); + gl_label_object_get_size (object, &w, &h); + i_x2 = i_x1 + w; + i_y2 = i_y1 + h; + if ((i_x1 >= x1) && (i_x2 <= x2) && (i_y1 >= y1) + && (i_y2 <= y2)) { + select_object (view_object); + } + + } + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Select an object. */ +/*---------------------------------------------------------------------------*/ +static void +select_object (glViewObject *view_object) +{ + glView * view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + view = gl_view_object_get_view (view_object); + + if (!object_selected (view_object)) { + view->selected_object_list = + g_list_prepend (view->selected_object_list, view_object); + } + gl_view_object_show_highlight (view_object); + gtk_widget_grab_focus (GTK_WIDGET (view->canvas)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Un-select object. */ +/*---------------------------------------------------------------------------*/ +static void +unselect_object (glViewObject *view_object) +{ + glView * view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + view = gl_view_object_get_view (view_object); + + gl_view_object_hide_highlight (view_object); + + view->selected_object_list = + g_list_remove (view->selected_object_list, view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Return object at (x,y). */ +/*---------------------------------------------------------------------------*/ +static gboolean +object_at (glView * view, + gdouble x, + gdouble y) +{ + GnomeCanvasItem *item, *p_item; + GList *p; + + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW (view), FALSE); + + item = gnome_canvas_get_item_at (GNOME_CANVAS (view->canvas), x, y); + + /* No item is at x, y */ + if (item == NULL) + return FALSE; + + /* ignore our background items */ + if (g_list_find (view->bg_item_list, item) != NULL) + return FALSE; + + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Is the object in our current selection? */ +/*---------------------------------------------------------------------------*/ +static gboolean +object_selected (glViewObject *view_object) +{ + glView *view; + + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW_OBJECT (view_object), FALSE); + + view = gl_view_object_get_view (view_object); + if (g_list_find (view->selected_object_list, view_object) == NULL) { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Are there multiple objects in our current selection? */ +/*---------------------------------------------------------------------------*/ +static gboolean +multiple_items_selected (glView * view) +{ + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW (view), FALSE); + + if (view->selected_object_list == NULL) + return FALSE; + if (view->selected_object_list->next == NULL) + return FALSE; + return TRUE; +} + +/*****************************************************************************/ +/* Item event handler. */ +/*****************************************************************************/ +gint +gl_view_item_event_handler (GnomeCanvasItem *item, + GdkEvent *event, + glViewObject *view_object) +{ + glView *view; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view(view_object); + switch (view->state) { + + case GL_VIEW_STATE_ARROW: + return item_event_arrow_mode (item, event, view_object); + + default: + return FALSE; + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Item event handler (arrow mode) */ +/*---------------------------------------------------------------------------*/ +static int +item_event_arrow_mode (GnomeCanvasItem *item, + GdkEvent *event, + glViewObject *view_object) +{ + static gdouble x, y; + static gboolean dragging = FALSE; + glView *view; + GdkCursor *cursor; + gdouble item_x, item_y; + gdouble new_x, new_y; + gboolean control_key_pressed; + + gl_debug (DEBUG_VIEW, ""); + + item_x = event->button.x; + item_y = event->button.y; + gnome_canvas_item_w2i (item->parent, &item_x, &item_y); + + view = gl_view_object_get_view(view_object); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + control_key_pressed = event->button.state & GDK_CONTROL_MASK; + switch (event->button.button) { + case 1: + if (control_key_pressed) { + if (object_selected (view_object)) { + /* Un-selecting a selected item */ + unselect_object (view_object); + return TRUE; + } else { + /* Add to current selection */ + select_object (view_object); + } + } else { + if (!object_selected (view_object)) { + /* No control, key so remove any selections before adding */ + gl_view_unselect_all (view); + /* Add to current selection */ + select_object (view_object); + } + } + /* Go into dragging mode while button remains pressed. */ + x = item_x; + y = item_y; + cursor = gdk_cursor_new (GDK_FLEUR); + gnome_canvas_item_grab (item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + cursor, event->button.time); + gdk_cursor_unref (cursor); + dragging = TRUE; + return TRUE; + + case 3: + if (!object_selected (view_object)) { + if (!control_key_pressed) { + /* No control, key so remove any selections before adding */ + gl_view_unselect_all (view); + } + } + /* Add to current selection */ + select_object (view_object); + /* bring up apropriate menu for selection. */ + popup_selection_menu (view, view_object, event); + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + /* Exit dragging mode */ + gnome_canvas_item_ungrab (item, event->button.time); + dragging = FALSE; + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + /* Dragging mode, move selection */ + new_x = item_x; + new_y = item_y; + move_selected_items (view, (new_x - x), (new_y - y)); + x = new_x; + y = new_y; + return TRUE; + } else { + return FALSE; + } + + case GDK_2BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "2BUTTON_PRESS"); + switch (event->button.button) { + case 1: + /* Also exit dragging mode w/ double-click, run dlg */ + gnome_canvas_item_ungrab (item, event->button.time); + dragging = FALSE; + select_object (view_object); + gl_view_object_show_dialog (view_object); + return TRUE; + + default: + return FALSE; + } + + case GDK_ENTER_NOTIFY: + gl_debug (DEBUG_VIEW, "ENTER_NOTIFY"); + cursor = gdk_cursor_new (GDK_FLEUR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + gl_debug (DEBUG_VIEW, "LEAVE_NOTIFY"); + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + gl_debug (DEBUG_VIEW, "default"); + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. create menu for multiple selections. */ +/*---------------------------------------------------------------------------*/ +GtkWidget * +new_selection_menu (glView * view) +{ + GtkWidget *menu, *menuitem; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_val_if_fail (GL_IS_VIEW (view), NULL); + + menu = gtk_menu_new (); + + menuitem = gtk_menu_item_new_with_label (_("Delete")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_view_delete_selection), view); + + menuitem = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Bring to front")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect (G_OBJECT (menuitem), "activate", + G_CALLBACK (raise_selection_cb), view); + + menuitem = gtk_menu_item_new_with_label (_("Send to back")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect (G_OBJECT (menuitem), "activate", + G_CALLBACK (lower_selection_cb), view); + + gl_debug (DEBUG_VIEW, "END"); + + return menu; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. popup menu for given item. */ +/*---------------------------------------------------------------------------*/ +static void +popup_selection_menu (glView *view, + glViewObject *view_object, + GdkEvent *event) +{ + GtkMenu *menu; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + if (multiple_items_selected (view)) { + if (view->menu != NULL) { + gtk_menu_popup (GTK_MENU (view->menu), + NULL, NULL, NULL, NULL, + event->button.button, + event->button.time); + } + } else { + + menu = gl_view_object_get_menu (view_object); + if (menu != NULL) { + gtk_menu_popup (GTK_MENU (menu), + NULL, NULL, NULL, NULL, + event->button.button, + event->button.time); + } + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Delete selected objects. */ +/*---------------------------------------------------------------------------*/ +void +gl_view_delete_selection (glView * view) +{ + GList *p, *p_next; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p_next) { + p_next = p->next; + g_object_unref (G_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. raise item to front callback. */ +/*---------------------------------------------------------------------------*/ +static void +raise_selection_cb (GtkWidget * widget, + glView * view) +{ + GList *p; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + gl_label_object_raise_to_top (GL_LABEL_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. lower item to back callback. */ +/*---------------------------------------------------------------------------*/ +static void +lower_selection_cb (GtkWidget * widget, + glView * view) +{ + GList *p; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + gl_label_object_lower_to_bottom (GL_LABEL_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. move selected items */ +/*---------------------------------------------------------------------------*/ +static void +move_selected_items (glView * view, + gdouble dx, + gdouble dy) +{ + GList *p; + glLabelObject *object; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + + object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data)); + gl_label_object_set_position_relative (object, dx, dy); + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-clear" signal. */ +/*---------------------------------------------------------------------------*/ +static void +selection_clear_cb (GtkWidget * widget, + GdkEventSelection * event, + gpointer data) +{ + glView *view = GL_VIEW (data); + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + view->have_selection = FALSE; + g_object_unref (view->selection_data); + view->selection_data = NULL; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-get" signal. */ +/*---------------------------------------------------------------------------*/ +static void +selection_get_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint info, + guint time, + gpointer data) +{ + glView *view = GL_VIEW (data); + gchar *buffer; + glXMLLabelStatus status; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (view->have_selection) { + + buffer = gl_xml_label_save_buffer (view->selection_data, + &status); + gtk_selection_data_set (selection_data, + GDK_SELECTION_TYPE_STRING, 8, buffer, + strlen (buffer)); + g_free (buffer); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-received" signal. (Result of Paste) */ +/*---------------------------------------------------------------------------*/ +static void +selection_received_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint time, + gpointer data) +{ + glView *view = GL_VIEW (data); + glLabel *label = NULL; + glXMLLabelStatus status; + GList *p, *p_next; + glLabelObject *object, *newobject; + glViewObject *view_object; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (selection_data->length < 0) { + return; + } + if (selection_data->type != GDK_SELECTION_TYPE_STRING) { + return; + } + + gl_view_unselect_all (view); + + label = gl_xml_label_open_buffer (selection_data->data, &status); + for (p = label->objects; p != NULL; p = p_next) { + p_next = p->next; + + object = (glLabelObject *) p->data; + gl_label_object_set_parent (object, view->label); + + gl_debug (DEBUG_VIEW, "object pasted"); + + if (GL_IS_LABEL_BOX (object)) { + view_object = gl_view_box_new (GL_LABEL_BOX(object), + view); + } else if (GL_IS_LABEL_ELLIPSE (object)) { + view_object = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), + view); + } else if (GL_IS_LABEL_LINE (object)) { + view_object = gl_view_line_new (GL_LABEL_LINE(object), + view); + } else if (GL_IS_LABEL_IMAGE (object)) { + view_object = gl_view_image_new (GL_LABEL_IMAGE(object), + view); + } else if (GL_IS_LABEL_TEXT (object)) { + view_object = gl_view_text_new (GL_LABEL_TEXT(object), + view); + } else if (GL_IS_LABEL_BARCODE (object)) { + view_object = gl_view_barcode_new (GL_LABEL_BARCODE(object), + view); + } else { + /* Should not happen! */ + view_object = NULL; + g_warning ("Invalid label object type."); + } + select_object (view_object); + } + g_object_unref (label); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Zoom in one "notch" */ +/*****************************************************************************/ +void +gl_view_zoom_in (glView * view) +{ + gint i, i_min; + gdouble dist, dist_min; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + /* Find index of current scale (or best match) */ + i_min = 1; /* start with 2nd largest scale */ + dist_min = fabs (scales[1] - view->scale); + for (i = 2; scales[i] != 0.0; i++) { + dist = fabs (scales[i] - view->scale); + if (dist < dist_min) { + i_min = i; + dist_min = dist; + } + } + + /* zoom in one "notch" */ + i = MAX (0, i_min - 1); + gl_view_set_zoom (view, scales[i] / HOME_SCALE); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Zoom out one "notch" */ +/*****************************************************************************/ +void +gl_view_zoom_out (glView * view) +{ + gint i, i_min; + gdouble dist, dist_min; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + /* Find index of current scale (or best match) */ + i_min = 0; /* start with largest scale */ + dist_min = fabs (scales[0] - view->scale); + for (i = 1; scales[i] != 0.0; i++) { + dist = fabs (scales[i] - view->scale); + if (dist < dist_min) { + i_min = i; + dist_min = dist; + } + } + + /* zoom out one "notch" */ + if (scales[i_min] == 0.0) + return; + i = i_min + 1; + if (scales[i] == 0.0) + return; + gl_view_set_zoom (view, scales[i] / HOME_SCALE); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set current zoom factor to explicit value. */ +/*****************************************************************************/ +void +gl_view_set_zoom (glView * view, + gdouble scale) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (scale > 0.0); + + view->scale = scale * HOME_SCALE; + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas), + scale * HOME_SCALE); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Get current zoom factor. */ +/*****************************************************************************/ +gdouble +gl_view_get_zoom (glView * view) +{ + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW (view), 1.0); + + return view->scale / HOME_SCALE; +} diff --git a/glabels2/src/view.h b/glabels2/src/view.h new file mode 100644 index 00000000..813c0842 --- /dev/null +++ b/glabels2/src/view.h @@ -0,0 +1,101 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view.h: GLabels View module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_H__ +#define __VIEW_H__ + +#include +#include + +#include "label-object.h" + +typedef enum { + GL_VIEW_STATE_ARROW, + GL_VIEW_STATE_OBJECT_CREATE +} glViewState; + +#define GL_TYPE_VIEW (gl_view_get_type ()) +#define GL_VIEW(obj) (GTK_CHECK_CAST((obj), GL_TYPE_VIEW, glView )) +#define GL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW, glViewClass)) +#define GL_IS_VIEW(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_VIEW)) +#define GL_IS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW)) + +typedef struct _glView glView; +typedef struct _glViewClass glViewClass; + +#include "view-object.h" + +struct _glView { + GtkVBox parent_widget; + + glLabel *label; + + GtkWidget *canvas; + gdouble scale; + gint n_bg_items; + GList *bg_item_list; + + glViewState state; + glLabelObjectType create_type; + + GList *object_list; + GList *selected_object_list; + + gint have_selection; + glLabel *selection_data; + GtkWidget *invisible; + + GtkWidget *menu; +}; + +struct _glViewClass { + GtkVBoxClass parent_class; +}; + +extern guint gl_view_get_type (void); + +extern GtkWidget *gl_view_new (glLabel * label); + +extern void gl_view_arrow_mode (glView * view); +extern void gl_view_object_create_mode (glView * view, + glLabelObjectType type); + +extern void gl_view_select_object (glView *view, glViewObject *view_object); +extern void gl_view_select_all (glView *view); +extern void gl_view_unselect_all (glView *view); +extern void gl_view_delete_selection (glView *view); + + +extern int gl_view_item_event_handler (GnomeCanvasItem * item, + GdkEvent * event, + glViewObject *view_object); + +extern void gl_view_cut (glView * view); +extern void gl_view_copy (glView * view); +extern void gl_view_paste (glView * view); + +extern void gl_view_zoom_in (glView * view); +extern void gl_view_zoom_out (glView * view); +extern void gl_view_set_zoom (glView * view, gdouble scale); +extern gdouble gl_view_get_zoom (glView * view); + +#endif diff --git a/glabels2/src/wdgt-bc-data.c b/glabels2/src/wdgt-bc-data.c new file mode 100644 index 00000000..7093cc45 --- /dev/null +++ b/glabels2/src/wdgt-bc-data.c @@ -0,0 +1,338 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_data.c: barcode data widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-bc-data.h" +#include "merge.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtBCDataSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_bc_data_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_bc_data_class_init (glWdgtBCDataClass * class); +static void gl_wdgt_bc_data_instance_init (glWdgtBCData * bc_data); +static void gl_wdgt_bc_data_finalize (GObject * object); +static void gl_wdgt_bc_data_construct (glWdgtBCData * bc_data, + gchar * label, GList * field_defs); + +static void changed_cb (glWdgtBCData * bc_data); +static void radio_toggled_cb (GtkToggleButton * togglebutton, + glWdgtBCData * bc_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_bc_data_get_type (void) +{ + static guint wdgt_bc_data_type = 0; + + if (!wdgt_bc_data_type) { + GTypeInfo wdgt_bc_data_info = { + sizeof (glWdgtBCDataClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_bc_data_class_init, + NULL, + NULL, + sizeof (glWdgtBCData), + 0, + (GInstanceInitFunc) gl_wdgt_bc_data_instance_init, + }; + + wdgt_bc_data_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtBCData", + &wdgt_bc_data_info, 0); + } + + return wdgt_bc_data_type; +} + +static void +gl_wdgt_bc_data_class_init (glWdgtBCDataClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_bc_data_finalize; + + wdgt_bc_data_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtBCDataClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_bc_data_instance_init (glWdgtBCData * bc_data) +{ + bc_data->literal_radio = NULL; + bc_data->literal_entry = NULL; + + bc_data->key_radio = NULL; + bc_data->key_entry = NULL; +} + +static void +gl_wdgt_bc_data_finalize (GObject * object) +{ + glWdgtBCData *bc_data; + glWdgtBCDataClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_BC_DATA (object)); + + bc_data = GL_WDGT_BC_DATA (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_bc_data_new (gchar * label, + GList * field_defs) +{ + glWdgtBCData *bc_data; + + bc_data = g_object_new (gl_wdgt_bc_data_get_type (), NULL); + + gl_wdgt_bc_data_construct (bc_data, label, field_defs); + + return GTK_WIDGET (bc_data); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_bc_data_construct (glWdgtBCData * bc_data, + gchar * label, + GList * field_defs) +{ + GtkWidget *wvbox, *wframe, *wtable, *wcombo; + GSList *radio_group = NULL; + GList *keys; + + wvbox = GTK_WIDGET (bc_data); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Literal radio */ + bc_data->literal_radio = gtk_radio_button_new_with_label (radio_group, + _ + ("Literal:")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (bc_data->literal_radio)); + g_signal_connect (G_OBJECT (bc_data->literal_radio), "toggled", + G_CALLBACK (radio_toggled_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), bc_data->literal_radio, + 0, 1, 0, 1); + + /* Literal entry widget */ + bc_data->literal_entry = gtk_entry_new (); + gtk_widget_set_size_request (bc_data->literal_entry, 200, -1); + g_signal_connect_swapped (G_OBJECT (bc_data->literal_entry), + "changed", G_CALLBACK (changed_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), bc_data->literal_entry, + 1, 2, 0, 1); + + /* Key radio */ + bc_data->key_radio = gtk_radio_button_new_with_label (radio_group, + _("Key:")); + g_signal_connect (G_OBJECT (bc_data->key_radio), "toggled", + G_CALLBACK (radio_toggled_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), bc_data->key_radio, + 0, 1, 1, 2); + + /* Key entry widget */ + wcombo = gtk_combo_new (); + keys = gl_merge_get_key_list (field_defs); + if (keys != NULL) + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), keys); + gl_merge_free_key_list (&keys); + bc_data->key_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (bc_data->key_entry), FALSE); + gtk_widget_set_size_request (wcombo, 200, -1); + g_signal_connect_swapped (G_OBJECT (bc_data->key_entry), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), wcombo, 1, 2, 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtBCData * bc_data) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback to handle toggling of radio buttons */ +/*--------------------------------------------------------------------------*/ +static void +radio_toggled_cb (GtkToggleButton * togglebutton, + glWdgtBCData * bc_data) +{ + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) { + gtk_widget_set_sensitive (bc_data->literal_entry, TRUE); + gtk_widget_set_sensitive (bc_data->key_entry, FALSE); + } else { + gtk_widget_set_sensitive (bc_data->literal_entry, FALSE); + gtk_widget_set_sensitive (bc_data->key_entry, TRUE); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0); +} + +/*--------------------------------------------------------------------------*/ +/* Get widget data. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_wdgt_bc_data_get_data (glWdgtBCData * bc_data) +{ + glTextNode *text_node; + + text_node = g_new0(glTextNode,1); + + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) { + text_node->field_flag = FALSE; + text_node->data = + gtk_editable_get_chars (GTK_EDITABLE + (bc_data->literal_entry), 0, -1); + } else { + text_node->field_flag = TRUE; + text_node->data = + gtk_editable_get_chars (GTK_EDITABLE (bc_data->key_entry), + 0, -1); + } +} + +/*--------------------------------------------------------------------------*/ +/* Set widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_wdgt_bc_data_set_data (glWdgtBCData * bc_data, + gboolean merge_flag, + glTextNode *text_node) +{ + gint pos; + + gtk_widget_set_sensitive (bc_data->key_radio, merge_flag); + + if (!text_node->field_flag) { + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (bc_data->literal_radio), TRUE); + + gtk_widget_set_sensitive (bc_data->literal_entry, TRUE); + gtk_widget_set_sensitive (bc_data->key_entry, FALSE); + + g_signal_handlers_block_by_func (G_OBJECT + (bc_data->literal_entry), + G_CALLBACK (changed_cb), + bc_data); + gtk_editable_delete_text (GTK_EDITABLE (bc_data->literal_entry), + 0, -1); + g_signal_handlers_unblock_by_func (G_OBJECT + (bc_data->literal_entry), + G_CALLBACK + (changed_cb), bc_data); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (bc_data->literal_entry), + text_node->data, + strlen (text_node->data), + &pos); + } else { + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (bc_data->key_radio), TRUE); + + gtk_widget_set_sensitive (bc_data->literal_entry, FALSE); + gtk_widget_set_sensitive (bc_data->key_entry, TRUE); + + g_signal_handlers_block_by_func (G_OBJECT + (bc_data->key_entry), + G_CALLBACK (changed_cb), + bc_data); + gtk_editable_delete_text (GTK_EDITABLE (bc_data->key_entry), 0, + -1); + g_signal_handlers_unblock_by_func (G_OBJECT + (bc_data->key_entry), + G_CALLBACK + (changed_cb), bc_data); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (bc_data->key_entry), + text_node->data, + strlen (text_node->data), + &pos); + } + +} diff --git a/glabels2/src/wdgt-bc-data.h b/glabels2/src/wdgt-bc-data.h new file mode 100644 index 00000000..e7771b23 --- /dev/null +++ b/glabels2/src/wdgt-bc-data.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_data.h: barcode data widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_BC_DATA_H__ +#define __WDGT_BC_DATA_H__ + +#include +#include "text-node.h" + +#define GL_TYPE_WDGT_BC_DATA (gl_wdgt_bc_data_get_type ()) +#define GL_WDGT_BC_DATA(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_DATA, glWdgtBCData )) +#define GL_WDGT_BC_DATA_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_DATA, glWdgtBCDataClass)) +#define GL_IS_WDGT_BC_DATA(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_DATA)) +#define GL_IS_WDGT_BC_DATA_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_DATA)) + +typedef struct _glWdgtBCData glWdgtBCData; +typedef struct _glWdgtBCDataClass glWdgtBCDataClass; + +struct _glWdgtBCData { + GtkVBox parent_widget; + + GtkWidget *literal_radio; + GtkWidget *literal_entry; + + GtkWidget *key_radio; + GtkWidget *key_entry; +}; + +struct _glWdgtBCDataClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtBCData * bc_data, gpointer user_data); +}; + +extern guint gl_wdgt_bc_data_get_type (void); + +extern GtkWidget *gl_wdgt_bc_data_new (gchar * label, GList * field_defs); + +extern glTextNode *gl_wdgt_bc_data_get_data (glWdgtBCData * bc_data); + +extern void gl_wdgt_bc_data_set_data (glWdgtBCData * bc_data, + gboolean merge_flag, + glTextNode *text_node); + +#endif diff --git a/glabels2/src/wdgt-bc-props.c b/glabels2/src/wdgt-bc-props.c new file mode 100644 index 00000000..ed4ddbcd --- /dev/null +++ b/glabels2/src/wdgt-bc-props.c @@ -0,0 +1,250 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_props.c: barcode properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-bc-props.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtBCPropsSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_bc_props_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_bc_props_class_init (glWdgtBCPropsClass * class); +static void gl_wdgt_bc_props_instance_init (glWdgtBCProps * prop); +static void gl_wdgt_bc_props_finalize (GObject * object); +static void gl_wdgt_bc_props_construct (glWdgtBCProps * prop, gchar * label); +static void changed_cb (glWdgtBCProps * prop); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_bc_props_get_type (void) +{ + static guint wdgt_bc_props_type = 0; + + if (!wdgt_bc_props_type) { + GTypeInfo wdgt_bc_props_info = { + sizeof (glWdgtBCPropsClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_bc_props_class_init, + NULL, + NULL, + sizeof (glWdgtBCProps), + 0, + (GInstanceInitFunc) gl_wdgt_bc_props_instance_init, + }; + + wdgt_bc_props_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtBCProps", &wdgt_bc_props_info, 0); + } + + return wdgt_bc_props_type; +} + +static void +gl_wdgt_bc_props_class_init (glWdgtBCPropsClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_bc_props_finalize; + + wdgt_bc_props_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtBCPropsClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_bc_props_instance_init (glWdgtBCProps * prop) +{ + prop->scale_spin = NULL; + prop->color_picker = NULL; +} + +static void +gl_wdgt_bc_props_finalize (GObject * object) +{ + glWdgtBCProps *prop; + glWdgtBCPropsClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_BC_PROPS (object)); + + prop = GL_WDGT_BC_PROPS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_bc_props_new (gchar * label) +{ + glWdgtBCProps *prop; + + prop = g_object_new (gl_wdgt_bc_props_get_type (), NULL); + + gl_wdgt_bc_props_construct (prop, label); + + return GTK_WIDGET (prop); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_bc_props_construct (glWdgtBCProps * prop, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *adjust; + + wvbox = GTK_WIDGET (prop); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Scale Label */ + wlabel = gtk_label_new (_("Scale:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* Scale widget */ + adjust = gtk_adjustment_new (100.0, 50.0, 200.0, 10.0, 10.0, 10.0); + prop->scale_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 10.0, 0); + g_signal_connect_swapped (G_OBJECT (prop->scale_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + gtk_table_attach_defaults (GTK_TABLE (wtable), prop->scale_spin, 1, 2, + 0, 1); + /* % Label */ + wlabel = gtk_label_new (_("%")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 2, 3, 0, 1); + + /* Line Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Line Color picker widget */ + prop->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (prop->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + gtk_table_attach_defaults (GTK_TABLE (wtable), prop->color_picker, 1, 3, + 1, 2); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtBCProps * prop) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (prop), wdgt_bc_props_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_props_get_params (glWdgtBCProps * prop, + gdouble * scale, + guint * color) +{ + guint8 r, g, b, a; + + /* ------- Get updated scale ------ */ + *scale = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(prop->scale_spin)); + *scale /= 100.0; + + /* ------- Get updated line color ------ */ + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (prop->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); + +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_props_set_params (glWdgtBCProps * prop, + gdouble scale, + guint color) +{ + scale *= 100.0; + gtk_spin_button_set_value (GTK_SPIN_BUTTON (prop->scale_spin), scale); + + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (prop->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); + +} diff --git a/glabels2/src/wdgt-bc-props.h b/glabels2/src/wdgt-bc-props.h new file mode 100644 index 00000000..1f67cd87 --- /dev/null +++ b/glabels2/src/wdgt-bc-props.h @@ -0,0 +1,67 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_props.h: barcode properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_BC_PROPS_H__ +#define __WDGT_BC_PROPS_H__ + +#include +#include "bc.h" + +#define GL_TYPE_WDGT_BC_PROPS (gl_wdgt_bc_props_get_type ()) +#define GL_WDGT_BC_PROPS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_PROPS, glWdgtBCProps )) +#define GL_WDGT_BC_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_PROPS, glWdgtBCPropsClass)) +#define GL_IS_WDGT_BC_PROPS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_PROPS)) +#define GL_IS_WDGT_BC_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_PROPS)) + +typedef struct _glWdgtBCProps glWdgtBCProps; +typedef struct _glWdgtBCPropsClass glWdgtBCPropsClass; + +struct _glWdgtBCProps { + GtkVBox parent_widget; + + GtkWidget *scale_spin; + GtkWidget *color_picker; +}; + +struct _glWdgtBCPropsClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtBCProps * prop, gpointer user_data); +}; + +extern guint gl_wdgt_bc_props_get_type (void); + +extern GtkWidget *gl_wdgt_bc_props_new (gchar * label); + +extern void gl_wdgt_bc_props_get_params (glWdgtBCProps * prop, + gdouble * scale, + guint * color); + +extern void gl_wdgt_bc_props_set_params (glWdgtBCProps * prop, + gdouble scale, + guint color); + +#endif diff --git a/glabels2/src/wdgt-bc-style.c b/glabels2/src/wdgt-bc-style.c new file mode 100644 index 00000000..07049a3e --- /dev/null +++ b/glabels2/src/wdgt-bc-style.c @@ -0,0 +1,463 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_style.c: barcode style selection widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-bc-style.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtBCStyleSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_bc_style_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_bc_style_class_init (glWdgtBCStyleClass * class); +static void gl_wdgt_bc_style_instance_init (glWdgtBCStyle * prop_style); +static void gl_wdgt_bc_style_finalize (GObject * object); +static void gl_wdgt_bc_style_construct (glWdgtBCStyle * prop_style, + gchar * label); +static void changed_cb (glWdgtBCStyle * prop_style); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_bc_style_get_type (void) +{ + static guint wdgt_bc_style_type = 0; + + if (!wdgt_bc_style_type) { + GTypeInfo wdgt_bc_style_info = { + sizeof (glWdgtBCStyleClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_bc_style_class_init, + NULL, + NULL, + sizeof (glWdgtBCStyle), + 0, + (GInstanceInitFunc) gl_wdgt_bc_style_instance_init, + }; + + wdgt_bc_style_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtBCStyle", + &wdgt_bc_style_info, 0); + } + + return wdgt_bc_style_type; +} + +static void +gl_wdgt_bc_style_class_init (glWdgtBCStyleClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_bc_style_finalize; + + wdgt_bc_style_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtBCStyleClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_bc_style_instance_init (glWdgtBCStyle * prop_style) +{ + prop_style->postnet_radio = NULL; + prop_style->ean_radio = NULL; + prop_style->upc_radio = NULL; + prop_style->isbn_radio = NULL; + prop_style->code39_radio = NULL; + prop_style->code128_radio = NULL; + prop_style->code128c_radio = NULL; + prop_style->code128b_radio = NULL; + prop_style->i25_radio = NULL; + prop_style->cbr_radio = NULL; + prop_style->msi_radio = NULL; + prop_style->pls_radio = NULL; +} + +static void +gl_wdgt_bc_style_finalize (GObject * object) +{ + glWdgtBCStyle *prop_style; + glWdgtBCStyleClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_BC_STYLE (object)); + + prop_style = GL_WDGT_BC_STYLE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_bc_style_new (gchar * label) +{ + glWdgtBCStyle *prop_style; + + prop_style = g_object_new (gl_wdgt_bc_style_get_type (), NULL); + + gl_wdgt_bc_style_construct (prop_style, label); + + return GTK_WIDGET (prop_style); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_bc_style_construct (glWdgtBCStyle * prop, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wvbox1, *whbox2, *wvbox2; + GSList *radio_group = NULL; + + wvbox = GTK_WIDGET (prop); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox1), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox1); + + whbox2 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_container_add (GTK_CONTAINER (wvbox1), whbox2); + + /* ... Start column ... */ + wvbox2 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox2), 10); + gtk_box_pack_start (GTK_BOX (whbox2), wvbox2, FALSE, FALSE, 0); + + /* POSTNET button */ + prop->postnet_radio = + gtk_radio_button_new_with_label (radio_group, "POSTNET"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->postnet_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->postnet_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->postnet_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* EAN button */ + prop->ean_radio = gtk_radio_button_new_with_label (radio_group, "EAN"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->ean_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->ean_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->ean_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* UPC button */ + prop->upc_radio = gtk_radio_button_new_with_label (radio_group, "UPC"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->upc_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->upc_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->upc_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* ISBN button */ + prop->isbn_radio = + gtk_radio_button_new_with_label (radio_group, "ISBN"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->isbn_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->isbn_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->isbn_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CODE39 button */ + prop->code39_radio = + gtk_radio_button_new_with_label (radio_group, "Code 39"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code39_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code39_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code39_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CODE128 button */ + prop->code128_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code128_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code128_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* ... Start column ... */ + wvbox2 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox2), 10); + gtk_box_pack_start (GTK_BOX (whbox2), wvbox2, FALSE, FALSE, 0); + + /* CODE128B button */ + prop->code128b_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128-B"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code128b_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128b_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code128b_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CODE128C button */ + prop->code128c_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128-C"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code128c_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128c_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code128c_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* I25 button */ + prop->i25_radio = + gtk_radio_button_new_with_label (radio_group, "Interleaved 2 of 5"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->i25_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->i25_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->i25_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CBR button */ + prop->cbr_radio = + gtk_radio_button_new_with_label (radio_group, "Codabar"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->cbr_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->cbr_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->cbr_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* MSI button */ + prop->msi_radio = gtk_radio_button_new_with_label (radio_group, "MSI"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->msi_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->msi_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->msi_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* PLS button */ + prop->pls_radio = + gtk_radio_button_new_with_label (radio_group, "Plessey"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->pls_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->pls_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->pls_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* ... Separator ... */ + gtk_box_pack_start (GTK_BOX (wvbox1), gtk_hseparator_new (), FALSE, + FALSE, 0); + + /* Text checkbox widget */ + prop->text_check = + gtk_check_button_new_with_label (_("Show text with barcode")); + gtk_box_pack_start (GTK_BOX (wvbox1), prop->text_check, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->text_check), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtBCStyle * prop_style) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (prop_style), + wdgt_bc_style_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_style_get_params (glWdgtBCStyle * prop, + glBarcodeStyle * style, + gboolean * text_flag) +{ + *text_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop->text_check)); + + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->postnet_radio))) { + *style = GL_BARCODE_STYLE_POSTNET; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->ean_radio))) { + *style = GL_BARCODE_STYLE_EAN; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->upc_radio))) { + *style = GL_BARCODE_STYLE_UPC; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->isbn_radio))) { + *style = GL_BARCODE_STYLE_ISBN; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code39_radio))) { + *style = GL_BARCODE_STYLE_39; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code128_radio))) { + *style = GL_BARCODE_STYLE_128; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code128c_radio))) { + *style = GL_BARCODE_STYLE_128C; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code128b_radio))) { + *style = GL_BARCODE_STYLE_128B; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->i25_radio))) { + *style = GL_BARCODE_STYLE_I25; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->cbr_radio))) { + *style = GL_BARCODE_STYLE_CBR; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->msi_radio))) { + *style = GL_BARCODE_STYLE_MSI; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->pls_radio))) { + *style = GL_BARCODE_STYLE_PLS; + } + +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_style_set_params (glWdgtBCStyle * prop, + glBarcodeStyle style, + gboolean text_flag) +{ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop->text_check), + text_flag); + + switch (style) { + case GL_BARCODE_STYLE_POSTNET: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->postnet_radio), TRUE); + break; + case GL_BARCODE_STYLE_EAN: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->ean_radio), TRUE); + break; + case GL_BARCODE_STYLE_UPC: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->upc_radio), TRUE); + break; + case GL_BARCODE_STYLE_ISBN: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->isbn_radio), TRUE); + break; + case GL_BARCODE_STYLE_39: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code39_radio), TRUE); + break; + case GL_BARCODE_STYLE_128: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code128_radio), TRUE); + break; + case GL_BARCODE_STYLE_128C: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code128c_radio), TRUE); + break; + case GL_BARCODE_STYLE_128B: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code128b_radio), TRUE); + break; + case GL_BARCODE_STYLE_I25: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->i25_radio), TRUE); + break; + case GL_BARCODE_STYLE_CBR: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->cbr_radio), TRUE); + break; + case GL_BARCODE_STYLE_MSI: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->msi_radio), TRUE); + break; + case GL_BARCODE_STYLE_PLS: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->pls_radio), TRUE); + break; + default: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->postnet_radio), TRUE); + break; + } +} diff --git a/glabels2/src/wdgt-bc-style.h b/glabels2/src/wdgt-bc-style.h new file mode 100644 index 00000000..78c98634 --- /dev/null +++ b/glabels2/src/wdgt-bc-style.h @@ -0,0 +1,79 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_style.h: barcode style selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_BC_STYLE_H__ +#define __WDGT_BC_STYLE_H__ + +#include +#include "bc.h" + +#define GL_TYPE_WDGT_BC_STYLE (gl_wdgt_bc_style_get_type ()) +#define GL_WDGT_BC_STYLE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_STYLE, glWdgtBCStyle )) +#define GL_WDGT_BC_STYLE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_STYLE, glWdgtBCStyleClass)) +#define GL_IS_WDGT_BC_STYLE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_STYLE)) +#define GL_IS_WDGT_BC_STYLE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_STYLE)) + +typedef struct _glWdgtBCStyle glWdgtBCStyle; +typedef struct _glWdgtBCStyleClass glWdgtBCStyleClass; + +struct _glWdgtBCStyle { + GtkVBox parent_widget; + + GtkWidget *postnet_radio; + GtkWidget *ean_radio; + GtkWidget *upc_radio; + GtkWidget *isbn_radio; + GtkWidget *code39_radio; + GtkWidget *code128_radio; + GtkWidget *code128c_radio; + GtkWidget *code128b_radio; + GtkWidget *i25_radio; + GtkWidget *cbr_radio; + GtkWidget *msi_radio; + GtkWidget *pls_radio; + + GtkWidget *text_check; +}; + +struct _glWdgtBCStyleClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtBCStyle * prop, gpointer user_data); +}; + +extern guint gl_wdgt_bc_style_get_type (void); + +extern GtkWidget *gl_wdgt_bc_style_new (gchar * label); + +extern void gl_wdgt_bc_style_get_params (glWdgtBCStyle * prop_style, + glBarcodeStyle * style, + gboolean * text_flag); + +extern void gl_wdgt_bc_style_set_params (glWdgtBCStyle * prop_style, + glBarcodeStyle style, + gboolean text_flag); + +#endif diff --git a/glabels2/src/wdgt-fill.c b/glabels2/src/wdgt-fill.c new file mode 100644 index 00000000..3a49ca92 --- /dev/null +++ b/glabels2/src/wdgt-fill.c @@ -0,0 +1,218 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_fill.c: fill properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-fill.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtFillSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_fill_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_fill_class_init (glWdgtFillClass * class); +static void gl_wdgt_fill_instance_init (glWdgtFill * fill); +static void gl_wdgt_fill_finalize (GObject * object); +static void gl_wdgt_fill_construct (glWdgtFill * fill, gchar * label); +static void changed_cb (glWdgtFill * fill); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_fill_get_type (void) +{ + static guint wdgt_fill_type = 0; + + if (!wdgt_fill_type) { + GTypeInfo wdgt_fill_info = { + sizeof (glWdgtFillClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_fill_class_init, + NULL, + NULL, + sizeof (glWdgtFill), + 0, + (GInstanceInitFunc) gl_wdgt_fill_instance_init, + }; + + wdgt_fill_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtFill", + &wdgt_fill_info, 0); + } + + return wdgt_fill_type; +} + +static void +gl_wdgt_fill_class_init (glWdgtFillClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_fill_finalize; + + wdgt_fill_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtFillClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_fill_instance_init (glWdgtFill * fill) +{ + fill->color_picker = NULL; +} + +static void +gl_wdgt_fill_finalize (GObject * object) +{ + glWdgtFill *fill; + glWdgtFillClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_FILL (object)); + + fill = GL_WDGT_FILL (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_fill_new (gchar * label) +{ + glWdgtFill *fill; + + fill = g_object_new (gl_wdgt_fill_get_type (), NULL); + + gl_wdgt_fill_construct (fill, label); + + return GTK_WIDGET (fill); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_fill_construct (glWdgtFill * fill, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + + wvbox = GTK_WIDGET (fill); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (1, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Fill Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + /* Fill Color picker widget */ + fill->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (fill->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (fill)); + gtk_table_attach_defaults (GTK_TABLE (wtable), fill->color_picker, 1, 3, + 0, 1); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtFill * fill) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (fill), wdgt_fill_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_fill_get_params (glWdgtFill * fill, + guint * color) +{ + guint8 r, g, b, a; + + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (fill->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_fill_set_params (glWdgtFill * fill, + guint color) +{ + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (fill->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); +} diff --git a/glabels2/src/wdgt-fill.h b/glabels2/src/wdgt-fill.h new file mode 100644 index 00000000..db1d8dac --- /dev/null +++ b/glabels2/src/wdgt-fill.h @@ -0,0 +1,62 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_fill.h: fill properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_FILL_H__ +#define __WDGT_FILL_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_FILL (gl_wdgt_fill_get_type ()) +#define GL_WDGT_FILL(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_FILL, glWdgtFill )) +#define GL_WDGT_FILL_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_FILL, glWdgtFillClass)) +#define GL_IS_WDGT_FILL(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_FILL)) +#define GL_IS_WDGT_FILL_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_FILL)) + +typedef struct _glWdgtFill glWdgtFill; +typedef struct _glWdgtFillClass glWdgtFillClass; + +struct _glWdgtFill { + GtkVBox parent_widget; + + GtkWidget *color_picker; +}; + +struct _glWdgtFillClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtFill * fill, gpointer user_data); +}; + +extern guint gl_wdgt_fill_get_type (void); + +extern GtkWidget *gl_wdgt_fill_new (gchar * label); + +extern void gl_wdgt_fill_get_params (glWdgtFill * fill, guint * color); + +extern void gl_wdgt_fill_set_params (glWdgtFill * fill, guint color); + +#endif diff --git a/glabels2/src/wdgt-line.c b/glabels2/src/wdgt-line.c new file mode 100644 index 00000000..71e369a0 --- /dev/null +++ b/glabels2/src/wdgt-line.c @@ -0,0 +1,247 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_line.c: line properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-line.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtLineSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_line_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_line_class_init (glWdgtLineClass * class); +static void gl_wdgt_line_instance_init (glWdgtLine * line); +static void gl_wdgt_line_finalize (GObject * object); +static void gl_wdgt_line_construct (glWdgtLine * line, gchar * label); +static void changed_cb (glWdgtLine * line); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_line_get_type (void) +{ + static guint wdgt_line_type = 0; + + if (!wdgt_line_type) { + GTypeInfo wdgt_line_info = { + sizeof (glWdgtLineClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_line_class_init, + NULL, + NULL, + sizeof (glWdgtLine), + 0, + (GInstanceInitFunc) gl_wdgt_line_instance_init, + }; + + wdgt_line_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtLine", + &wdgt_line_info, 0); + } + + return wdgt_line_type; +} + +static void +gl_wdgt_line_class_init (glWdgtLineClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_line_finalize; + + wdgt_line_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtLineClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_line_instance_init (glWdgtLine * line) +{ + line->width_spin = NULL; + line->color_picker = NULL; + line->units_label = NULL; +} + +static void +gl_wdgt_line_finalize (GObject * object) +{ + glWdgtLine *line; + glWdgtLineClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_LINE (object)); + + line = GL_WDGT_LINE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_line_new (gchar * label) +{ + glWdgtLine *line; + + line = g_object_new (gl_wdgt_line_get_type (), NULL); + + gl_wdgt_line_construct (line, label); + + return GTK_WIDGET (line); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_line_construct (glWdgtLine * line, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *adjust; + + wvbox = GTK_WIDGET (line); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Line Width Label */ + wlabel = gtk_label_new (_("Width:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* Line Width widget */ + adjust = gtk_adjustment_new (1.0, 0.25, 4.0, 0.25, 1.0, 1.0); + line->width_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 0.25, 2); + g_signal_connect_swapped (G_OBJECT (line->width_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (line)); + gtk_table_attach_defaults (GTK_TABLE (wtable), line->width_spin, 1, 2, + 0, 1); + /* Line Width units */ + line->units_label = gtk_label_new (_("points")); + gtk_misc_set_alignment (GTK_MISC (line->units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), line->units_label, + 2, 3, 0, 1); + + /* Line Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Line Color picker widget */ + line->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (line->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (line)); + gtk_table_attach_defaults (GTK_TABLE (wtable), line->color_picker, 1, 3, + 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtLine * line) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (line), wdgt_line_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_line_get_params (glWdgtLine * line, + gdouble * width, + guint * color) +{ + guint8 r, g, b, a; + + *width = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (line->width_spin)); + + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (line->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_line_set_params (glWdgtLine * line, + gdouble width, + guint color) +{ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (line->width_spin), width); + + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (line->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); +} diff --git a/glabels2/src/wdgt-line.h b/glabels2/src/wdgt-line.h new file mode 100644 index 00000000..eec143f3 --- /dev/null +++ b/glabels2/src/wdgt-line.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_line.h: line properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_LINE_H__ +#define __WDGT_LINE_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_LINE (gl_wdgt_line_get_type ()) +#define GL_WDGT_LINE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_LINE, glWdgtLine )) +#define GL_WDGT_LINE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_LINE, glWdgtLineClass)) +#define GL_IS_WDGT_LINE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_LINE)) +#define GL_IS_WDGT_LINE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_LINE)) + +typedef struct _glWdgtLine glWdgtLine; +typedef struct _glWdgtLineClass glWdgtLineClass; + +struct _glWdgtLine { + GtkVBox parent_widget; + + GtkWidget *width_spin; + GtkWidget *color_picker; + GtkWidget *units_label; +}; + +struct _glWdgtLineClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtLine * line, gpointer user_data); +}; + +extern guint gl_wdgt_line_get_type (void); + +extern GtkWidget *gl_wdgt_line_new (gchar * label); + +extern void gl_wdgt_line_get_params (glWdgtLine * line, + gdouble * width, + guint * color); + +extern void gl_wdgt_line_set_params (glWdgtLine * line, + gdouble width, + guint color); + +#endif diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c new file mode 100644 index 00000000..d8dcca7c --- /dev/null +++ b/glabels2/src/wdgt-media-select.c @@ -0,0 +1,517 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_media_select.c: media selection widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-media-select.h" +#include "template.h" +#include "wdgt-mini-preview.h" +#include "prefs.h" +#include "util.h" +#include "marshal.h" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_WIDTH 160 +#define WDGT_MINI_PREVIEW_HEIGHT 200 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtMediaSelectSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_media_select_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_media_select_class_init (glWdgtMediaSelectClass * class); +static void gl_wdgt_media_select_instance_init (glWdgtMediaSelect * media_select); +static void gl_wdgt_media_select_finalize (GObject * object); + +static void gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select); + +static void page_size_entry_changed_cb (GtkEntry * entry, + gpointer user_data); +static void template_entry_changed_cb (GtkEntry * entry, + gpointer user_data); + +static void details_update (glWdgtMediaSelect * media_select, + gchar * name); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_media_select_get_type (void) +{ + static guint wdgt_media_select_type = 0; + + if (!wdgt_media_select_type) { + GTypeInfo wdgt_media_select_info = { + sizeof (glWdgtMediaSelectClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_media_select_class_init, + NULL, + NULL, + sizeof (glWdgtMediaSelect), + 0, + (GInstanceInitFunc) gl_wdgt_media_select_instance_init, + }; + + wdgt_media_select_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtMediaSelect", + &wdgt_media_select_info, 0); + } + + return wdgt_media_select_type; +} + +static void +gl_wdgt_media_select_class_init (glWdgtMediaSelectClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_media_select_finalize; + + wdgt_media_select_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtMediaSelectClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +static void +gl_wdgt_media_select_instance_init (glWdgtMediaSelect * media_select) +{ + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + media_select->page_size_entry = NULL; + media_select->template_entry = NULL; + + media_select->mini_preview = NULL; + + media_select->desc_label = NULL; + media_select->sheet_size_label = NULL; + media_select->number_label = NULL; + media_select->label_size_label = NULL; + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +static void +gl_wdgt_media_select_finalize (GObject * object) +{ + glWdgtMediaSelect *media_select; + glWdgtMediaSelectClass *class; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object)); + + media_select = GL_WDGT_MEDIA_SELECT (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +GtkWidget * +gl_wdgt_media_select_new (void) +{ + glWdgtMediaSelect *media_select; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + media_select = g_object_new (gl_wdgt_media_select_get_type (), NULL); + + gl_wdgt_media_select_construct (media_select); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); + + return GTK_WIDGET (media_select); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select) +{ + GtkWidget *whbox, *wvbox, *wcombo, *wvbox1, *whbox1; + gchar *name; + GList *template_names, *page_sizes = NULL; + const gchar *page_size; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + page_size = gl_prefs_get_page_size (); + + wvbox = GTK_WIDGET (media_select); + + whbox = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, GNOME_PAD); + + /* Page size selection control */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating page size combo..."); + wcombo = gtk_combo_new (); + page_sizes = gl_template_get_page_size_list (); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), page_sizes); + gl_template_free_page_size_list (&page_sizes); + media_select->page_size_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (media_select->page_size_entry), + FALSE); + gtk_combo_set_value_in_list (GTK_COMBO(wcombo), TRUE, FALSE); + gtk_widget_set_size_request (media_select->page_size_entry, 100, -1); + gtk_entry_set_text (GTK_ENTRY (media_select->page_size_entry), + page_size); + gtk_box_pack_start (GTK_BOX (whbox), wcombo, FALSE, FALSE, GNOME_PAD); + + /* Actual selection control */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating template combo..."); + gl_debug (DEBUG_MEDIA_SELECT, "page_size = %s", page_size); + template_names = gl_template_get_name_list (page_size); + media_select->template_combo = gtk_combo_new (); + gtk_combo_set_popdown_strings (GTK_COMBO (media_select->template_combo), + template_names); + gl_template_free_name_list (&template_names); + media_select->template_entry = + GTK_COMBO (media_select->template_combo)->entry; + gtk_entry_set_editable (GTK_ENTRY (media_select->template_entry), + FALSE); + gtk_combo_set_value_in_list (GTK_COMBO(media_select->template_combo), + TRUE, FALSE); + gtk_widget_set_size_request (media_select->template_entry, 400, -1); + gtk_box_pack_start (GTK_BOX (whbox), media_select->template_combo, + FALSE, FALSE, GNOME_PAD); + + whbox = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, GNOME_PAD); + + /* mini_preview canvas */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating mini preview..."); + media_select->mini_preview = gl_wdgt_mini_preview_new ( WDGT_MINI_PREVIEW_HEIGHT, + WDGT_MINI_PREVIEW_WIDTH); + gtk_box_pack_start (GTK_BOX (whbox), media_select->mini_preview, + FALSE, FALSE, GNOME_PAD); + + /* Label column */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating label column..."); + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox1, FALSE, FALSE, 0); + + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Description:")), + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Page size:")), + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Label size:")), + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Layout:")), + FALSE, FALSE, GNOME_PAD); + + /* detail widgets column */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating details column..."); + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox1, FALSE, FALSE, 0); + + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->desc_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->desc_label, + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->sheet_size_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->sheet_size_label, + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->label_size_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->label_size_label, + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->number_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->number_label, + FALSE, FALSE, GNOME_PAD); + + /* Update mini_preview and details from default template */ + + gl_debug (DEBUG_MEDIA_SELECT, "template_entry = %p", + media_select->template_entry); + name = + gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), + 0, -1); + gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name); + gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW (media_select->mini_preview), + name); + details_update (media_select, name); + g_free (name); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (media_select->page_size_entry), "changed", + G_CALLBACK (page_size_entry_changed_cb), + media_select); + g_signal_connect (G_OBJECT (media_select->template_entry), "changed", + G_CALLBACK (template_entry_changed_cb), + media_select); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change in selection */ +/*--------------------------------------------------------------------------*/ +static void +page_size_entry_changed_cb (GtkEntry * entry, + gpointer user_data) +{ + glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data); + gchar *page_size; + GList *template_names; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + + /* Update template selections for new page size */ + page_size = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + if ( strlen(page_size) ) { + gl_debug (DEBUG_MEDIA_SELECT, "page_size = \"%s\"", page_size); + template_names = gl_template_get_name_list (page_size); + gtk_combo_set_popdown_strings (GTK_COMBO (media_select->template_combo), + template_names); + gl_template_free_name_list (&template_names); + } + g_free (page_size); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change in selection */ +/*--------------------------------------------------------------------------*/ +static void +template_entry_changed_cb (GtkEntry * entry, + gpointer user_data) +{ + glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data); + gchar *name; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + /* Update mini_preview canvas & details with template */ + gl_debug (DEBUG_MEDIA_SELECT, "template_entry = %p", entry); + name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + if ( strlen(name) ) { + gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name); + gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW (media_select->mini_preview), + name); + gl_debug (DEBUG_MEDIA_SELECT, "m1"); + details_update (media_select, name); + gl_debug (DEBUG_MEDIA_SELECT, "m2"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (user_data), + wdgt_media_select_signals[CHANGED], 0); + } + g_free (name); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. update "details" widgets from new template. */ +/*--------------------------------------------------------------------------*/ +static void +details_update (glWdgtMediaSelect * media_select, + gchar * name) +{ + glTemplate *template; + gchar *text; + glPrefsUnits units; + const gchar *units_string; + gdouble units_per_point; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + units = gl_prefs_get_units (); + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + + /* Fetch template */ + template = gl_template_from_name (name); + + gtk_label_set_text (GTK_LABEL (media_select->desc_label), + template->description); + + gtk_label_set_text (GTK_LABEL (media_select->sheet_size_label), + template->page_size); + + text = g_strdup_printf (_("%d x %d (%d per sheet)"), + template->nx, template->ny, + template->nx * template->ny); + + gtk_label_set_text (GTK_LABEL (media_select->number_label), text); + g_free (text); + + if ( units == GL_PREFS_UNITS_INCHES ) { + gchar *xstr, *ystr; + + xstr = gl_util_fraction (template->label_height + * units_per_point); + ystr = gl_util_fraction (template->label_width + * units_per_point); + text = g_strdup_printf (_("%s x %s %s"), + xstr, ystr, units_string); + g_free (xstr); + g_free (ystr); + } else { + text = g_strdup_printf (_("%.5g x %.5g %s"), + template->label_height*units_per_point, + template->label_width*units_per_point, + units_string); + } + gtk_label_set_text (GTK_LABEL (media_select->label_size_label), text); + g_free (text); + + gl_template_free( &template ); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/****************************************************************************/ +/* query selected label template name. */ +/****************************************************************************/ +gchar * +gl_wdgt_media_select_get_name (glWdgtMediaSelect * media_select) +{ + gl_debug (DEBUG_MEDIA_SELECT, ""); + return + gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), + 0, -1); +} + +/****************************************************************************/ +/* set selected label template name. */ +/****************************************************************************/ +void +gl_wdgt_media_select_set_name (glWdgtMediaSelect * media_select, + gchar * name) +{ + gint pos; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + g_signal_handlers_block_by_func (G_OBJECT(media_select->template_entry), + G_CALLBACK(template_entry_changed_cb), + media_select); + gtk_editable_delete_text (GTK_EDITABLE (media_select->template_entry), + 0, -1); + g_signal_handlers_unblock_by_func (G_OBJECT(media_select->template_entry), + G_CALLBACK(template_entry_changed_cb), + media_select); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (media_select->template_entry), + name, strlen (name), &pos); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/****************************************************************************/ +/* query selected label template page size. */ +/****************************************************************************/ +gchar * +gl_wdgt_media_select_get_page_size (glWdgtMediaSelect * media_select) +{ + gl_debug (DEBUG_MEDIA_SELECT, ""); + + return + gtk_editable_get_chars (GTK_EDITABLE + (media_select->page_size_entry), 0, -1); +} + +/****************************************************************************/ +/* set selected label template page size. */ +/****************************************************************************/ +void +gl_wdgt_media_select_set_page_size (glWdgtMediaSelect * media_select, + gchar * page_size) +{ + gint pos; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + g_signal_handlers_block_by_func (G_OBJECT(media_select->page_size_entry), + G_CALLBACK(page_size_entry_changed_cb), + media_select); + gtk_editable_delete_text (GTK_EDITABLE (media_select->page_size_entry), + 0, -1); + g_signal_handlers_unblock_by_func (G_OBJECT(media_select->page_size_entry), + G_CALLBACK(page_size_entry_changed_cb), + media_select); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (media_select->page_size_entry), + page_size, strlen (page_size), &pos); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} diff --git a/glabels2/src/wdgt-media-select.h b/glabels2/src/wdgt-media-select.h new file mode 100644 index 00000000..8d628f43 --- /dev/null +++ b/glabels2/src/wdgt-media-select.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_media_select.h: media selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_MEDIA_SELECT_H__ +#define __WDGT_MEDIA_SELECT_H__ + +#include + +#define GL_TYPE_WDGT_MEDIA_SELECT (gl_wdgt_media_select_get_type ()) +#define GL_WDGT_MEDIA_SELECT(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_MEDIA_SELECT, glWdgtMediaSelect )) +#define GL_WDGT_MEDIA_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_MEDIA_SELECT, glWdgtMediaSelectClass)) +#define GL_IS_WDGT_MEDIA_SELECT(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_MEDIA_SELECT)) +#define GL_IS_WDGT_MEDIA_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_MEDIA_SELECT)) + +typedef struct _glWdgtMediaSelect glWdgtMediaSelect; +typedef struct _glWdgtMediaSelectClass glWdgtMediaSelectClass; + +struct _glWdgtMediaSelect { + GtkVBox parent_widget; + + GtkWidget *page_size_entry; + GtkWidget *template_combo; + GtkWidget *template_entry; + + GtkWidget *mini_preview; + + GtkWidget *desc_label; + GtkWidget *sheet_size_label; + GtkWidget *number_label; + GtkWidget *label_size_label; +}; + +struct _glWdgtMediaSelectClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtMediaSelect * media_select, gpointer user_data); +}; + +extern guint gl_wdgt_media_select_get_type (void); + +extern GtkWidget *gl_wdgt_media_select_new (void); + +extern gchar *gl_wdgt_media_select_get_name (glWdgtMediaSelect * media_select); + +extern void gl_wdgt_media_select_set_name (glWdgtMediaSelect * media_select, + gchar * name); + +extern gchar *gl_wdgt_media_select_get_page_size (glWdgtMediaSelect * media_select); + +extern void gl_wdgt_media_select_set_page_size (glWdgtMediaSelect * media_select, + gchar * page_size); + +#endif diff --git a/glabels2/src/wdgt-mini-preview.c b/glabels2/src/wdgt-mini-preview.c new file mode 100644 index 00000000..d2c0577d --- /dev/null +++ b/glabels2/src/wdgt-mini-preview.c @@ -0,0 +1,562 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_mini_preview.c: mini preview widget module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "libgnomeprint/gnome-print-paper.h" + +#include "wdgt-mini-preview.h" +#include "marshal.h" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_MAX_PIXELS 175 +#define SHADOW_X_OFFSET 3 +#define SHADOW_Y_OFFSET 3 +#define SHADOW_COLOR GNOME_CANVAS_COLOR_A (33, 33, 33, 192) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CLICKED, + PRESSED, + LAST_SIGNAL +}; + + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_mini_preview_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass * class); +static void gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview * preview); +static void gl_wdgt_mini_preview_finalize (GObject * object); + +static void gl_wdgt_mini_preview_construct (glWdgtMiniPreview * preview, + gint height, gint width); + +static GList *mini_outline_list_new (GnomeCanvas *canvas, + glTemplate *template); +static void mini_outline_list_free (GList ** list); + +static gint canvas_event_cb (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_mini_preview_get_type (void) +{ + static guint wdgt_mini_preview_type = 0; + + if (!wdgt_mini_preview_type) { + GTypeInfo wdgt_mini_preview_info = { + sizeof (glWdgtMiniPreviewClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_mini_preview_class_init, + NULL, + NULL, + sizeof (glWdgtMiniPreview), + 0, + (GInstanceInitFunc) gl_wdgt_mini_preview_instance_init, + }; + + wdgt_mini_preview_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtMiniPreview", + &wdgt_mini_preview_info, 0); + } + + return wdgt_mini_preview_type; +} + +static void +gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_mini_preview_finalize; + + wdgt_mini_preview_signals[CLICKED] = + g_signal_new ("clicked", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtMiniPreviewClass, clicked), + NULL, NULL, + gl_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); + + wdgt_mini_preview_signals[PRESSED] = + g_signal_new ("pressed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtMiniPreviewClass, pressed), + NULL, NULL, + gl_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +static void +gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview * preview) +{ + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + preview->canvas = NULL; + preview->label_items = NULL; + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +static void +gl_wdgt_mini_preview_finalize (GObject * object) +{ + glWdgtMiniPreview *preview; + glWdgtMiniPreviewClass *class; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_MINI_PREVIEW (object)); + + preview = GL_WDGT_MINI_PREVIEW (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +GtkWidget * +gl_wdgt_mini_preview_new (gint height, + gint width) +{ + glWdgtMiniPreview *preview; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + preview = g_object_new (gl_wdgt_mini_preview_get_type (), NULL); + + gl_wdgt_mini_preview_construct (preview, height, width); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); + + return GTK_WIDGET (preview); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_mini_preview_construct (glWdgtMiniPreview * preview, + gint height, + gint width) +{ + GtkWidget *whbox; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + whbox = GTK_WIDGET (preview); + + preview->height = height; + preview->width = width; + + /* create canvas */ + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + preview->canvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + gtk_box_pack_start (GTK_BOX (whbox), preview->canvas, TRUE, TRUE, 0); + gtk_widget_set_size_request (preview->canvas, width, height); + gnome_canvas_set_scroll_region (GNOME_CANVAS (preview->canvas), + 0.0, 0.0, width, height); + + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (preview->canvas), 1.0); + group = gnome_canvas_root (GNOME_CANVAS (preview->canvas)); + + /* draw shadow */ + preview->shadow_item = + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", (gdouble)SHADOW_X_OFFSET, + "y1", (gdouble)SHADOW_Y_OFFSET, + "x2", (gdouble)(SHADOW_X_OFFSET + width), + "y2", (gdouble)(SHADOW_Y_OFFSET + height), + "fill_color_rgba", SHADOW_COLOR, + NULL); + + /* draw an initial paper outline */ + preview->paper_item = + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", (gdouble)width, + "y2", (gdouble)height, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + + /* create empty list of label canvas items */ + preview->label_items = NULL; + preview->labels_per_sheet = 0; + + /* Event handler */ + g_signal_connect (G_OBJECT (preview->canvas), "event", + G_CALLBACK (canvas_event_cb), preview); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +/****************************************************************************/ +/* Set label for mini-preview to determine geometry. */ +/****************************************************************************/ +void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview * preview, + gchar *name) +{ + glTemplate *template; + gchar *page_size; + const GnomePrintPaper *paper = NULL; + gdouble paper_width, paper_height; + gdouble canvas_scale; + gdouble w, h; + gdouble shadow_x, shadow_y; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + /* Fetch template */ + template = gl_template_from_name (name); + + /* get paper size and set scale */ + paper = gnome_print_paper_get_by_name (template->page_size); + paper_width = paper->width; + paper_height = paper->height; + w = preview->width - 4 - 2*SHADOW_X_OFFSET; + h = preview->height - 4 - 2*SHADOW_Y_OFFSET; + if ( (w/paper_width) > (h/paper_height) ) { + canvas_scale = h / paper_height; + } else { + canvas_scale = w / paper_width; + } + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (preview->canvas), + canvas_scale); + gnome_canvas_set_scroll_region (GNOME_CANVAS (preview->canvas), + 0.0, 0.0, paper_width, paper_height); + + /* update shadow */ + shadow_x = SHADOW_X_OFFSET/canvas_scale; + shadow_y = SHADOW_Y_OFFSET/canvas_scale; + gnome_canvas_item_set (preview->shadow_item, + "x1", shadow_x, + "y1", shadow_y, + "x2", shadow_x + paper_width, + "y2", shadow_y + paper_height, + NULL); + + /* update paper outline */ + gnome_canvas_item_set (preview->paper_item, + "x2", paper_width, + "y2", paper_height, + NULL); + + /* update label items */ + mini_outline_list_free (&preview->label_items); + preview->label_items = + mini_outline_list_new (GNOME_CANVAS(preview->canvas), + template); + + gl_template_free( &template ); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw label outlines and return canvas item list. */ +/*--------------------------------------------------------------------------*/ +static GList * +mini_outline_list_new (GnomeCanvas * canvas, + glTemplate * template) +{ + GnomeCanvasGroup *group = NULL; + GnomeCanvasItem *item = NULL; + GList *list = NULL; + gint i, ix, iy; + gdouble x1, y1, x2, y2, y_temp; + const GnomePrintPaper *paper = NULL; + gdouble paper_height; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + /* get paper height */ + paper = gnome_print_paper_get_by_name (template->page_size); + paper_height = paper->height; + + group = gnome_canvas_root (canvas); + + /* draw mini label outlines */ + i = 1; + for (iy = (template->ny - 1); iy >= 0; iy--) { + for (ix = 0; ix < template->nx; ix++, i++) { + + x1 = ix * (template->dx) + template->x0; + y1 = iy * (template->dy) + template->y0; + x2 = x1 + template->label_width; + y2 = y1 + template->label_height; + + /* transform origin from lower left to upper left */ + /* and swap y's so that (y1 < y2) */ + y_temp = y2; + y2 = paper_height - y1; + y1 = paper_height - y_temp; + + switch (template->style) { + case GL_TEMPLATE_STYLE_RECT: + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type(), + "x1", x1, + "y1", y1, + "x2", x2, + "y2", y2, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + item = gnome_canvas_item_new (group, + gnome_canvas_ellipse_get_type(), + "x1", x1, + "y1", y1, + "x2", x2, + "y2", y2, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + default: + g_warning ("Unknown label style"); + return list; + break; + } + g_object_set_data (G_OBJECT (item), "i", + GINT_TO_POINTER (i)); + + list = g_list_append (list, item); + } + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); + return list; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw label outlines and return canvas item list. */ +/*--------------------------------------------------------------------------*/ +static void +mini_outline_list_free (GList ** list) +{ + GnomeCanvasItem *item; + GList *p; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + if ( *list != NULL ) { + + for (p = *list; p != NULL; p = p->next) { + item = GNOME_CANVAS_ITEM (p->data); + gtk_object_destroy (GTK_OBJECT (item)); + } + + g_list_free (*list); + *list = NULL; + + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static gint +canvas_event_cb (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + glWdgtMiniPreview *preview = GL_WDGT_MINI_PREVIEW (data); + GnomeCanvasItem *item; + static gboolean dragging = FALSE; + static gint prev_i = 0, first, last; + gint i; + gdouble x, y; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gnome_canvas_window_to_world (canvas, + event->button.x, event->button.y, + &x, &y); + switch (event->button.button) { + case 1: + /* Get item at cursor and make sure + it's a label object ("i" is valid) */ + item = gnome_canvas_get_item_at (GNOME_CANVAS (canvas), + x, y); + if (item == NULL) + break; + i = GPOINTER_TO_INT (g_object_get_data + (G_OBJECT (item), "i")); + if (i == 0) + break; + /* Go into dragging mode while remains pressed. */ + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, NULL, NULL, + event->button.time); + g_signal_emit (G_OBJECT(preview), + wdgt_mini_preview_signals[CLICKED], + 0, i); + first = i; + last = i; + g_signal_emit (G_OBJECT(preview), + wdgt_mini_preview_signals[PRESSED], + 0, first, last); + prev_i = i; + break; + + default: + break; + } + break; + + case GDK_BUTTON_RELEASE: + gnome_canvas_window_to_world (canvas, + event->button.x, event->button.y, + &x, &y); + switch (event->button.button) { + case 1: + /* Exit dragging mode */ + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + break; + + default: + break; + } + break; + + case GDK_MOTION_NOTIFY: + gnome_canvas_window_to_world (canvas, + event->motion.x, event->motion.y, + &x, &y); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + /* Get item at cursor and + make sure it's a label object ("i" is valid) */ + item = gnome_canvas_get_item_at (GNOME_CANVAS (canvas), + x, y); + if (item == NULL) + break; + i = GPOINTER_TO_INT (g_object_get_data + (G_OBJECT (item), "i")); + if (i == 0) + break; + if (prev_i != i) { + /* Entered into a new item */ + last = i; + g_signal_emit (G_OBJECT(preview), + wdgt_mini_preview_signals[PRESSED], + 0, + MIN (first, last), + MAX (first, last)); + prev_i = i; + } + } + break; + + default: + break; + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); + + return FALSE; +} + +/****************************************************************************/ +/* Highlight given label outlines. */ +/****************************************************************************/ +void +gl_wdgt_mini_preview_highlight_range (glWdgtMiniPreview * preview, + gint first_label, + gint last_label) +{ + GnomeCanvasItem *item = NULL; + GList *p = NULL; + gint i; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + for (p = preview->label_items, i = 1; p != NULL; i++, p = p->next) { + + item = GNOME_CANVAS_ITEM (p->data); + + if ((i >= first_label) && (i <= last_label)) { + gnome_canvas_item_set (item, + "fill_color", "light blue", + NULL); + } else { + gnome_canvas_item_set (item, + "fill_color", "white", NULL); + } + + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + diff --git a/glabels2/src/wdgt-mini-preview.h b/glabels2/src/wdgt-mini-preview.h new file mode 100644 index 00000000..db40ba01 --- /dev/null +++ b/glabels2/src/wdgt-mini-preview.h @@ -0,0 +1,80 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_mini_preview.h: mini-preview widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_MINI_PREVIEW_H__ +#define __WDGT_MINI_PREVIEW_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_MINI_PREVIEW (gl_wdgt_mini_preview_get_type ()) +#define GL_WDGT_MINI_PREVIEW(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_MINI_PREVIEW, glWdgtMiniPreview )) +#define GL_WDGT_MINI_PREVIEW_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_MINI_PREVIEW, glWdgtMiniPreviewClass)) +#define GL_IS_WDGT_MINI_PREVIEW(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_MINI_PREVIEW)) +#define GL_IS_WDGT_MINI_PREVIEW_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_MINI_PREVIEW)) + +typedef struct _glWdgtMiniPreview glWdgtMiniPreview; +typedef struct _glWdgtMiniPreviewClass glWdgtMiniPreviewClass; + +struct _glWdgtMiniPreview { + GtkHBox parent_widget; + + gint height; + gint width; + + GtkWidget *canvas; + GnomeCanvasItem *paper_item; + GnomeCanvasItem *shadow_item; + + gint labels_per_sheet; + GList *label_items; +}; + +struct _glWdgtMiniPreviewClass { + GtkHBoxClass parent_class; + + void (*clicked) (glWdgtMiniPreview *preview, + gint index, + gpointer user_data); + + void (*pressed) (glWdgtMiniPreview *preview, + gint index1, + gint index2, + gpointer user_data); +}; + +extern guint gl_wdgt_mini_preview_get_type (void); + +extern GtkWidget *gl_wdgt_mini_preview_new (gint height, gint width); + +extern void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview * preview, + gchar * name); + +extern void gl_wdgt_mini_preview_highlight_range (glWdgtMiniPreview * preview, + gint first_label, + gint last_label); + +#endif diff --git a/glabels2/src/wdgt-position.c b/glabels2/src/wdgt-position.c new file mode 100644 index 00000000..e90ba0b0 --- /dev/null +++ b/glabels2/src/wdgt-position.c @@ -0,0 +1,322 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_position.c: position properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-position.h" +#include "prefs.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtPositionSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_position_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_position_class_init (glWdgtPositionClass * class); +static void gl_wdgt_position_instance_init (glWdgtPosition * position); +static void gl_wdgt_position_finalize (GObject * object); +static void gl_wdgt_position_construct (glWdgtPosition * position, + gchar * label); +static void changed_cb (glWdgtPosition * position); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_position_get_type (void) +{ + static guint wdgt_position_type = 0; + + if (!wdgt_position_type) { + GTypeInfo wdgt_position_info = { + sizeof (glWdgtPositionClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_position_class_init, + NULL, + NULL, + sizeof (glWdgtPosition), + 0, + (GInstanceInitFunc) gl_wdgt_position_instance_init, + }; + + wdgt_position_type = g_type_register_static (gtk_vbox_get_type (), + "glWdgtPosition", + &wdgt_position_info, + 0); + } + + return wdgt_position_type; +} + +static void +gl_wdgt_position_class_init (glWdgtPositionClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_position_finalize; + + wdgt_position_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtPositionClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_position_instance_init (glWdgtPosition * position) +{ + position->x_spin = NULL; + position->y_spin = NULL; +} + +static void +gl_wdgt_position_finalize (GObject * object) +{ + glWdgtPosition *position; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_POSITION (object)); + + position = GL_WDGT_POSITION (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_position_new (gchar * label) +{ + glWdgtPosition *position; + + position = g_object_new (gl_wdgt_position_get_type (), NULL); + + gl_wdgt_position_construct (position, label); + + return GTK_WIDGET (position); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_position_construct (glWdgtPosition * position, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *x_adjust, *y_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + gl_debug (DEBUG_WDGT, "START"); + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + gl_debug (DEBUG_WDGT, "units = %s", units_string); + gl_debug (DEBUG_WDGT, "units/point = %f", units_per_point); + gl_debug (DEBUG_WDGT, "climb_rate = %f", climb_rate); + gl_debug (DEBUG_WDGT, "digits = %d", digits); + + wvbox = GTK_WIDGET (position); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* X label */ + wlabel = gtk_label_new (_("X:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* X spin */ + x_adjust = gtk_adjustment_new (0.0, 0.0, 100.0, climb_rate, 10.0, 10.0); + position->x_spin = gtk_spin_button_new (GTK_ADJUSTMENT (x_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (position->x_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (position->x_spin), TRUE); + g_signal_connect_swapped (G_OBJECT (position->x_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (position)); + gtk_table_attach_defaults (GTK_TABLE (wtable), position->x_spin, + 1, 2, 0, 1); + + /* Y label */ + wlabel = gtk_label_new (_("Y:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Y spin */ + y_adjust = gtk_adjustment_new (0.0, 0.0, 100.0, climb_rate, 10.0, 10.0); + position->y_spin = gtk_spin_button_new (GTK_ADJUSTMENT (y_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (position->y_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (position->y_spin), TRUE); + g_signal_connect_swapped (G_OBJECT (position->y_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (position)); + gtk_table_attach_defaults (GTK_TABLE (wtable), position->y_spin, + 1, 2, 1, 2); + + /* Units */ + position->units_label = gtk_label_new (units_string); + gtk_misc_set_alignment (GTK_MISC (position->units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), + position->units_label, 2, 3, 1, 2); + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtPosition * position) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (position), wdgt_position_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_position_get_position (glWdgtPosition * position, + gdouble * x, + gdouble * y) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + *x = gtk_spin_button_get_value (GTK_SPIN_BUTTON(position->x_spin)); + *y = gtk_spin_button_get_value (GTK_SPIN_BUTTON(position->y_spin)); + + /* convert everything back to our internal units (points) */ + *x /= units_per_point; + *y /= units_per_point; +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_position_set_params (glWdgtPosition * position, + gdouble x, + gdouble y, + gdouble x_max, + gdouble y_max) +{ + GtkObject *x_adjust, *y_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + /* Put everything into our display units */ + x *= units_per_point; + y *= units_per_point; + x_max *= units_per_point; + y_max *= units_per_point; + + /* update X/Y spin controls */ + x_adjust = gtk_adjustment_new (x, 0.0, x_max, climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (position->x_spin), + GTK_ADJUSTMENT (x_adjust), climb_rate, + digits); + y_adjust = gtk_adjustment_new (y, 0.0, y_max, climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (position->y_spin), + GTK_ADJUSTMENT (y_adjust), climb_rate, + digits); + + /* Units */ + gtk_label_set_text (GTK_LABEL (position->units_label), units_string); + +} + +/*====================================================================*/ +/* fill in position info only. */ +/*====================================================================*/ +void +gl_wdgt_position_set_position (glWdgtPosition * position, + gdouble x, + gdouble y) +{ + gdouble units_per_point; + + gl_debug (DEBUG_WDGT, "START"); + + units_per_point = gl_prefs_get_units_per_point (); + + gl_debug (DEBUG_WDGT, "units/point = %f", units_per_point); + + /* Put everything in our display units */ + x *= units_per_point; + y *= units_per_point; + + /* update X/Y spin controls */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (position->x_spin), x); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (position->y_spin), y); + + gl_debug (DEBUG_WDGT, "END"); +} diff --git a/glabels2/src/wdgt-position.h b/glabels2/src/wdgt-position.h new file mode 100644 index 00000000..41b13237 --- /dev/null +++ b/glabels2/src/wdgt-position.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_position.h: position properties widget module header file + * + * Copyright (C) 2000, 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_POSITION_H__ +#define __WDGT_POSITION_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_POSITION (gl_wdgt_position_get_type ()) +#define GL_WDGT_POSITION(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_POSITION, glWdgtPosition )) +#define GL_WDGT_POSITION_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_POSITION, glWdgtPositionClass)) +#define GL_IS_WDGT_POSITION(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_POSITION)) +#define GL_IS_WDGT_POSITION_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_POSITION)) + +typedef struct _glWdgtPosition glWdgtPosition; +typedef struct _glWdgtPositionClass glWdgtPositionClass; + +struct _glWdgtPosition { + GtkVBox parent_widget; + + GtkWidget *x_spin; + GtkWidget *y_spin; + GtkWidget *units_label; +}; + +struct _glWdgtPositionClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtPosition * prop, gpointer user_data); +}; + +extern guint gl_wdgt_position_get_type (void); + +extern GtkWidget *gl_wdgt_position_new (gchar * label); + +extern void gl_wdgt_position_get_position (glWdgtPosition * position, + gdouble * x, gdouble * y); + +extern void gl_wdgt_position_set_params (glWdgtPosition * position, + gdouble x, gdouble y, + gdouble x_max, gdouble y_max); + +extern void gl_wdgt_position_set_position (glWdgtPosition * position, + gdouble x, gdouble y); + +#endif diff --git a/glabels2/src/wdgt-print-copies.c b/glabels2/src/wdgt-print-copies.c new file mode 100644 index 00000000..75dc8cdb --- /dev/null +++ b/glabels2/src/wdgt-print-copies.c @@ -0,0 +1,397 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_copies.c: custom print copies widget module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-print-copies.h" +#include "wdgt-mini-preview.h" +#include "marshal.h" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_HEIGHT 175 +#define WDGT_MINI_PREVIEW_WIDTH 150 + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class); +static void gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies); +static void gl_wdgt_print_copies_finalize (GObject * object); + +static void gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies, + glLabel * label); + +static void sheets_radio_cb (GtkToggleButton * togglebutton, + gpointer user_data); +static void first_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data); +static void last_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data); + +static void +preview_pressed (glWdgtMiniPreview *mini_preview, + gint first, gint last, gpointer user_data); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_print_copies_get_type (void) +{ + static guint wdgt_print_copies_type = 0; + + if (!wdgt_print_copies_type) { + GTypeInfo wdgt_print_copies_info = { + sizeof (glWdgtPrintCopiesClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_print_copies_class_init, + NULL, + NULL, + sizeof (glWdgtPrintCopies), + 0, + (GInstanceInitFunc) gl_wdgt_print_copies_instance_init, + }; + + wdgt_print_copies_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtPrintCopies", + &wdgt_print_copies_info, 0); + } + + return wdgt_print_copies_type; +} + +static void +gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_print_copies_finalize; +} + +static void +gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies) +{ + copies->labels_per_sheet = 0; + + copies->mini_preview = NULL; + + copies->sheets_radio = NULL; + copies->sheets_spin = NULL; + + copies->labels_radio = NULL; + copies->first_spin = NULL; + copies->last_spin = NULL; +} + +static void +gl_wdgt_print_copies_finalize (GObject * object) +{ + glWdgtPrintCopies *copies; + glWdgtPrintCopiesClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_PRINT_COPIES (object)); + + copies = GL_WDGT_PRINT_COPIES (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_print_copies_new (glLabel * label) +{ + glWdgtPrintCopies *copies; + + copies = g_object_new (gl_wdgt_print_copies_get_type (), NULL); + + gl_wdgt_print_copies_construct (copies, label); + + return GTK_WIDGET (copies); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies, + glLabel * label) +{ + GtkWidget *whbox, *wvbox, *whbox1; + GSList *radio_group = NULL; + GtkObject *adjust; + const glTemplate *template; + + whbox = GTK_WIDGET (copies); + + template = gl_label_get_template (label); + copies->labels_per_sheet = template->nx * template->ny; + + /* mini_preview canvas */ + copies->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT, + WDGT_MINI_PREVIEW_WIDTH); + gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + template->name->data); + gtk_box_pack_start (GTK_BOX (whbox), copies->mini_preview, + TRUE, TRUE, GNOME_PAD); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox, TRUE, TRUE, GNOME_PAD); + + /* Sheet controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + copies->sheets_radio = + gtk_radio_button_new_with_label (radio_group, _("Sheets:")); + gtk_box_pack_start (GTK_BOX (whbox1), copies->sheets_radio, + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0); + copies->sheets_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), copies->sheets_spin, + FALSE, FALSE, 0); + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + 1, copies->labels_per_sheet); + + /* Label controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (copies->sheets_radio)); + copies->labels_radio = + gtk_radio_button_new_with_label (radio_group, _("Labels")); + gtk_box_pack_start (GTK_BOX (whbox1), copies->labels_radio, + FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("from:")), + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (1, 1.0, copies->labels_per_sheet, + 1.0, 10.0, 10.0); + copies->first_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), copies->first_spin, + FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("to:")), + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (copies->labels_per_sheet, + 1.0, copies->labels_per_sheet, + 1.0, 10.0, 10.0); + copies->last_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), copies->last_spin, + FALSE, FALSE, 0); + gtk_widget_set_sensitive (copies->first_spin, FALSE); + gtk_widget_set_sensitive (copies->last_spin, FALSE); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (copies->mini_preview), "pressed", + G_CALLBACK (preview_pressed), copies); + g_signal_connect (G_OBJECT (copies->sheets_radio), "toggled", + G_CALLBACK (sheets_radio_cb), copies); + g_signal_connect (G_OBJECT (copies->first_spin), "changed", + G_CALLBACK (first_spin_cb), copies); + g_signal_connect (G_OBJECT (copies->last_spin), "changed", + G_CALLBACK (last_spin_cb), copies); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Enable/Disable appropriate controls due to radio button toggle.*/ +/*--------------------------------------------------------------------------*/ +static void +sheets_radio_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + gint first, last; + + if (gtk_toggle_button_get_active (togglebutton)) { + + gtk_widget_set_sensitive (copies->sheets_spin, TRUE); + gtk_widget_set_sensitive (copies->first_spin, FALSE); + gtk_widget_set_sensitive (copies->last_spin, FALSE); + + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + 1, copies->labels_per_sheet); + + } else { + + gtk_widget_set_sensitive (copies->sheets_spin, FALSE); + gtk_widget_set_sensitive (copies->first_spin, TRUE); + gtk_widget_set_sensitive (copies->last_spin, TRUE); + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + last = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + first, last); + + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of first spin button */ +/*--------------------------------------------------------------------------*/ +static void +first_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + gint first, last; + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + last = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (copies->last_spin))-> + lower = first; + + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + first, last); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of last spin button */ +/*--------------------------------------------------------------------------*/ +static void +last_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + gint first, last; + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + last = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (copies->first_spin))-> + upper = last; + + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + first, last); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static void +preview_pressed (glWdgtMiniPreview *mini_preview, + gint first, + gint last, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + + gl_wdgt_print_copies_set_range (copies, 1, first, last); +} + +/****************************************************************************/ +/* query selected range of labels within sheet or number of sheets. */ +/****************************************************************************/ +void +gl_wdgt_print_copies_get_range (glWdgtPrintCopies * copies, + gint * n_sheets, + gint * first_label, + gint * last_label) +{ + gboolean sheets_active; + + sheets_active = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (copies->sheets_radio)); + + if (sheets_active) { + *n_sheets = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->sheets_spin)); + *first_label = 1; + *last_label = copies->labels_per_sheet; + } else { + *n_sheets = 1; + *first_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + *last_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + } +} + +/****************************************************************************/ +/* set range of labels within sheet or number of sheets */ +/****************************************************************************/ +void +gl_wdgt_print_copies_set_range (glWdgtPrintCopies * copies, + gint n_sheets, + gint first_label, + gint last_label) +{ + gint old_first_label; + + old_first_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + + if (first_label > old_first_label) { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->last_spin), + last_label); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->first_spin), + first_label); + } else { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->first_spin), + first_label); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->last_spin), + last_label); + } + if ((first_label == 1) && (last_label == copies->labels_per_sheet)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (copies->sheets_radio), TRUE); + gtk_spin_button_set_value (GTK_SPIN_BUTTON + (copies->sheets_spin), n_sheets); + } else { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (copies->labels_radio), TRUE); + gtk_spin_button_set_value (GTK_SPIN_BUTTON + (copies->sheets_spin), 1.0); + } +} diff --git a/glabels2/src/wdgt-print-copies.h b/glabels2/src/wdgt-print-copies.h new file mode 100644 index 00000000..09d0b67a --- /dev/null +++ b/glabels2/src/wdgt-print-copies.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_copies.h: custom print copies widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_PRINT_COPIES_H__ +#define __WDGT_PRINT_COPIES_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_PRINT_COPIES (gl_wdgt_print_copies_get_type ()) +#define GL_WDGT_PRINT_COPIES(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_PRINT_COPIES, glWdgtPrintCopies )) +#define GL_WDGT_PRINT_COPIES_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_PRINT_COPIES, glWdgtPrintCopiesClass)) +#define GL_IS_WDGT_PRINT_COPIES(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_PRINT_COPIES)) +#define GL_IS_WDGT_PRINT_COPIES_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_PRINT_COPIES)) + +typedef struct _glWdgtPrintCopies glWdgtPrintCopies; +typedef struct _glWdgtPrintCopiesClass glWdgtPrintCopiesClass; + +struct _glWdgtPrintCopies { + GtkHBox parent_widget; + + gint labels_per_sheet; + + GtkWidget *mini_preview; + + GtkWidget *sheets_radio; + GtkWidget *sheets_spin; + + GtkWidget *labels_radio; + GtkWidget *first_spin; + GtkWidget *last_spin; +}; + +struct _glWdgtPrintCopiesClass { + GtkHBoxClass parent_class; +}; + +extern guint gl_wdgt_print_copies_get_type (void); + +extern GtkWidget *gl_wdgt_print_copies_new (glLabel * label); + +extern void gl_wdgt_print_copies_get_range (glWdgtPrintCopies * copies, + gint * n_sheets, + gint * first_label, + gint * last_label); + +extern void gl_wdgt_print_copies_set_range (glWdgtPrintCopies * copies, + gint n_sheets, + gint first_label, + gint last_label); + +#endif diff --git a/glabels2/src/wdgt-print-merge.c b/glabels2/src/wdgt-print-merge.c new file mode 100644 index 00000000..f11a0e4f --- /dev/null +++ b/glabels2/src/wdgt-print-merge.c @@ -0,0 +1,337 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_merge.c: print merge widget module + * + * Copyright (C) 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-print-merge.h" +#include "wdgt-mini-preview.h" +#include "marshal.h" + +#include "pixmaps/collate.xpm" +#include "pixmaps/nocollate.xpm" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_HEIGHT 175 +#define WDGT_MINI_PREVIEW_WIDTH 150 + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * class); +static void gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge); +static void gl_wdgt_print_merge_finalize (GObject * object); + +static void gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, + glLabel * label); + +static void preview_clicked (glWdgtMiniPreview *mini_preview, + gint i_label, + gpointer user_data); + +static void collate_check_cb (GtkToggleButton * togglebutton, + gpointer user_data); +static void spin_cb (GtkSpinButton * spinbutton, + gpointer user_data); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_print_merge_get_type (void) +{ + static guint wdgt_print_merge_type = 0; + + if (!wdgt_print_merge_type) { + GTypeInfo wdgt_print_merge_info = { + sizeof (glWdgtPrintMergeClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_print_merge_class_init, + NULL, + NULL, + sizeof (glWdgtPrintMerge), + 0, + (GInstanceInitFunc) gl_wdgt_print_merge_instance_init, + }; + + wdgt_print_merge_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtPrintMerge", + &wdgt_print_merge_info, 0); + } + + return wdgt_print_merge_type; +} + +static void +gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_print_merge_finalize; +} + +static void +gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge) +{ + merge->mini_preview = NULL; + + merge->copies_spin = NULL; + merge->first_spin = NULL; + merge->collate_image = NULL; + merge->collate_check = NULL; +} + +static void +gl_wdgt_print_merge_finalize (GObject * object) +{ + glWdgtPrintMerge *merge; + glWdgtPrintMergeClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_PRINT_MERGE (object)); + + merge = GL_WDGT_PRINT_MERGE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_print_merge_new (glLabel * label) +{ + glWdgtPrintMerge *merge; + + merge = g_object_new (gl_wdgt_print_merge_get_type (), NULL); + + gl_wdgt_print_merge_construct (merge, label); + + return GTK_WIDGET (merge); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, + glLabel * label) +{ + GtkWidget *whbox, *wvbox, *whbox1; + GtkObject *adjust; + GdkPixbuf *pixbuf; + const glTemplate *template; + + whbox = GTK_WIDGET (merge); + + template = gl_label_get_template (label); + merge->labels_per_sheet = template->nx * template->ny; + + /* mini_preview canvas */ + merge->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT, + WDGT_MINI_PREVIEW_WIDTH); + gl_wdgt_mini_preview_set_label( GL_WDGT_MINI_PREVIEW (merge->mini_preview), + template->name->data ); + gtk_box_pack_start (GTK_BOX (whbox), merge->mini_preview, + TRUE, TRUE, GNOME_PAD); + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview), + 1, 1); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox, TRUE, TRUE, GNOME_PAD); + + /* First Label controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Start on label")), FALSE, FALSE, + 0); + adjust = + gtk_adjustment_new (1, 1.0, merge->labels_per_sheet, 1.0, 10.0, + 10.0); + merge->first_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), merge->first_spin, FALSE, FALSE, + 0); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("on 1st sheet")), + FALSE, FALSE, 0); + + /* Collate controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_end (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + pixbuf = gdk_pixbuf_new_from_xpm_data ( (const char **)nocollate_xpm); + merge->collate_image = gtk_image_new_from_pixbuf(pixbuf); + + gtk_box_pack_start (GTK_BOX (whbox1), merge->collate_image, + FALSE, FALSE, 0); + merge->collate_check = gtk_check_button_new_with_label (_("Collate")); + gtk_box_pack_start (GTK_BOX (whbox1), merge->collate_check, + FALSE, FALSE, 0); + + /* Copy controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_end (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("Copies:")), + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0); + merge->copies_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), merge->copies_spin, + FALSE, FALSE, 0); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (merge->mini_preview), "clicked", + G_CALLBACK (preview_clicked), merge); + g_signal_connect (G_OBJECT (merge->collate_check), "toggled", + G_CALLBACK (collate_check_cb), merge); + g_signal_connect (G_OBJECT (merge->copies_spin), "changed", + G_CALLBACK (spin_cb), merge); + g_signal_connect (G_OBJECT (merge->first_spin), "changed", + G_CALLBACK (spin_cb), merge); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Enable/Disable appropriate controls due to radio button toggle.*/ +/*--------------------------------------------------------------------------*/ +static void +collate_check_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (user_data); + GdkPixbuf *pixbuf; + + if (gtk_toggle_button_get_active (togglebutton)) { + + pixbuf = + gdk_pixbuf_new_from_xpm_data ( (const char **)collate_xpm); + + } else { + + pixbuf = + gdk_pixbuf_new_from_xpm_data ( (const char **)nocollate_xpm); + + } + gtk_image_set_from_pixbuf (GTK_IMAGE (merge->collate_image), + pixbuf); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of first spin button */ +/*--------------------------------------------------------------------------*/ +static void +spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (user_data); + gint first, last, n_copies; + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->first_spin)); + + n_copies = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->copies_spin)); + last = first + (n_copies * merge->n_records) - 1; + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview), + first, last ); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static void +preview_clicked (glWdgtMiniPreview *mini_preview, + gint first, + gpointer user_data) +{ + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (user_data); + gint n_copies, last; + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (merge->first_spin), + first); + + n_copies = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->copies_spin)); + last = first + (n_copies * merge->n_records) - 1; + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW (merge->mini_preview), + first, last); + +} + +/****************************************************************************/ +/* query selected range of labels within sheet or number of sheets. */ +/****************************************************************************/ +void +gl_wdgt_print_merge_get_copies (glWdgtPrintMerge * merge, + gint * n_copies, + gint * first_label, + gboolean * collate_flag) +{ + *n_copies = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->copies_spin)); + *first_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->first_spin)); + *collate_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (merge->collate_check)); +} + +/****************************************************************************/ +/* set range of labels within sheet or number of sheets */ +/****************************************************************************/ +void +gl_wdgt_print_merge_set_copies (glWdgtPrintMerge * merge, + gint n_copies, + gint first_label, + gint n_records, + gboolean collate_flag) +{ + gint last_label; + + merge->n_records = n_records; + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (merge->copies_spin), + n_copies); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (merge->first_spin), + first_label); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (merge->collate_check), + collate_flag); + + last_label = first_label + (n_copies * n_records) - 1; + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW (merge->mini_preview), + first_label, last_label ); +} diff --git a/glabels2/src/wdgt-print-merge.h b/glabels2/src/wdgt-print-merge.h new file mode 100644 index 00000000..186a339a --- /dev/null +++ b/glabels2/src/wdgt-print-merge.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_merge.h: print merge widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_PRINT_MERGE_H__ +#define __WDGT_PRINT_MERGE_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_PRINT_MERGE (gl_wdgt_print_merge_get_type ()) +#define GL_WDGT_PRINT_MERGE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_PRINT_MERGE, glWdgtPrintMerge )) +#define GL_WDGT_PRINT_MERGE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_PRINT_MERGE, glWdgtPrintMergeClass)) +#define GL_IS_WDGT_PRINT_MERGE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_PRINT_MERGE)) +#define GL_IS_WDGT_PRINT_MERGE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_PRINT_MERGE)) + +typedef struct _glWdgtPrintMerge glWdgtPrintMerge; +typedef struct _glWdgtPrintMergeClass glWdgtPrintMergeClass; + +struct _glWdgtPrintMerge { + GtkHBox parent_widget; + + gint labels_per_sheet; + GtkWidget *mini_preview; + + gint n_records; + + GtkWidget *copies_spin; + GtkWidget *first_spin; + GtkWidget *collate_image; + GtkWidget *collate_check; +}; + +struct _glWdgtPrintMergeClass { + GtkHBoxClass parent_class; +}; + +extern guint gl_wdgt_print_merge_get_type (void); + +extern GtkWidget *gl_wdgt_print_merge_new (glLabel * label); + +extern void gl_wdgt_print_merge_get_copies (glWdgtPrintMerge * merge, + gint * n_copies, + gint * first_label, + gboolean * collate_flag); + +extern void gl_wdgt_print_merge_set_copies (glWdgtPrintMerge * merge, + gint n_copies, + gint first_label, + gint n_records, + gboolean collate_flag); + +#endif diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c new file mode 100644 index 00000000..23ba0b02 --- /dev/null +++ b/glabels2/src/wdgt-rotate-label.c @@ -0,0 +1,359 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_rotate_label.c: label rotate selection widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-rotate-label.h" +#include "template.h" +#include "marshal.h" + +#include "debug.h" + +#define MINI_PREVIEW_MAX_PIXELS 48 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtRotateLabelSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_rotate_label_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass * class); +static void gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel * rotate_select); +static void gl_wdgt_rotate_label_finalize (GObject * object); + +static void gl_wdgt_rotate_label_construct (glWdgtRotateLabel * rotate_select); + +static void entry_changed_cb (GtkToggleButton * toggle, + gpointer user_data); + +static GtkWidget *mini_preview_canvas_new (void); + +static void mini_preview_canvas_update (GnomeCanvas * canvas, + glTemplate * template, + gboolean rotate_flag); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_rotate_label_get_type (void) +{ + static guint wdgt_rotate_label_type = 0; + + if (!wdgt_rotate_label_type) { + GTypeInfo wdgt_rotate_label_info = { + sizeof (glWdgtRotateLabelClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_rotate_label_class_init, + NULL, + NULL, + sizeof (glWdgtRotateLabel), + 0, + (GInstanceInitFunc) gl_wdgt_rotate_label_instance_init, + + }; + + wdgt_rotate_label_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtRotateLabel", + &wdgt_rotate_label_info, 0); + } + + return wdgt_rotate_label_type; +} + +static void +gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_rotate_label_finalize; + + wdgt_rotate_label_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtRotateLabelClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel * rotate_select) +{ + rotate_select->rotate_check = NULL; + + rotate_select->canvas = NULL; + + rotate_select->template = NULL; +} + +static void +gl_wdgt_rotate_label_finalize (GObject * object) +{ + glWdgtRotateLabel *rotate_select; + glWdgtRotateLabelClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (object)); + + rotate_select = GL_WDGT_ROTATE_LABEL (object); + +#if 0 + gl_template_free (&rotate_select->template); +#endif + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_rotate_label_new (void) +{ + glWdgtRotateLabel *rotate_select; + + rotate_select = g_object_new (gl_wdgt_rotate_label_get_type (), NULL); + + gl_wdgt_rotate_label_construct (rotate_select); + + return GTK_WIDGET (rotate_select); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_rotate_label_construct (glWdgtRotateLabel * rotate_select) +{ + GtkWidget *whbox; + + whbox = GTK_WIDGET (rotate_select); + + /* Actual selection control */ + rotate_select->rotate_check = + gtk_check_button_new_with_label (_("Rotate")); + gtk_box_pack_start (GTK_BOX (whbox), rotate_select->rotate_check, TRUE, + TRUE, GNOME_PAD); + + /* mini_preview canvas */ + rotate_select->canvas = mini_preview_canvas_new (); + gtk_box_pack_start (GTK_BOX (whbox), rotate_select->canvas, + TRUE, TRUE, GNOME_PAD); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (rotate_select->rotate_check), "toggled", + G_CALLBACK (entry_changed_cb), rotate_select); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of check button */ +/*--------------------------------------------------------------------------*/ +static void +entry_changed_cb (GtkToggleButton * toggle, + gpointer user_data) +{ + glWdgtRotateLabel *rotate_select = GL_WDGT_ROTATE_LABEL (user_data); + + if (rotate_select->template != NULL) { + /* Update mini_preview canvas & details with template */ + mini_preview_canvas_update (GNOME_CANVAS + (rotate_select->canvas), + rotate_select->template, + gtk_toggle_button_get_active + (toggle)); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (user_data), + wdgt_rotate_label_signals[CHANGED], 0); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw a mini-preview canvas. */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +mini_preview_canvas_new (void) +{ + GtkWidget *wcanvas = NULL; + + /* Create a canvas */ + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + wcanvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + + gtk_widget_set_size_request (GTK_WIDGET (wcanvas), + MINI_PREVIEW_MAX_PIXELS + 8, + MINI_PREVIEW_MAX_PIXELS + 8); + + gtk_object_set_data (GTK_OBJECT (wcanvas), "label_item", NULL); + + return wcanvas; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update mini-preview canvas from new template. */ +/*--------------------------------------------------------------------------*/ +static void +mini_preview_canvas_update (GnomeCanvas * canvas, + glTemplate * template, + gboolean rotate_flag) +{ + gdouble canvas_scale; + GnomeCanvasGroup *group = NULL; + GnomeCanvasItem *label_item = NULL; + gdouble m, w, h; + + /* Fetch our data from canvas */ + label_item = g_object_get_data (G_OBJECT (canvas), "label_item"); + + m = MAX (template->label_width, template->label_height); + canvas_scale = (MINI_PREVIEW_MAX_PIXELS) / m; + + /* FIXME: Stupid hack to eliminate canvas artifacts. */ + if (rotate_flag) { + canvas_scale *= 1.02; + } + + /* scale and size canvas */ + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (canvas), canvas_scale); + group = gnome_canvas_root (GNOME_CANVAS (canvas)); + gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), + -m / 2.0, -m / 2.0, + +m / 2.0, +m / 2.0); + + /* remove old label outline */ + if (label_item != NULL) { + gtk_object_destroy (GTK_OBJECT (label_item)); + } + + /* draw mini label outline */ + if (!rotate_flag) { + w = template->label_width; + h = template->label_height; + } else { + w = template->label_height; + h = template->label_width; + } + switch (template->style) { + case GL_TEMPLATE_STYLE_RECT: + label_item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type(), + "x1", -w / 2.0, + "y1", -h / 2.0, + "x2", +w / 2.0, + "y2", +h / 2.0, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + label_item = gnome_canvas_item_new (group, + gnome_canvas_ellipse_get_type(), + "x1", -w / 2.0, + "y1", -h / 2.0, + "x2", +w / 2.0, + "y2", +h / 2.0, + "width_pixels", 2, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + default: + g_warning ("Unknown label style"); + break; + } + + gtk_object_set_data (GTK_OBJECT (canvas), "label_item", label_item); + +} + +/****************************************************************************/ +/* query state of widget. */ +/****************************************************************************/ +gboolean +gl_wdgt_rotate_label_get_state (glWdgtRotateLabel * rotate_select) +{ + return + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check)); +} + +/****************************************************************************/ +/* set state of widget. */ +/****************************************************************************/ +void +gl_wdgt_rotate_label_set_state (glWdgtRotateLabel * rotate_select, + gboolean state) +{ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check), state); +} + +/****************************************************************************/ +/* set template for widget. */ +/****************************************************************************/ +void +gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel * rotate_select, + gchar * name) +{ + glTemplate *template; + + template = gl_template_from_name (name); + rotate_select->template = template; + + if (template->label_width != template->label_height) { + gtk_widget_set_sensitive (rotate_select->rotate_check, TRUE); + } else { + gtk_widget_set_sensitive (rotate_select->rotate_check, FALSE); + } + + mini_preview_canvas_update (GNOME_CANVAS (rotate_select->canvas), + template, FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check), FALSE); +} diff --git a/glabels2/src/wdgt-rotate-label.h b/glabels2/src/wdgt-rotate-label.h new file mode 100644 index 00000000..e971276c --- /dev/null +++ b/glabels2/src/wdgt-rotate-label.h @@ -0,0 +1,71 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_rotate_label.h: label rotate selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_ROTATE_LABEL_H__ +#define __WDGT_ROTATE_LABEL_H__ + +#include +#include "template.h" + +#define GL_TYPE_WDGT_ROTATE_LABEL (gl_wdgt_rotate_label_get_type ()) +#define GL_WDGT_ROTATE_LABEL(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_ROTATE_LABEL, glWdgtRotateLabel )) +#define GL_WDGT_ROTATE_LABEL_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_ROTATE_LABEL, glWdgtRotateLabelClass)) +#define GL_IS_WDGT_ROTATE_LABEL(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_ROTATE_LABEL)) +#define GL_IS_WDGT_ROTATE_LABEL_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_ROTATE_LABEL)) + +typedef struct _glWdgtRotateLabel glWdgtRotateLabel; +typedef struct _glWdgtRotateLabelClass glWdgtRotateLabelClass; + +struct _glWdgtRotateLabel { + GtkHBox parent_widget; + + GtkWidget *rotate_check; + + GtkWidget *canvas; + + glTemplate *template; +}; + +struct _glWdgtRotateLabelClass { + GtkHBoxClass parent_class; + + void (*changed) (glWdgtRotateLabel * wdgt_rotate_label, + gpointer user_data); +}; + +extern guint gl_wdgt_rotate_label_get_type (void); + +extern GtkWidget *gl_wdgt_rotate_label_new (void); + +extern gboolean gl_wdgt_rotate_label_get_state (glWdgtRotateLabel * wdgt_rotate_label); + +extern void gl_wdgt_rotate_label_set_state (glWdgtRotateLabel * wdgt_rotate_label, + gboolean state); + +extern void gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel * wdgt_rotate_label, + gchar * name); + +#endif diff --git a/glabels2/src/wdgt-size.c b/glabels2/src/wdgt-size.c new file mode 100644 index 00000000..50352e02 --- /dev/null +++ b/glabels2/src/wdgt-size.c @@ -0,0 +1,493 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_size.c: size properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-size.h" +#include "prefs.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtSizeSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_size_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_size_class_init (glWdgtSizeClass * class); +static void gl_wdgt_size_instance_init (glWdgtSize * size); +static void gl_wdgt_size_finalize (GObject * object); +static void gl_wdgt_size_construct (glWdgtSize * size, gchar * label); + +static void aspect_toggle_cb (GtkToggleButton * togglebutton, + gpointer user_data); +static void w_spin_cb (GtkSpinButton * spinbutton, gpointer user_data); +static void h_spin_cb (GtkSpinButton * spinbutton, gpointer user_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_size_get_type (void) +{ + static guint wdgt_size_type = 0; + + if (!wdgt_size_type) { + GTypeInfo wdgt_size_info = { + sizeof (glWdgtSizeClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_size_class_init, + NULL, + NULL, + sizeof (glWdgtSize), + 0, + (GInstanceInitFunc) gl_wdgt_size_instance_init, + }; + + wdgt_size_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtSize", &wdgt_size_info, 0); + } + + return wdgt_size_type; +} + +static void +gl_wdgt_size_class_init (glWdgtSizeClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_size_finalize; + + wdgt_size_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtSizeClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_size_instance_init (glWdgtSize * size) +{ + size->aspect_ratio = 1.0; + + size->w_spin = NULL; + size->h_spin = NULL; + + size->units_label = NULL; + + size->aspect_checkbox = NULL; +} + +static void +gl_wdgt_size_finalize (GObject * object) +{ + glWdgtSize *size; + glWdgtSizeClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_SIZE (object)); + + size = GL_WDGT_SIZE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_size_new (gchar * label) +{ + glWdgtSize *size; + + size = g_object_new (gl_wdgt_size_get_type (), NULL); + + gl_wdgt_size_construct (size, label); + + return GTK_WIDGET (size); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_size_construct (glWdgtSize * size, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *w_adjust, *h_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + wvbox = GTK_WIDGET (size); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (3, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* W Label */ + wlabel = gtk_label_new (_("Width:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* W spin */ + w_adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, + climb_rate, 10.0, 10.0); + size->w_spin = gtk_spin_button_new (GTK_ADJUSTMENT (w_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->w_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->w_spin), TRUE); + gtk_table_attach_defaults (GTK_TABLE (wtable), size->w_spin, + 1, 2, 0, 1); + + /* H label */ + wlabel = gtk_label_new (_("Height:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* H spin */ + h_adjust = gtk_adjustment_new (climb_rate, climb_rate, + 100.0, climb_rate, 10.0, 10.0); + size->h_spin = gtk_spin_button_new (GTK_ADJUSTMENT (h_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->h_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->h_spin), TRUE); + gtk_table_attach_defaults (GTK_TABLE (wtable), size->h_spin, + 1, 2, 1, 2); + + /* Units */ + size->units_label = gtk_label_new (units_string); + gtk_misc_set_alignment (GTK_MISC (size->units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), + size->units_label, 2, 3, 1, 2); + + /* Maintain aspect ratio checkbox */ + size->aspect_checkbox = + gtk_check_button_new_with_label (_ + ("Maintain current aspect ratio")); + gtk_table_attach_defaults (GTK_TABLE (wtable), size->aspect_checkbox, 0, + 3, 2, 3); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (size->aspect_checkbox), "toggled", + G_CALLBACK (aspect_toggle_cb), size); + g_signal_connect (G_OBJECT (size->w_spin), "changed", + G_CALLBACK (w_spin_cb), size); + g_signal_connect (G_OBJECT (size->h_spin), "changed", + G_CALLBACK (h_spin_cb), size); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Maintain aspect ratio checkbox callback. */ +/*--------------------------------------------------------------------------*/ +static void +aspect_toggle_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtSize *size = GL_WDGT_SIZE (user_data); + GtkAdjustment *w_adjust, *h_adjust; + + if (gtk_toggle_button_get_active (togglebutton)) { + + size->w = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->w_spin)); + size->h = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->h_spin)); + + size->aspect_ratio = size->h / size->w; + + /* We have a new aspect ratio, adjust one of the maxes accordingly */ + if ((size->h_max_orig / size->w_max_orig) < size->aspect_ratio) { + size->w_max = size->h_max_orig / size->aspect_ratio; + size->h_max = size->h_max_orig; + } else { + size->w_max = size->w_max_orig; + size->h_max = size->w_max_orig * size->aspect_ratio; + } + + } else { + + /* Reset maximums */ + size->w_max = size->w_max_orig; + size->h_max = size->h_max_orig; + + } + + g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + w_adjust = + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (size->w_spin)); + w_adjust->upper = size->w_max; + gtk_spin_button_update (GTK_SPIN_BUTTON (size->w_spin)); + h_adjust = + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (size->h_spin)); + h_adjust->upper = size->h_max; + gtk_spin_button_update (GTK_SPIN_BUTTON (size->h_spin)); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. W spin button changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +w_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtSize *size = GL_WDGT_SIZE (user_data); + GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); + + size->w = + gtk_spin_button_get_value (GTK_SPIN_BUTTON (size->w_spin)); + + if (gtk_toggle_button_get_active (toggle)) { + + size->h = size->w * size->aspect_ratio; + + /* Update our sibling control, blocking recursion. */ + g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin), + size->h); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. H spin button changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +h_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtSize *size = GL_WDGT_SIZE (user_data); + GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); + + size->h = + gtk_spin_button_get_value (GTK_SPIN_BUTTON (size->h_spin)); + + if (gtk_toggle_button_get_active (toggle)) { + + size->w = size->h / size->aspect_ratio; + + /* Update our sibling control, blocking recursion. */ + g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin), + size->w); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); + +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_size_get_size (glWdgtSize * size, + gdouble * w, + gdouble * h, + gboolean * keep_aspect_ratio_flag) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + *w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->w_spin)); + *h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->h_spin)); + + *keep_aspect_ratio_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (size->aspect_checkbox)); + + /* convert everything back to our internal units (points) */ + *w /= units_per_point; + *h /= units_per_point; +} + +/*====================================================================*/ +/* set values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_size_set_params (glWdgtSize * size, + gdouble w, + gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, + gdouble h_max) +{ + GtkObject *w_adjust, *h_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + /* Put everything into our display units */ + size->w = w * units_per_point; + size->h = h * units_per_point; + size->w_max = w_max * units_per_point; + size->h_max = h_max * units_per_point; + + /* Squirrel away copies of our original maximums */ + size->w_max_orig = size->w_max; + size->h_max_orig = size->h_max; + + size->aspect_ratio = size->h / size->w; + if (keep_aspect_ratio_flag) { + + /* When tracking aspect ratio, adjust one of the maxes */ + if ((size->h_max / size->w_max) < size->aspect_ratio) { + size->w_max = size->h_max / size->aspect_ratio; + } else { + size->h_max = size->w_max * size->aspect_ratio; + } + + /* before adjusting w & h, limit to max values */ + if (size->w > size->w_max) + size->w = size->w_max; + if (size->h > size->h_max) + size->h = size->h_max; + + } + + /* update W/H spin controls */ + w_adjust = gtk_adjustment_new (size->w, climb_rate, size->w_max, + climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (size->w_spin), + GTK_ADJUSTMENT (w_adjust), climb_rate, + digits); + h_adjust = + gtk_adjustment_new (size->h, climb_rate, size->h_max, climb_rate, + 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (size->h_spin), + GTK_ADJUSTMENT (h_adjust), climb_rate, + digits); + + gtk_label_set_text (GTK_LABEL (size->units_label), units_string); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (size->aspect_checkbox), + keep_aspect_ratio_flag); + +} + +/*====================================================================*/ +/* set size only. */ +/*====================================================================*/ +void +gl_wdgt_size_set_size (glWdgtSize * size, + gdouble w, + gdouble h) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + /* Put everything into our display units */ + size->w = w * units_per_point; + size->h = h * units_per_point; + + /* update aspect ratio */ + size->aspect_ratio = size->h / size->w; + + /* update W/H spin controls */ + g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + size); + g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + size); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin), size->w); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin), size->h); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + size); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + size); +} diff --git a/glabels2/src/wdgt-size.h b/glabels2/src/wdgt-size.h new file mode 100644 index 00000000..3e53e550 --- /dev/null +++ b/glabels2/src/wdgt-size.h @@ -0,0 +1,78 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_size.h: size properties widget module header file + * + * Copyright (C) 2000, 2001 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_SIZE_H__ +#define __WDGT_SIZE_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_SIZE (gl_wdgt_size_get_type ()) +#define GL_WDGT_SIZE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_SIZE, glWdgtSize )) +#define GL_WDGT_SIZE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_SIZE, glWdgtSizeClass)) +#define GL_IS_WDGT_SIZE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_SIZE)) +#define GL_IS_WDGT_SIZE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_SIZE)) + +typedef struct _glWdgtSize glWdgtSize; +typedef struct _glWdgtSizeClass glWdgtSizeClass; + +struct _glWdgtSize { + GtkVBox parent_widget; + + gdouble w, h; + gdouble aspect_ratio; + gdouble w_max, h_max; + gdouble w_max_orig, h_max_orig; + + GtkWidget *w_spin; + GtkWidget *h_spin; + GtkWidget *units_label; + GtkWidget *aspect_checkbox; +}; + +struct _glWdgtSizeClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtSize * size, gpointer user_data); +}; + +extern guint gl_wdgt_size_get_type (void); + +extern GtkWidget *gl_wdgt_size_new (gchar * label); + +extern void gl_wdgt_size_get_size (glWdgtSize * size, + gdouble * w, gdouble * h, + gboolean * keep_aspect_ratio_flag); + +extern void gl_wdgt_size_set_params (glWdgtSize * size, + gdouble w, gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, gdouble h_max); + +extern void gl_wdgt_size_set_size (glWdgtSize * size, + gdouble w, gdouble h); + +#endif diff --git a/glabels2/src/wdgt-text-entry.c b/glabels2/src/wdgt-text-entry.c new file mode 100644 index 00000000..912a9053 --- /dev/null +++ b/glabels2/src/wdgt-text-entry.c @@ -0,0 +1,321 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_entry.c: text entry widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-text-entry.h" +#include "merge.h" +#include "text-node.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtTextEntrySignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_text_entry_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_text_entry_class_init (glWdgtTextEntryClass * class); +static void gl_wdgt_text_entry_instance_init (glWdgtTextEntry * text_entry); +static void gl_wdgt_text_entry_finalize (GObject * object); +static void gl_wdgt_text_entry_construct (glWdgtTextEntry * text_entry, + gchar * label, GList * field_defs); + +static void changed_cb (glWdgtTextEntry * text_entry); +static void insert_cb (glWdgtTextEntry * text_entry); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_text_entry_get_type (void) +{ + static guint wdgt_text_entry_type = 0; + + if (!wdgt_text_entry_type) { + GTypeInfo wdgt_text_entry_info = { + sizeof (glWdgtTextEntryClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_text_entry_class_init, + NULL, + NULL, + sizeof (glWdgtTextEntry), + 0, + (GInstanceInitFunc) gl_wdgt_text_entry_instance_init, + }; + + wdgt_text_entry_type = g_type_register_static (gtk_vbox_get_type (), + "glWdgtTextEntry", + &wdgt_text_entry_info, + 0); + } + + return wdgt_text_entry_type; +} + +static void +gl_wdgt_text_entry_class_init (glWdgtTextEntryClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_WDGT, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_text_entry_finalize; + + wdgt_text_entry_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtTextEntryClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, G_TYPE_NONE, 0); + + gl_debug (DEBUG_WDGT, "END"); +} + +static void +gl_wdgt_text_entry_instance_init (glWdgtTextEntry * text_entry) +{ + gl_debug (DEBUG_WDGT, "START"); + + text_entry->text_entry = NULL; + text_entry->key_entry = NULL; + text_entry->insert_button = NULL; + + gl_debug (DEBUG_WDGT, "END"); +} + +static void +gl_wdgt_text_entry_finalize (GObject * object) +{ + glWdgtTextEntry *text_entry; + glWdgtTextEntryClass *class; + + gl_debug (DEBUG_WDGT, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_TEXT_ENTRY (object)); + + text_entry = GL_WDGT_TEXT_ENTRY (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_WDGT, "END"); +} + +GtkWidget * +gl_wdgt_text_entry_new (gchar * label, + GList * field_defs) +{ + glWdgtTextEntry *text_entry; + + gl_debug (DEBUG_WDGT, "START"); + + text_entry = g_object_new (gl_wdgt_text_entry_get_type (), NULL); + + gl_wdgt_text_entry_construct (text_entry, label, field_defs); + + gl_debug (DEBUG_WDGT, "END"); + + return GTK_WIDGET (text_entry); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_text_entry_construct (glWdgtTextEntry * text_entry, + gchar * label, + GList * field_defs) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel, *wcombo; + GList *keys; + + gl_debug (DEBUG_WDGT, "START"); + + wvbox = GTK_WIDGET (text_entry); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Actual text entry widget */ + text_entry->text_entry = gtk_text_view_new (); + text_entry->text_buffer = + gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); + g_signal_connect_swapped (G_OBJECT (text_entry->text_buffer), + "changed", G_CALLBACK (changed_cb), + G_OBJECT (text_entry)); + gtk_widget_set_size_request (text_entry->text_entry, -1, 70); + gtk_table_attach_defaults (GTK_TABLE (wtable), text_entry->text_entry, + 0, 3, 0, 1); + + /* Insert merge field label */ + wlabel = gtk_label_new (_("Key:")); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + + /* Key entry widget */ + wcombo = gtk_combo_new (); + keys = gl_merge_get_key_list (field_defs); + if (keys != NULL) + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), keys); + gl_merge_free_key_list (&keys); + text_entry->key_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (text_entry->key_entry), FALSE); + gtk_widget_set_size_request (wcombo, 200, -1); + gtk_table_attach_defaults (GTK_TABLE (wtable), wcombo, 1, 2, 1, 2); + + /* Insert button */ + text_entry->insert_button = + gtk_button_new_with_label (_("Insert merge field")); + g_signal_connect_swapped (G_OBJECT (text_entry->insert_button), + "clicked", G_CALLBACK (insert_cb), + G_OBJECT (text_entry)); + gtk_table_attach_defaults (GTK_TABLE (wtable), + text_entry->insert_button, 2, 3, 1, 2); + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when text has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtTextEntry * text_entry) +{ + gl_debug (DEBUG_WDGT, "START"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (text_entry), + wdgt_text_entry_signals[CHANGED], 0); + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback to insert field into text buffer. */ +/*--------------------------------------------------------------------------*/ +static void +insert_cb (glWdgtTextEntry * text_entry) +{ + GtkTextBuffer *buffer; + gchar *key, *field; + + gl_debug (DEBUG_WDGT, "START"); + + key = + gtk_editable_get_chars (GTK_EDITABLE (text_entry->key_entry), 0, + -1); + field = g_strdup_printf ("FIELD{%s}", key); + + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); + gtk_text_buffer_insert_at_cursor (buffer, field, -1); + + g_free (field); + g_free (key); + + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* Get widget data. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_wdgt_text_entry_get_text (glWdgtTextEntry * text_entry) +{ + GtkTextBuffer *buffer; + gchar *text; + GList *lines; + GtkTextIter start, end; + + gl_debug (DEBUG_WDGT, "START"); + + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); + + gtk_text_buffer_get_bounds (buffer, &start, &end); + + text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); + + lines = gl_text_node_lines_new_from_text (text); + + g_free (text); + + gl_debug (DEBUG_WDGT, "END"); + + return lines; +} + +/*--------------------------------------------------------------------------*/ +/* Set widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_wdgt_text_entry_set_text (glWdgtTextEntry * text_entry, + gboolean merge_flag, + GList * lines) +{ + GtkTextBuffer *buffer; + gchar *text; + + gl_debug (DEBUG_WDGT, "START"); + + gtk_widget_set_sensitive (text_entry->key_entry, merge_flag); + gtk_widget_set_sensitive (text_entry->insert_button, merge_flag); + + text = gl_text_node_lines_expand (lines, NULL); + + g_signal_handlers_block_by_func (G_OBJECT(text_entry->text_buffer), + changed_cb, text_entry); + gtk_text_buffer_set_text (text_entry->text_buffer, text, -1); + g_signal_handlers_unblock_by_func (G_OBJECT(text_entry->text_buffer), + changed_cb, text_entry); + + gl_debug (DEBUG_WDGT, "END"); +} diff --git a/glabels2/src/wdgt-text-entry.h b/glabels2/src/wdgt-text-entry.h new file mode 100644 index 00000000..e5fa697c --- /dev/null +++ b/glabels2/src/wdgt-text-entry.h @@ -0,0 +1,69 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_entry.h: text entry widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_TEXT_ENTRY_H__ +#define __WDGT_TEXT_ENTRY_H__ + +#include + +#include "merge.h" + +#define GL_TYPE_WDGT_TEXT_ENTRY (gl_wdgt_text_entry_get_type ()) +#define GL_WDGT_TEXT_ENTRY(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_TEXT_ENTRY, glWdgtTextEntry )) +#define GL_WDGT_TEXT_ENTRY_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_TEXT_ENTRY, glWdgtTextEntryClass)) +#define GL_IS_WDGT_TEXT_ENTRY(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_TEXT_ENTRY)) +#define GL_IS_WDGT_TEXT_ENTRY_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_TEXT_ENTRY)) + +typedef struct _glWdgtTextEntry glWdgtTextEntry; +typedef struct _glWdgtTextEntryClass glWdgtTextEntryClass; + +struct _glWdgtTextEntry { + GtkVBox parent_widget; + + GtkWidget *text_entry; + GtkWidget *key_entry; + GtkWidget *insert_button; + + GtkTextBuffer *text_buffer; +}; + +struct _glWdgtTextEntryClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtTextEntry * text_entry, gpointer user_data); +}; + +extern guint gl_wdgt_text_entry_get_type (void); + +extern GtkWidget *gl_wdgt_text_entry_new (gchar * label, GList * field_defs); + +extern GList *gl_wdgt_text_entry_get_text (glWdgtTextEntry * text_entry); + +extern void gl_wdgt_text_entry_set_text (glWdgtTextEntry * text_entry, + gboolean merge_flag, + GList * lines); + +#endif diff --git a/glabels2/src/wdgt-text-props.c b/glabels2/src/wdgt-text-props.c new file mode 100644 index 00000000..7dbbc65d --- /dev/null +++ b/glabels2/src/wdgt-text-props.c @@ -0,0 +1,428 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_props.c: text properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "wdgt-text-props.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtTextPropsSignal) (GObject * object, + gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_text_props_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_text_props_class_init (glWdgtTextPropsClass * class); +static void gl_wdgt_text_props_instance_init (glWdgtTextProps * text); +static void gl_wdgt_text_props_finalize (GObject * object); +static void gl_wdgt_text_props_construct (glWdgtTextProps * text, gchar * label); + +static void changed_cb (glWdgtTextProps * text); +static void just_toggled_cb (GtkToggleButton * togglebutton, + gpointer user_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_text_props_get_type (void) +{ + static guint wdgt_text_props_type = 0; + + if (!wdgt_text_props_type) { + GTypeInfo wdgt_text_props_info = { + sizeof (glWdgtTextPropsClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_text_props_class_init, + NULL, + NULL, + sizeof (glWdgtTextProps), + 0, + (GInstanceInitFunc) gl_wdgt_text_props_instance_init, + }; + + wdgt_text_props_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtTextProps", &wdgt_text_props_info, 0); + } + + return wdgt_text_props_type; +} + +static void +gl_wdgt_text_props_class_init (glWdgtTextPropsClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_text_props_finalize; + + wdgt_text_props_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtTextPropsClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_text_props_instance_init (glWdgtTextProps * text) +{ + text->font_family_entry = NULL; + text->font_size_spin = NULL; + text->font_b_button = NULL; + text->font_i_button = NULL; + + text->color_picker = NULL; + + text->left_button = NULL; + text->right_button = NULL; + text->center_button = NULL; +} + +static void +gl_wdgt_text_props_finalize (GObject * object) +{ + glWdgtTextProps *text; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_TEXT_PROPS (object)); + + text = GL_WDGT_TEXT_PROPS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_text_props_new (gchar * label) +{ + glWdgtTextProps *text; + + text = g_object_new (gl_wdgt_text_props_get_type (), NULL); + + gl_wdgt_text_props_construct (text, label); + + return GTK_WIDGET (text); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_text_props_construct (glWdgtTextProps * text, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel, *whbox1, *wcombo; + GList *family_names = NULL; + GtkObject *adjust; + + wvbox = GTK_WIDGET (text); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (3, 3, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Font label */ + wlabel = gtk_label_new (_("Font:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + /* Pack these widgets into an inner hbox */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_table_attach_defaults (GTK_TABLE (wtable), whbox1, 1, 3, 0, 1); + + /* Font family entry widget */ + wcombo = gtk_combo_new (); + family_names = gnome_font_family_list (); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), family_names); + gnome_font_family_list_free (family_names); + text->font_family_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (text->font_family_entry), FALSE); + gtk_widget_set_size_request (wcombo, 200, -1); + gtk_box_pack_start (GTK_BOX (whbox1), wcombo, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (text->font_family_entry), + "changed", G_CALLBACK (changed_cb), + G_OBJECT (text)); + + /* Font size entry widget */ + adjust = gtk_adjustment_new (1.0, 1.0, 250.0, 1.0, 10.0, 10.0); + text->font_size_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_size_spin, FALSE, + FALSE, 0); + g_signal_connect_swapped (G_OBJECT (text->font_size_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + + /* Font weight/italic button widgets */ + text->font_b_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->font_b_button), + gtk_image_new_from_stock (GTK_STOCK_BOLD, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_b_button, FALSE, FALSE, + 0); + g_signal_connect_swapped (G_OBJECT (text->font_b_button), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + text->font_i_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->font_i_button), + gtk_image_new_from_stock (GTK_STOCK_ITALIC, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_i_button, FALSE, FALSE, + 0); + g_signal_connect_swapped (G_OBJECT (text->font_i_button), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + + /* Text Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + + /* Text Color picker widget */ + text->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (text->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + gtk_table_attach_defaults (GTK_TABLE (wtable), text->color_picker, 1, 2, + 1, 2); + + /* Alignment label */ + wlabel = gtk_label_new (_("Alignment:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 2, 3); + + /* Pack these widgets into an inner hbox */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_table_attach_defaults (GTK_TABLE (wtable), whbox1, 1, 2, 2, 3); + + /* Justification entry widget */ + text->left_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->left_button), + gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_LEFT, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->left_button, FALSE, FALSE, + 0); + text->center_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->center_button), + gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_CENTER, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->center_button, FALSE, FALSE, + 0); + text->right_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->right_button), + gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->right_button, FALSE, FALSE, + 0); + + /* Now connect a callback that makes these toggles mutually exclusive */ + g_signal_connect (G_OBJECT (text->left_button), "toggled", + G_CALLBACK (just_toggled_cb), text); + g_signal_connect (G_OBJECT (text->center_button), "toggled", + G_CALLBACK (just_toggled_cb), text); + g_signal_connect (G_OBJECT (text->right_button), "toggled", + G_CALLBACK (just_toggled_cb), text); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtTextProps * text) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (text), wdgt_text_props_signals[CHANGED], 0); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Justify toggle button callback. */ +/*--------------------------------------------------------------------------*/ +static void +just_toggled_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtTextProps *text = GL_WDGT_TEXT_PROPS (user_data); + + if (gtk_toggle_button_get_active (togglebutton)) { + + if (GTK_WIDGET (togglebutton) == GTK_WIDGET (text->left_button)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->center_button), + FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->right_button), + FALSE); + } else if (GTK_WIDGET (togglebutton) == + GTK_WIDGET (text->center_button)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->left_button), + FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->right_button), + FALSE); + } else if (GTK_WIDGET (togglebutton) == + GTK_WIDGET (text->right_button)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->left_button), + FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->center_button), + FALSE); + } + + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (text), wdgt_text_props_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_text_props_get_params (glWdgtTextProps * text, + gchar ** font_family, + gdouble * font_size, + GnomeFontWeight * font_weight, + gboolean * font_italic_flag, + guint * color, + GtkJustification * just) +{ + guint8 r, g, b, a; + + /* ------ Get updated font information ------ */ + *font_family = + gtk_editable_get_chars (GTK_EDITABLE (text->font_family_entry), 0, + -1); + *font_size = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(text->font_size_spin)); + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->font_b_button))) { + *font_weight = GNOME_FONT_BOLD; + } else { + *font_weight = GNOME_FONT_BOOK; + } + *font_italic_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (text->font_i_button)); + + /* ------ Get updated color ------ */ + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (text->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); + + /* ------- Get updated justification ------ */ + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->left_button))) { + *just = GTK_JUSTIFY_LEFT; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->right_button))) { + *just = GTK_JUSTIFY_RIGHT; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->center_button))) { + *just = GTK_JUSTIFY_CENTER; + } else { + *just = GTK_JUSTIFY_LEFT; /* Should not happen. */ + } + +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_text_props_set_params (glWdgtTextProps * text, + gchar * font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just) +{ + gtk_entry_set_text (GTK_ENTRY (text->font_family_entry), font_family); + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (text->font_size_spin), + font_size); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_b_button), + (font_weight == GNOME_FONT_BOLD)); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_i_button), + font_italic_flag); + + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (text->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->left_button), + (just == GTK_JUSTIFY_LEFT)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->center_button), + (just == GTK_JUSTIFY_CENTER)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->right_button), + (just == GTK_JUSTIFY_RIGHT)); +} diff --git a/glabels2/src/wdgt-text-props.h b/glabels2/src/wdgt-text-props.h new file mode 100644 index 00000000..219e8e9b --- /dev/null +++ b/glabels2/src/wdgt-text-props.h @@ -0,0 +1,82 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_props.h: text properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_TEXT_PROPS_H__ +#define __WDGT_TEXT_PROPS_H__ + +#include +#include +#include "label.h" + +#define GL_TYPE_WDGT_TEXT_PROPS (gl_wdgt_text_props_get_type ()) +#define GL_WDGT_TEXT_PROPS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_TEXT_PROPS, glWdgtTextProps )) +#define GL_WDGT_TEXT_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_TEXT_PROPS, glWdgtTextPropsClass)) +#define GL_IS_WDGT_TEXT_PROPS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_TEXT_PROPS)) +#define GL_IS_WDGT_TEXT_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_TEXT_PROPS)) + +typedef struct _glWdgtTextProps glWdgtTextProps; +typedef struct _glWdgtTextPropsClass glWdgtTextPropsClass; + +struct _glWdgtTextProps { + GtkVBox parent_widget; + + GtkWidget *font_family_entry; + GtkWidget *font_size_spin; + GtkWidget *font_b_button; + GtkWidget *font_i_button; + + GtkWidget *color_picker; + + GtkWidget *left_button, *right_button, *center_button; +}; + +struct _glWdgtTextPropsClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtTextProps * text, gpointer user_data); +}; + +extern guint gl_wdgt_text_props_get_type (void); + +extern GtkWidget *gl_wdgt_text_props_new (gchar * label); + +extern void gl_wdgt_text_props_get_params (glWdgtTextProps * text, + gchar ** font_family, + gdouble * font_size, + GnomeFontWeight * font_weight, + gboolean * font_italic_flag, + guint * color, + GtkJustification * just); + +extern void gl_wdgt_text_props_set_params (glWdgtTextProps * text, + gchar * font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just); + +#endif diff --git a/glabels2/src/wdgt-vector.c b/glabels2/src/wdgt-vector.c new file mode 100644 index 00000000..c8f81c14 --- /dev/null +++ b/glabels2/src/wdgt-vector.c @@ -0,0 +1,306 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_vector.c: vector properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "wdgt-vector.h" +#include "prefs.h" +#include "marshal.h" + +#include "debug.h" + +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif + +#define LENGTH(x,y) sqrt( (x)*(x) + (y)*(y) ) +#define ANGLE(x,y) ( (180.0/M_PI)*atan2( -(y), (x) ) ) +#define COMP_X(l,a) ( (l) * cos( (M_PI/180.0)*(a) ) ) +#define COMP_Y(l,a) ( -(l) * sin( (M_PI/180.0)*(a) ) ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtVectorSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_vector_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_vector_class_init (glWdgtVectorClass * class); +static void gl_wdgt_vector_instance_init (glWdgtVector * vector); +static void gl_wdgt_vector_finalize (GObject * object); +static void gl_wdgt_vector_construct (glWdgtVector * vector, gchar * label); +static void changed_cb (glWdgtVector * vector); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_vector_get_type (void) +{ + static guint wdgt_vector_type = 0; + + if (!wdgt_vector_type) { + GTypeInfo wdgt_vector_info = { + sizeof (glWdgtVectorClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_vector_class_init, + NULL, + NULL, + sizeof (glWdgtVector), + 0, + (GInstanceInitFunc) gl_wdgt_vector_instance_init, + }; + + wdgt_vector_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtVector", + &wdgt_vector_info, 0); + } + + return wdgt_vector_type; +} + +static void +gl_wdgt_vector_class_init (glWdgtVectorClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_vector_finalize; + + wdgt_vector_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtVectorClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_vector_instance_init (glWdgtVector * vector) +{ + vector->len_spin = NULL; + vector->angle_spin = NULL; +} + +static void +gl_wdgt_vector_finalize (GObject * object) +{ + glWdgtVector *vector; + glWdgtVectorClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_VECTOR (object)); + + vector = GL_WDGT_VECTOR (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_vector_new (gchar * label) +{ + glWdgtVector *vector; + + vector = g_object_new (gl_wdgt_vector_get_type (), NULL); + + gl_wdgt_vector_construct (vector, label); + + return GTK_WIDGET (vector); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_vector_construct (glWdgtVector * vector, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + wvbox = GTK_WIDGET (vector); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Length label */ + wlabel = gtk_label_new (_("Length:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* Length spin */ + adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, climb_rate, + 10.0, 10.0); + vector->len_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (vector->len_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (vector->len_spin), TRUE); + g_signal_connect_swapped (G_OBJECT (vector->len_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (vector)); + gtk_table_attach_defaults (GTK_TABLE (wtable), vector->len_spin, 1, 2, + 0, 1); + /* Length units label */ + vector->len_units_label = gtk_label_new (units_string); + gtk_misc_set_alignment (GTK_MISC (vector->len_units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), vector->len_units_label, + 2, 3, 0, 1); + + /* Angle label */ + wlabel = gtk_label_new (_("Angle:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Angle spin */ + adjust = gtk_adjustment_new (0.0, -180.0, +180.0, 1.0, 10.0, 10.0); + vector->angle_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (vector->angle_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (vector->angle_spin), + TRUE); + g_signal_connect_swapped (G_OBJECT (vector->angle_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (vector)); + gtk_table_attach_defaults (GTK_TABLE (wtable), vector->angle_spin, 1, 2, + 1, 2); + /* Angle units label */ + vector->angle_units_label = gtk_label_new (_("degrees")); + gtk_misc_set_alignment (GTK_MISC (vector->angle_units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), + vector->angle_units_label, 2, 3, 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtVector * vector) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (vector), wdgt_vector_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_vector_get_params (glWdgtVector * vector, + gdouble * dx, + gdouble * dy) +{ + gdouble length, angle; + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + length = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(vector->len_spin)); + angle = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(vector->angle_spin)); + + length /= units_per_point; + + *dx = COMP_X (length, angle); + *dy = COMP_Y (length, angle); +} + +/*====================================================================*/ +/* set values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_vector_set_params (glWdgtVector * vector, + gdouble dx, + gdouble dy, + gdouble x_max, + gdouble y_max) +{ + GtkObject *length_adjust; + gdouble length, angle; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + /* Put everything into our display units */ + dx *= units_per_point; + dy *= units_per_point; + x_max *= units_per_point; + y_max *= units_per_point; + + length = LENGTH (dx, dy); + angle = ANGLE (dx, dy); + + length_adjust = gtk_adjustment_new (length, 0.0, LENGTH (x_max, y_max), + climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (vector->len_spin), + GTK_ADJUSTMENT (length_adjust), + climb_rate, digits); + gtk_spin_button_update (GTK_SPIN_BUTTON (vector->len_spin)); + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (vector->angle_spin), angle); +} diff --git a/glabels2/src/wdgt-vector.h b/glabels2/src/wdgt-vector.h new file mode 100644 index 00000000..b3d57ad9 --- /dev/null +++ b/glabels2/src/wdgt-vector.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_vector.h: vector properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_VECTOR_H__ +#define __WDGT_VECTOR_H__ + +#include +#include "label.h" + +#define GL_TYPE_WDGT_VECTOR (gl_wdgt_vector_get_type ()) +#define GL_WDGT_VECTOR(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_VECTOR, glWdgtVector )) +#define GL_WDGT_VECTOR_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_VECTOR, glWdgtVectorClass)) +#define GL_IS_WDGT_VECTOR(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_VECTOR)) +#define GL_IS_WDGT_VECTOR_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_VECTOR)) + +typedef struct _glWdgtVector glWdgtVector; +typedef struct _glWdgtVectorClass glWdgtVectorClass; + +struct _glWdgtVector { + GtkVBox parent_widget; + + GtkWidget *len_spin; + GtkWidget *len_units_label; + GtkWidget *angle_spin; + GtkWidget *angle_units_label; +}; + +struct _glWdgtVectorClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtVector * vector, gpointer user_data); +}; + +extern guint gl_wdgt_vector_get_type (void); + +extern GtkWidget *gl_wdgt_vector_new (gchar * label); + +extern void gl_wdgt_vector_get_params (glWdgtVector * vector, + gdouble * dx, gdouble * dy); + +extern void gl_wdgt_vector_set_params (glWdgtVector * vector, + gdouble dx, gdouble dy, + gdouble x_max, gdouble y_max); + +#endif diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c new file mode 100644 index 00000000..ecbb6cb1 --- /dev/null +++ b/glabels2/src/xml-label.c @@ -0,0 +1,1116 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.c: GLabels xml label module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include +#include + +#include "label.h" +#include "label-object.h" +#include "label-text.h" +#include "label-box.h" +#include "label-line.h" +#include "label-ellipse.h" +#include "label-image.h" +#include "label-barcode.h" +#include "template.h" +#include "xml-label.h" +#include "util.h" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define NAME_SPACE "http://snaught.com/glabels/1.90/" +#define COMPAT01_NAME_SPACE "http://snaught.com/glabels/0.1/" +#define COMPAT04_NAME_SPACE "http://snaught.com/glabels/0.4/" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static glLabel *xml_doc_to_label (xmlDocPtr doc, glXMLLabelStatus *status); +static glLabel *xml_parse_label (xmlNodePtr root, glXMLLabelStatus *status); +static void xml_parse_objects (xmlNodePtr node, glLabel * label); +static void xml_parse_object(xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_text_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_box_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_line_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_ellipse_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_image_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_barcode_props (xmlNodePtr node, glLabel *label); +static void xml_parse_merge_fields (xmlNodePtr node, glLabel *label); + +static xmlDocPtr xml_label_to_doc (glLabel * label, glXMLLabelStatus *status); +static void xml_create_objects (xmlNodePtr root, xmlNsPtr ns, glLabel * label); +static void xml_create_object (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_text_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_box_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_line_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_ellipse_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_image_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_barcode_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_merge_fields (xmlNodePtr root, xmlNsPtr ns, + glLabel * label); + +/****************************************************************************/ +/* Open and read label from xml file. */ +/****************************************************************************/ +glLabel * +gl_xml_label_open (const gchar * filename, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + glLabel *label; + + gl_debug (DEBUG_XML, "START"); + + doc = xmlParseFile (filename); + if (!doc) { + g_warning (_("xmlParseFile error")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + label = xml_doc_to_label (doc, status); + + xmlFreeDoc (doc); + + gl_label_set_filename (label, filename); + gl_label_clear_modified (label); + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/****************************************************************************/ +/* Read label from xml buffer. */ +/****************************************************************************/ +glLabel * +gl_xml_label_open_buffer (const gchar * buffer, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + glLabel *label; + + gl_debug (DEBUG_XML, "START"); + + doc = xmlParseDoc ((xmlChar *) buffer); + if (!doc) { + g_warning (_("xmlParseFile error")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + label = xml_doc_to_label (doc, status); + + gl_label_clear_modified (label); + + xmlFreeDoc (doc); + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse xml doc structure and create label. */ +/*--------------------------------------------------------------------------*/ +static glLabel * +xml_doc_to_label (xmlDocPtr doc, + glXMLLabelStatus *status) +{ + xmlNodePtr root, node; + xmlNsPtr ns; + glLabel *label; + + gl_debug (DEBUG_XML, "START"); + + LIBXML_TEST_VERSION; + + *status = XML_LABEL_OK; + + root = xmlDocGetRootElement (doc); + if (!root || !root->name) { + g_warning (_("No document root")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + ns = xmlSearchNsByHref (doc, root, NAME_SPACE); + if (ns != NULL) { + label = xml_parse_label (root, status); + } else { + /* Try compatability mode 0.1 */ + ns = xmlSearchNsByHref (doc, root, COMPAT01_NAME_SPACE); + if (ns != NULL) { + g_warning (_("Importing from glabels 0.1 format")); + g_warning ("TODO"); + label = NULL; /* TODO */ + } else { + /* Try compatability mode 0.4 */ + ns = xmlSearchNsByHref (doc, root, + COMPAT04_NAME_SPACE); + if (ns != NULL) { + g_warning (_("Importing from glabels 0.4 format")); + g_warning ("TODO"); + label = NULL; /* TODO */ + } else { + g_warning (_("bad document, unknown glabels Namespace")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + } + } + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse xml root node and create label. */ +/*--------------------------------------------------------------------------*/ +static glLabel * +xml_parse_label (xmlNodePtr root, + glXMLLabelStatus *status) +{ + xmlNodePtr node; + glLabel *label; + glTemplate *template; + + gl_debug (DEBUG_XML, "START"); + + *status = XML_LABEL_OK; + + if (g_strcasecmp (root->name, "Document") != 0) { + g_warning (_("Bad root node = \"%s\""), root->name); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + label = GL_LABEL(gl_label_new ()); + + for (node = root->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Sheet") == 0) { + template = gl_template_xml_parse_sheet (node); + if (!template) { + *status = XML_LABEL_UNKNOWN_MEDIA; + return NULL; + } + gl_label_set_template (label, template); + gl_template_free (&template); + } else if (g_strcasecmp (node->name, "Objects") == 0) { + xml_parse_objects (node, label); + } else if (g_strcasecmp (node->name, "Merge_Fields") == 0) { + xml_parse_merge_fields (node, label); + } else { + if (!xmlNodeIsText (node)) { + g_warning (_("bad node = \"%s\""), node->name); + } + } + } + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse Objects node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_objects (xmlNodePtr objects_node, + glLabel * label) +{ + gboolean rotate_flag; + xmlNodePtr node; + + gl_debug (DEBUG_XML, "START"); + + rotate_flag = + !(g_strcasecmp (xmlGetProp (objects_node, "rotate"), "false") == 0); + gl_label_set_rotate_flag (label, rotate_flag); + + for (node = objects_node->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Object") == 0) { + xml_parse_object (node, label); + } else { + if (!xmlNodeIsText (node)) { + g_warning (_("bad node = \"%s\""), node->name); + } + } + } + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Object Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_object (xmlNodePtr object_node, + glLabel * label) +{ + glLabelObject *object; + gdouble x, y; + gchar *type_string; + + gl_debug (DEBUG_XML, "START"); + + type_string = xmlGetProp (object_node, "type"); + + if ( g_strcasecmp (type_string, "text") == 0 ) { + object = xml_parse_text_props (object_node, label); + } else if ( g_strcasecmp (type_string, "box") == 0 ) { + object = xml_parse_box_props (object_node, label); + } else if ( g_strcasecmp (type_string, "line") == 0 ) { + object = xml_parse_line_props (object_node, label); + } else if ( g_strcasecmp (type_string, "ellipse") == 0 ) { + object = xml_parse_ellipse_props (object_node, label); + } else if ( g_strcasecmp (type_string, "image") == 0 ) { + object = xml_parse_image_props (object_node, label); + } else if ( g_strcasecmp (type_string, "barcode") == 0 ) { + object = xml_parse_barcode_props (object_node, label); + } else { + g_warning ("Unknown label object type \"%s\"", type_string); + return; + } + + x = g_strtod (xmlGetProp (object_node, "x"), NULL); + y = g_strtod (xmlGetProp (object_node, "y"), NULL); + + gl_label_object_set_position (object, x, y); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Text Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_text_props (xmlNodePtr object_node, + glLabel * label) +{ + GObject *object; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + xmlNodePtr line_node, text_node; + glTextNode *node_text; + GList *nodes; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_text_new (label); + + font_family = xmlGetProp (object_node, "font_family"); + font_size = g_strtod (xmlGetProp (object_node, "font_size"), NULL); + font_weight = gl_util_string_to_weight (xmlGetProp (object_node, + "font_weight")); + font_italic_flag = + !(g_strcasecmp (xmlGetProp (object_node, "font_italic"), "false") == + 0); + + just = gl_util_string_to_just (xmlGetProp (object_node, "justify")); + + sscanf (xmlGetProp (object_node, "color"), "%x", &color); + + lines = NULL; + for (line_node = object_node->xmlChildrenNode; + line_node != NULL; + line_node = line_node->next) { + + if (g_strcasecmp (line_node->name, "Line") == 0) { + + nodes = NULL; + for (text_node = line_node->xmlChildrenNode; + text_node != NULL; text_node = text_node->next) { + + if (g_strcasecmp (text_node->name, "Field") == + 0) { + node_text = g_new0 (glTextNode, 1); + node_text->field_flag = TRUE; + node_text->data = + xmlGetProp (text_node, "name"); + nodes = + g_list_append (nodes, node_text); + } else if (xmlNodeIsText (text_node)) { + node_text = g_new0 (glTextNode, 1); + node_text->field_flag = FALSE; + node_text->data = + xmlNodeGetContent (text_node); + nodes = + g_list_append (nodes, node_text); + } else { + g_warning ("Unexpected Text Line child: \"%s\"", + text_node->name); + } + + } + lines = g_list_append (lines, nodes); + + } else if (!xmlNodeIsText (line_node)) { + g_warning ("Unexpected Text child: \"%s\"", + line_node->name); + } + + } + + gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); + gl_label_text_set_props (GL_LABEL_TEXT(object), + font_family, font_size, font_weight, + font_italic_flag, + color, just); + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Box Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_box_props (xmlNodePtr node, + glLabel * label) +{ + GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_box_new (label); + + w = g_strtod (xmlGetProp (node, "w"), NULL); + h = g_strtod (xmlGetProp (node, "h"), NULL); + + line_width = g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", &line_color); + sscanf (xmlGetProp (node, "fill_color"), "%x", &fill_color); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_box_set_line_width (GL_LABEL_BOX(object), line_width); + gl_label_box_set_line_color (GL_LABEL_BOX(object), line_color); + gl_label_box_set_fill_color (GL_LABEL_BOX(object), fill_color); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Line Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_line_props (xmlNodePtr node, + glLabel * label) +{ + GObject *object; + gdouble line_width; + guint line_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_line_new (label); + + w = g_strtod (xmlGetProp (node, "dx"), NULL); + h = g_strtod (xmlGetProp (node, "dy"), NULL); + + line_width = g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", &line_color); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_line_set_line_width (GL_LABEL_LINE(object), line_width); + gl_label_line_set_line_color (GL_LABEL_LINE(object), line_color); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Ellipse Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_ellipse_props (xmlNodePtr node, + glLabel * label) +{ + GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_ellipse_new (label); + + w = g_strtod (xmlGetProp (node, "w"), NULL); + h = g_strtod (xmlGetProp (node, "h"), NULL); + + line_width = g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", &line_color); + sscanf (xmlGetProp (node, "fill_color"), "%x", &fill_color); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), line_width); + gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), line_color); + gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), fill_color); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Image Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_image_props (xmlNodePtr node, + glLabel *label) +{ + GObject *object; + gdouble w, h; + gchar *filename; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_image_new (label); + + w = g_strtod (xmlGetProp (node, "w"), NULL); + h = g_strtod (xmlGetProp (node, "h"), NULL); + + filename = xmlNodeGetContent (node); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename); + + g_free (filename); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Barcode Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_barcode_props (xmlNodePtr node, + glLabel *label) +{ + GObject *object; + xmlNodePtr child; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_barcode_new (label); + + sscanf (xmlGetProp (node, "color"), "%x", &color); + + style = gl_barcode_text_to_style (xmlGetProp (node, "style")); + text_flag = !(g_strcasecmp (xmlGetProp (node, "text"), "false") == 0); + scale = g_strtod (xmlGetProp (node, "scale"), NULL); + + child = node->xmlChildrenNode; + text_node = g_new0 (glTextNode, 1); + if (g_strcasecmp (child->name, "Field") == 0) { + text_node->field_flag = TRUE; + text_node->data = xmlGetProp (child, "name"); + } else if (xmlNodeIsText (child)) { + text_node->field_flag = FALSE; + text_node->data = xmlNodeGetContent (child); + } else { + g_warning ("Unexpected Barcode child: \"%s\"", child->name); + } + + gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + style, text_flag, color, scale); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML merge fields tag. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_merge_fields (xmlNodePtr node, + glLabel * label) +{ + xmlNodePtr child; + glMerge *merge; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_XML, "START"); + + merge = gl_merge_new (); + + merge->type = gl_merge_text_to_type (xmlGetProp (node, "type")); + merge->src = xmlGetProp (node, "src"); + + for (child = node->xmlChildrenNode; child != NULL; child = child->next) { + + if (g_strcasecmp (child->name, "Field") == 0) { + field_def = g_new0 (glMergeFieldDefinition, 1); + field_def->key = xmlGetProp (child, "key"); + field_def->loc = xmlGetProp (child, "loc"); + merge->field_defs = + g_list_append (merge->field_defs, + field_def); + } else if (!xmlNodeIsText (child)) { + g_warning ("Unexpected Merge_Fields child: \"%s\"", + child->name); + } + + } + + gl_label_set_merge (label, merge); + + gl_merge_free (&merge); + + gl_debug (DEBUG_XML, "END"); +} + +/****************************************************************************/ +/* Save label to xml label file. */ +/****************************************************************************/ +void +gl_xml_label_save (glLabel *label, + const gchar *filename, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + gint xml_ret; + + gl_debug (DEBUG_XML, "START"); + + doc = xml_label_to_doc (label, status); + + xml_ret = xmlSaveFormatFile (filename, doc, TRUE); + xmlFreeDoc (doc); + if (xml_ret == -1) { + g_warning (_("Problem saving xml file.")); + *status = XML_LABEL_ERROR_SAVE_FILE; + } + + gl_label_set_filename (label, filename); + gl_label_clear_modified (label); + + gl_debug (DEBUG_XML, "END"); +} + +/****************************************************************************/ +/* Save label to xml buffer. */ +/****************************************************************************/ +gchar * +gl_xml_label_save_buffer (glLabel *label, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + gint size; + gchar *buffer; + + gl_debug (DEBUG_XML, "START"); + + doc = xml_label_to_doc (label, status); + + xmlDocDumpMemory (doc, (xmlChar **)&buffer, &size); + xmlFreeDoc (doc); + + gl_label_clear_modified (label); + + gl_debug (DEBUG_XML, "END"); + + return buffer; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Convert label to xml doc structure. */ +/*--------------------------------------------------------------------------*/ +static xmlDocPtr +xml_label_to_doc (glLabel * label, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + xmlNsPtr ns; + glTemplate *template; + glMerge *merge; + + gl_debug (DEBUG_XML, "START"); + + LIBXML_TEST_VERSION; + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Document", NULL); + + ns = xmlNewNs (doc->xmlRootNode, NAME_SPACE, "glabels"); + xmlSetNs (doc->xmlRootNode, ns); + + template = gl_label_get_template (label); + gl_template_xml_add_sheet (template, doc->xmlRootNode, ns); + + xml_create_objects (doc->xmlRootNode, ns, label); + + merge = gl_label_get_merge (label); + gl_debug (DEBUG_XML, "merge=%p", merge); + if (merge->type != GL_MERGE_NONE) { + xml_create_merge_fields (doc->xmlRootNode, ns, label); + } + gl_merge_free (&merge); + + gl_debug (DEBUG_XML, "END"); + + *status = XML_LABEL_OK; + return doc; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Objects Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_objects (xmlNodePtr root, + xmlNsPtr ns, + glLabel * label) +{ + xmlNodePtr node; + gboolean rotate_flag; + GList *p; + + gl_debug (DEBUG_XML, "START"); + + rotate_flag = gl_label_get_rotate_flag (label); + + node = xmlNewChild (root, ns, "Objects", NULL); + xmlSetProp (node, "id", "0"); + xmlSetProp (node, "rotate", rotate_flag ? "True" : "False"); + + for (p = label->objects; p != NULL; p = p->next) { + xml_create_object (node, ns, GL_LABEL_OBJECT(p->data)); + } + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML label object Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_object (xmlNodePtr root, + xmlNsPtr ns, + glLabelObject * object) +{ + xmlNodePtr object_node; + gdouble x, y; + gchar *string; + + gl_debug (DEBUG_XML, "START"); + + object_node = xmlNewChild (root, ns, "Object", NULL); + + gl_label_object_get_position (object, &x, &y); + string = g_strdup_printf ("%g", x); + xmlSetProp (object_node, "x", string); + g_free (string); + string = g_strdup_printf ("%g", y); + xmlSetProp (object_node, "y", string); + g_free (string); + + if ( GL_IS_LABEL_TEXT(object) ) { + xml_create_text_props (object_node, ns, object); + } else if ( GL_IS_LABEL_BOX(object) ) { + xml_create_box_props (object_node, ns, object); + } else if ( GL_IS_LABEL_LINE(object) ) { + xml_create_line_props (object_node, ns, object); + } else if ( GL_IS_LABEL_ELLIPSE(object) ) { + xml_create_ellipse_props (object_node, ns, object); + } else if ( GL_IS_LABEL_IMAGE(object) ) { + xml_create_image_props (object_node, ns, object); + } else if ( GL_IS_LABEL_BARCODE(object) ) { + xml_create_barcode_props (object_node, ns, object); + } else { + g_warning ("Unknown label object"); + } + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Text Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_text_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + xmlNodePtr line_node, field_node; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + gchar *string; + GList *p_line, *p_node; + glTextNode *node_text; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Text"); + + lines = gl_label_text_get_lines (GL_LABEL_TEXT(object)); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + xmlSetProp (object_node, "font_family", font_family); + string = g_strdup_printf ("%g", font_size); + xmlSetProp (object_node, "font_size", string); + g_free (string); + xmlSetProp (object_node, "font_weight", + gl_util_weight_to_string (font_weight)); + xmlSetProp (object_node, "font_italic", + font_italic_flag?"True":"False"); + + xmlSetProp (object_node, "justify", gl_util_just_to_string (just)); + + string = g_strdup_printf ("0x%08x", color); + xmlSetProp (object_node, "color", string); + g_free (string); + + for (p_line = lines; p_line != NULL; p_line = p_line->next) { + line_node = xmlNewChild (object_node, ns, "Line", NULL); + + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + node_text = (glTextNode *) p_node->data; + + if (node_text->field_flag) { + field_node = + xmlNewChild (line_node, ns, "Field", NULL); + xmlSetProp (field_node, "name", + node_text->data); + } else { + xmlNodeAddContent (line_node, node_text->data); + } + + } + + } + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Box Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_box_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Box"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width (GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color (GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color (GL_LABEL_BOX(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "w", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "h", string); + g_free (string); + + string = g_strdup_printf ("%g", line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", fill_color); + xmlSetProp (object_node, "fill_color", string); + g_free (string); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Line Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_line_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble line_width; + guint line_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Line"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width (GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color (GL_LABEL_LINE(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "dx", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "dy", string); + g_free (string); + + string = g_strdup_printf ("%g", line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Ellipse Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_ellipse_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Ellipse"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width (GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color (GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color (GL_LABEL_ELLIPSE(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "w", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "h", string); + g_free (string); + + string = g_strdup_printf ("%g", line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", fill_color); + xmlSetProp (object_node, "fill_color", string); + g_free (string); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Image Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_image_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble w, h; + gchar *filename; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Image"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "w", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "h", string); + g_free (string); + + xmlNodeSetContent (object_node, filename); + + g_free (filename); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Barcode Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_barcode_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + xmlNodePtr child; + gchar *string; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Barcode"); + + text_node = gl_label_barcode_get_data (GL_LABEL_BARCODE(object)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + + string = g_strdup_printf ("0x%08x", color); + xmlSetProp (object_node, "color", string); + g_free (string); + + xmlSetProp (object_node, "style", gl_barcode_style_to_text (style)); + xmlSetProp (object_node, "text", text_flag?"True":"False"); + string = g_strdup_printf ("%g", scale); + xmlSetProp (object_node, "scale", string); + g_free (string); + + if (text_node->field_flag) { + child = xmlNewChild (object_node, ns, "Field", NULL); + xmlSetProp (child, "name", text_node->data); + } else { + xmlNodeSetContent (object_node, text_node->data); + } + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label Merge Fields Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_merge_fields (xmlNodePtr root, + xmlNsPtr ns, + glLabel * label) +{ + xmlNodePtr node, child; + gchar *string; + GList *p; + glMerge *merge; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_XML, "START"); + + merge = gl_label_get_merge (label); + + node = xmlNewChild (root, ns, "Merge_Fields", NULL); + + string = gl_merge_type_to_text (merge->type); + xmlSetProp (node, "type", string); + g_free (string); + + xmlSetProp (node, "src", merge->src); + + for (p = merge->field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + child = xmlNewChild (node, ns, "Field", NULL); + xmlSetProp (child, "key", field_def->key); + xmlSetProp (child, "loc", field_def->loc); + } + + gl_merge_free (&merge); + + gl_debug (DEBUG_XML, "END"); +} + diff --git a/glabels2/src/xml-label.h b/glabels2/src/xml-label.h new file mode 100644 index 00000000..5ab1e5e4 --- /dev/null +++ b/glabels2/src/xml-label.h @@ -0,0 +1,53 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.h: GLabels label module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __XML_LABEL_H__ +#define __XML_LABEL_H__ + +#include "label.h" + +G_BEGIN_DECLS + + +typedef enum { + XML_LABEL_UNKNOWN_MEDIA = 1, + XML_LABEL_OK = 0, + XML_LABEL_ERROR_OPEN_PARSE = -10, + XML_LABEL_ERROR_SAVE_FILE = -20, +} glXMLLabelStatus; + + +extern glLabel *gl_xml_label_open (const gchar * filename, + glXMLLabelStatus *status); +extern glLabel *gl_xml_label_open_buffer (const gchar * buffer, + glXMLLabelStatus *status); + +extern void gl_xml_label_save (glLabel * label, + const gchar * filename, + glXMLLabelStatus *status); +extern gchar *gl_xml_label_save_buffer (glLabel * label, + glXMLLabelStatus *status); + + +G_END_DECLS + + +#endif /* __XML_LABEL_H__ */ diff --git a/glabels2/stamp-h.in b/glabels2/stamp-h.in new file mode 100644 index 00000000..9788f702 --- /dev/null +++ b/glabels2/stamp-h.in @@ -0,0 +1 @@ +timestamp -- 2.39.5