From 8805e6b17b1460f3316ccb28629e8ad78e4b9c2c Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 15 Feb 2010 18:34:54 +0000 Subject: Added abandoned KDE3 version of kbarcode git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbarcode@1090667 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- AUTHORS | 2 + COPYING | 340 + COPYING.barcode_ps | 32 + ChangeLog | 431 + Doxyfile | 246 + INSTALL | 167 + Makefile.am | 26 + Makefile.cvs | 10 + NEWS | 1 + README | 59 + TODO | 60 + acinclude.m4 | 11862 ++++++++++++++++++++++++++++ aclocal.m4 | 863 ++ config.h.in | 244 + configure.files | 2 + configure.in | 122 + configure.in.in | 6 + fileplugin/Makefile.am | 18 + fileplugin/kfile_kbarcode.cpp | 84 + fileplugin/kfile_kbarcode.desktop | 9 + fileplugin/kfile_kbarcode.h | 23 + kbarcode.kdevelop | 193 + kbarcode.spec | 50 + kbarcode/Makefile.am | 58 + kbarcode/barcode.ps | 3563 +++++++++ kbarcode/barcodecombo.cpp | 341 + kbarcode/barcodecombo.h | 144 + kbarcode/barcodedialog.cpp | 218 + kbarcode/barcodedialog.h | 79 + kbarcode/barcodedialogs.cpp | 506 ++ kbarcode/barcodedialogs.h | 180 + kbarcode/barcodeitem.cpp | 253 + kbarcode/barcodeitem.h | 57 + kbarcode/barcodeprinterdlg.cpp | 125 + kbarcode/barcodeprinterdlg.h | 55 + kbarcode/barcodes.html | 868 ++ kbarcode/barkode.cpp | 968 +++ kbarcode/barkode.h | 297 + kbarcode/barkodeengine.cpp | 55 + kbarcode/barkodeengine.h | 103 + kbarcode/batchiface.h | 46 + kbarcode/batchprinter.cpp | 542 ++ kbarcode/batchprinter.h | 212 + kbarcode/batchwizard.cpp | 1263 +++ kbarcode/batchwizard.h | 266 + kbarcode/commands.cpp | 604 ++ kbarcode/commands.h | 433 + kbarcode/configdialog.cpp | 351 + kbarcode/configdialog.h | 95 + kbarcode/confwizard.cpp | 255 + kbarcode/confwizard.h | 101 + kbarcode/csvfile.cpp | 168 + kbarcode/csvfile.h | 151 + kbarcode/csvimportdlg.cpp | 430 + kbarcode/csvimportdlg.h | 127 + kbarcode/databasebrowser.cpp | 204 + kbarcode/databasebrowser.h | 69 + kbarcode/definition.cpp | 579 ++ kbarcode/definition.h | 101 + kbarcode/definitiondialog.cpp | 428 + kbarcode/definitiondialog.h | 99 + kbarcode/documentitem.cpp | 245 + kbarcode/documentitem.h | 230 + kbarcode/documentitemdlg.cpp | 121 + kbarcode/documentitemdlg.h | 47 + kbarcode/dsmainwindow.cpp | 268 + kbarcode/dsmainwindow.h | 90 + kbarcode/dsrichtext.cpp | 427 + kbarcode/dsrichtext.h | 193 + kbarcode/dstextedit.cpp | 147 + kbarcode/dstextedit.h | 55 + kbarcode/editoriface.h | 55 + kbarcode/encodingcombo.cpp | 47 + kbarcode/encodingcombo.h | 35 + kbarcode/exampledata.sql | 10 + kbarcode/gnubarcode.cpp | 348 + kbarcode/gnubarcode.h | 75 + kbarcode/gnubarkodeengine.cpp | 37 + kbarcode/gnubarkodeengine.h | 46 + kbarcode/hi16-action-barcode.png | Bin 0 -> 105 bytes kbarcode/hi16-action-kbarcodeellipse.png | Bin 0 -> 380 bytes kbarcode/hi16-action-kbarcodegrid.png | Bin 0 -> 108 bytes kbarcode/hi16-action-kbarcodelinetool.png | Bin 0 -> 344 bytes kbarcode/hi16-app-kbarcode.png | Bin 0 -> 460 bytes kbarcode/hi22-action-barcode.png | Bin 0 -> 124 bytes kbarcode/hi32-action-barcode.png | Bin 0 -> 124 bytes kbarcode/hi32-action-kbarcoderect.png | Bin 0 -> 157 bytes kbarcode/hi32-app-kbarcode.png | Bin 0 -> 1065 bytes kbarcode/hi64-app-kbarcode.png | Bin 0 -> 2706 bytes kbarcode/imageitem.cpp | 307 + kbarcode/imageitem.h | 79 + kbarcode/kactionmap.cpp | 188 + kbarcode/kactionmap.h | 101 + kbarcode/kbarcode-batch.desktop | 12 + kbarcode/kbarcode-editor.desktop | 14 + kbarcode/kbarcode-label.desktop | 9 + kbarcode/kbarcode-single.desktop | 12 + kbarcode/kbarcode.cpp | 292 + kbarcode/kbarcode.desktop | 13 + kbarcode/kbarcode.h | 98 + kbarcode/kbarcodeiface.h | 46 + kbarcode/kbarcodesettings.cpp | 106 + kbarcode/kbarcodesettings.h | 65 + kbarcode/label.cpp | 303 + kbarcode/label.h | 77 + kbarcode/labeldefinitions.sql | 1710 ++++ kbarcode/labeleditor.cpp | 1192 +++ kbarcode/labeleditor.h | 251 + kbarcode/labelutils.cpp | 188 + kbarcode/labelutils.h | 61 + kbarcode/lineitem.cpp | 67 + kbarcode/lineitem.h | 44 + kbarcode/logo.png | Bin 0 -> 2383 bytes kbarcode/main.cpp | 121 + kbarcode/measurements.cpp | 164 + kbarcode/measurements.h | 134 + kbarcode/mimesources.cpp | 129 + kbarcode/mimesources.h | 41 + kbarcode/multilineeditdlg.cpp | 312 + kbarcode/multilineeditdlg.h | 85 + kbarcode/mybarcode.cpp | 620 ++ kbarcode/mybarcode.h | 304 + kbarcode/mycanvasitem.cpp | 54 + kbarcode/mycanvasitem.h | 52 + kbarcode/mycanvasview.cpp | 611 ++ kbarcode/mycanvasview.h | 175 + kbarcode/mydatatable.cpp | 44 + kbarcode/mydatatable.h | 37 + kbarcode/newlabel.cpp | 248 + kbarcode/newlabel.h | 79 + kbarcode/pixmapbarcode.cpp | 492 ++ kbarcode/pixmapbarcode.h | 136 + kbarcode/previewdialog.cpp | 219 + kbarcode/previewdialog.h | 76 + kbarcode/printersettings.cpp | 199 + kbarcode/printersettings.h | 95 + kbarcode/printlabeldlg.cpp | 78 + kbarcode/printlabeldlg.h | 69 + kbarcode/propertywidget.cpp | 631 ++ kbarcode/propertywidget.h | 210 + kbarcode/purepostscript.cpp | 240 + kbarcode/purepostscript.h | 90 + kbarcode/rectitem.cpp | 159 + kbarcode/rectitem.h | 71 + kbarcode/rectsettingsdlg.cpp | 183 + kbarcode/rectsettingsdlg.h | 71 + kbarcode/referencecounted.cpp | 23 + kbarcode/referencecounted.h | 64 + kbarcode/rules.xml | 159 + kbarcode/semantic.cache | 39 + kbarcode/smalldialogs.cpp | 151 + kbarcode/smalldialogs.h | 72 + kbarcode/sqltables.cpp | 654 ++ kbarcode/sqltables.h | 222 + kbarcode/tbarcode2.cpp | 158 + kbarcode/tbarcode2.h | 89 + kbarcode/tcanvasitem.cpp | 221 + kbarcode/tcanvasitem.h | 57 + kbarcode/tec.cpp | 658 ++ kbarcode/tec.h | 69 + kbarcode/textitem.cpp | 252 + kbarcode/textitem.h | 61 + kbarcode/textlineedit.cpp | 210 + kbarcode/textlineedit.h | 78 + kbarcode/textlineitem.cpp | 246 + kbarcode/textlineitem.h | 64 + kbarcode/tokendialog.cpp | 477 ++ kbarcode/tokendialog.h | 129 + kbarcode/tokenprovider.cpp | 936 +++ kbarcode/tokenprovider.h | 250 + kbarcode/xmlutils.cpp | 489 ++ kbarcode/xmlutils.h | 72 + kbarcode/zplutils.cpp | 445 ++ kbarcode/zplutils.h | 137 + po/Makefile.am | 2 + po/de.po | 2481 ++++++ po/el.po | 2736 +++++++ po/es.po | 3087 ++++++++ po/fi.po | 3089 ++++++++ po/fr.po | 2608 ++++++ po/hu.po | 3081 ++++++++ po/it.po | 3089 ++++++++ po/nl.po | 2869 +++++++ po/pl.po | 2828 +++++++ po/sv.po | 3059 +++++++ po/tr.po | 2476 ++++++ stamp-h.in | 0 subdirs | 3 + 188 files changed, 81074 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 COPYING.barcode_ps create mode 100644 ChangeLog create mode 100644 Doxyfile create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.cvs create mode 100644 NEWS create mode 100644 README create mode 100644 TODO create mode 100644 acinclude.m4 create mode 100644 aclocal.m4 create mode 100644 config.h.in create mode 100644 configure.files create mode 100644 configure.in create mode 100644 configure.in.in create mode 100644 fileplugin/Makefile.am create mode 100644 fileplugin/kfile_kbarcode.cpp create mode 100644 fileplugin/kfile_kbarcode.desktop create mode 100644 fileplugin/kfile_kbarcode.h create mode 100644 kbarcode.kdevelop create mode 100644 kbarcode.spec create mode 100644 kbarcode/Makefile.am create mode 100644 kbarcode/barcode.ps create mode 100644 kbarcode/barcodecombo.cpp create mode 100644 kbarcode/barcodecombo.h create mode 100644 kbarcode/barcodedialog.cpp create mode 100644 kbarcode/barcodedialog.h create mode 100644 kbarcode/barcodedialogs.cpp create mode 100644 kbarcode/barcodedialogs.h create mode 100644 kbarcode/barcodeitem.cpp create mode 100644 kbarcode/barcodeitem.h create mode 100644 kbarcode/barcodeprinterdlg.cpp create mode 100644 kbarcode/barcodeprinterdlg.h create mode 100644 kbarcode/barcodes.html create mode 100644 kbarcode/barkode.cpp create mode 100644 kbarcode/barkode.h create mode 100644 kbarcode/barkodeengine.cpp create mode 100644 kbarcode/barkodeengine.h create mode 100644 kbarcode/batchiface.h create mode 100644 kbarcode/batchprinter.cpp create mode 100644 kbarcode/batchprinter.h create mode 100644 kbarcode/batchwizard.cpp create mode 100644 kbarcode/batchwizard.h create mode 100644 kbarcode/commands.cpp create mode 100644 kbarcode/commands.h create mode 100644 kbarcode/configdialog.cpp create mode 100644 kbarcode/configdialog.h create mode 100644 kbarcode/confwizard.cpp create mode 100644 kbarcode/confwizard.h create mode 100644 kbarcode/csvfile.cpp create mode 100644 kbarcode/csvfile.h create mode 100644 kbarcode/csvimportdlg.cpp create mode 100644 kbarcode/csvimportdlg.h create mode 100644 kbarcode/databasebrowser.cpp create mode 100644 kbarcode/databasebrowser.h create mode 100644 kbarcode/definition.cpp create mode 100644 kbarcode/definition.h create mode 100644 kbarcode/definitiondialog.cpp create mode 100644 kbarcode/definitiondialog.h create mode 100644 kbarcode/documentitem.cpp create mode 100644 kbarcode/documentitem.h create mode 100644 kbarcode/documentitemdlg.cpp create mode 100644 kbarcode/documentitemdlg.h create mode 100644 kbarcode/dsmainwindow.cpp create mode 100644 kbarcode/dsmainwindow.h create mode 100644 kbarcode/dsrichtext.cpp create mode 100644 kbarcode/dsrichtext.h create mode 100644 kbarcode/dstextedit.cpp create mode 100644 kbarcode/dstextedit.h create mode 100644 kbarcode/editoriface.h create mode 100644 kbarcode/encodingcombo.cpp create mode 100644 kbarcode/encodingcombo.h create mode 100644 kbarcode/exampledata.sql create mode 100644 kbarcode/gnubarcode.cpp create mode 100644 kbarcode/gnubarcode.h create mode 100644 kbarcode/gnubarkodeengine.cpp create mode 100644 kbarcode/gnubarkodeengine.h create mode 100644 kbarcode/hi16-action-barcode.png create mode 100644 kbarcode/hi16-action-kbarcodeellipse.png create mode 100644 kbarcode/hi16-action-kbarcodegrid.png create mode 100644 kbarcode/hi16-action-kbarcodelinetool.png create mode 100644 kbarcode/hi16-app-kbarcode.png create mode 100644 kbarcode/hi22-action-barcode.png create mode 100644 kbarcode/hi32-action-barcode.png create mode 100644 kbarcode/hi32-action-kbarcoderect.png create mode 100644 kbarcode/hi32-app-kbarcode.png create mode 100644 kbarcode/hi64-app-kbarcode.png create mode 100644 kbarcode/imageitem.cpp create mode 100644 kbarcode/imageitem.h create mode 100644 kbarcode/kactionmap.cpp create mode 100644 kbarcode/kactionmap.h create mode 100644 kbarcode/kbarcode-batch.desktop create mode 100644 kbarcode/kbarcode-editor.desktop create mode 100644 kbarcode/kbarcode-label.desktop create mode 100644 kbarcode/kbarcode-single.desktop create mode 100644 kbarcode/kbarcode.cpp create mode 100644 kbarcode/kbarcode.desktop create mode 100644 kbarcode/kbarcode.h create mode 100644 kbarcode/kbarcodeiface.h create mode 100644 kbarcode/kbarcodesettings.cpp create mode 100644 kbarcode/kbarcodesettings.h create mode 100644 kbarcode/label.cpp create mode 100644 kbarcode/label.h create mode 100644 kbarcode/labeldefinitions.sql create mode 100644 kbarcode/labeleditor.cpp create mode 100644 kbarcode/labeleditor.h create mode 100644 kbarcode/labelutils.cpp create mode 100644 kbarcode/labelutils.h create mode 100644 kbarcode/lineitem.cpp create mode 100644 kbarcode/lineitem.h create mode 100644 kbarcode/logo.png create mode 100644 kbarcode/main.cpp create mode 100644 kbarcode/measurements.cpp create mode 100644 kbarcode/measurements.h create mode 100644 kbarcode/mimesources.cpp create mode 100644 kbarcode/mimesources.h create mode 100644 kbarcode/multilineeditdlg.cpp create mode 100644 kbarcode/multilineeditdlg.h create mode 100644 kbarcode/mybarcode.cpp create mode 100644 kbarcode/mybarcode.h create mode 100644 kbarcode/mycanvasitem.cpp create mode 100644 kbarcode/mycanvasitem.h create mode 100644 kbarcode/mycanvasview.cpp create mode 100644 kbarcode/mycanvasview.h create mode 100644 kbarcode/mydatatable.cpp create mode 100644 kbarcode/mydatatable.h create mode 100644 kbarcode/newlabel.cpp create mode 100644 kbarcode/newlabel.h create mode 100644 kbarcode/pixmapbarcode.cpp create mode 100644 kbarcode/pixmapbarcode.h create mode 100644 kbarcode/previewdialog.cpp create mode 100644 kbarcode/previewdialog.h create mode 100644 kbarcode/printersettings.cpp create mode 100644 kbarcode/printersettings.h create mode 100644 kbarcode/printlabeldlg.cpp create mode 100644 kbarcode/printlabeldlg.h create mode 100644 kbarcode/propertywidget.cpp create mode 100644 kbarcode/propertywidget.h create mode 100644 kbarcode/purepostscript.cpp create mode 100644 kbarcode/purepostscript.h create mode 100644 kbarcode/rectitem.cpp create mode 100644 kbarcode/rectitem.h create mode 100644 kbarcode/rectsettingsdlg.cpp create mode 100644 kbarcode/rectsettingsdlg.h create mode 100644 kbarcode/referencecounted.cpp create mode 100644 kbarcode/referencecounted.h create mode 100644 kbarcode/rules.xml create mode 100644 kbarcode/semantic.cache create mode 100644 kbarcode/smalldialogs.cpp create mode 100644 kbarcode/smalldialogs.h create mode 100644 kbarcode/sqltables.cpp create mode 100644 kbarcode/sqltables.h create mode 100644 kbarcode/tbarcode2.cpp create mode 100644 kbarcode/tbarcode2.h create mode 100644 kbarcode/tcanvasitem.cpp create mode 100644 kbarcode/tcanvasitem.h create mode 100644 kbarcode/tec.cpp create mode 100644 kbarcode/tec.h create mode 100644 kbarcode/textitem.cpp create mode 100644 kbarcode/textitem.h create mode 100644 kbarcode/textlineedit.cpp create mode 100644 kbarcode/textlineedit.h create mode 100644 kbarcode/textlineitem.cpp create mode 100644 kbarcode/textlineitem.h create mode 100644 kbarcode/tokendialog.cpp create mode 100644 kbarcode/tokendialog.h create mode 100644 kbarcode/tokenprovider.cpp create mode 100644 kbarcode/tokenprovider.h create mode 100644 kbarcode/xmlutils.cpp create mode 100644 kbarcode/xmlutils.h create mode 100644 kbarcode/zplutils.cpp create mode 100644 kbarcode/zplutils.h create mode 100644 po/Makefile.am create mode 100644 po/de.po create mode 100644 po/el.po create mode 100644 po/es.po create mode 100644 po/fi.po create mode 100644 po/fr.po create mode 100644 po/hu.po create mode 100644 po/it.po create mode 100644 po/nl.po create mode 100644 po/pl.po create mode 100644 po/sv.po create mode 100644 po/tr.po create mode 100644 stamp-h.in create mode 100644 subdirs diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..de4182c --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Dominik Seichter + http://www.krename.net diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..c13faf0 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/COPYING.barcode_ps b/COPYING.barcode_ps new file mode 100644 index 0000000..46766b2 --- /dev/null +++ b/COPYING.barcode_ps @@ -0,0 +1,32 @@ +The file kbarcode/barcode.ps which is included in this +distribution is licensed under the following conditions: +======================================================== + +Barcode Writer in Pure PostScript +http://www.terryburton.co.uk/barcodewriter/ + +Copyright (c) 2005 Terry Burton - tez@terryburton.co.uk + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..811e96f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,431 @@ +Changelog since Version 1.3.2: +============================== + +Version 2.0.6 + Dag Nygren contributed a patch which fixes printing from a CSV file + Check if files passed for batchprinting from the commandline do exist + Patch from Chris fixing problems with SQLite + Patch from Váradi Zsolt Gyula to fix the long standing issue with + disappearing objects + +Version 2.0.5 + Fixed TBarcode2 detection in system check + Fixed checksum for TBarcode2 + Improved CSV file import (works now with any table and fixed field + files) + Added new version of barcode writer in pure postscript + Supported barcodes are now parsed from barcode writer in pure postscript file + Fixed address printing + +Version 2.0.4 + Fixed compilation on KDE < 3.5 + Fixed a database access bug + Raphael Pinson updated the french translation + Fixed text alignment in label editor + +Version 2.0.3 + Fixed adding articles from the SQL table + Fixed barcode support when only barcode writer in pure postscript is + available + Added an action map + Added the possibility to keep the batch printing window open after printing + +Version 2.0.2 + Fixed translations in the barcode combo + Fixed [field0] - [field9] + Fixed case sensitive barcode encoding in SQL database + +Version 2.0.1 + Fixed compilation on slackware amd64 + Fixed spec file RHFC4 + Added turkish translation by Furkan Duman + Barcode properties are used immediately in the barcode dialog + Added TBarcode2 support + Fixed database settings + Barcodes values are validated before generating a new barcode for + barcode writer in pure postscript. Requires PCRE. + Fixed database barcode modes + +Version 2.0.0 + Increased version number + +Version 2.0.0rc2 + Fixed saving barcodes to images (correct fileformat is now detected) + Fixed the --print commandline option with --batch + Updated german translation + Patch by Simon Munton fixes a crash + Fixed printing bug: Printing started on the second label + Updated Barcode Writer in Pure Postscript version + Fixed importing articles + Removed the build time dependency on GNU Barcode + +Version 2.0.0rc1 + Added missing #include to fix compilation + Fixed desktop files + Updated admin/ directory to KDE 3.5 + Comitted a patch by Jan Zuchhold to support Codabar without checksum + Added default value for [serial] field + Improved commandline options, --prints now immediately and exits + KBarcode after printing. + Fixed 3 small memory leaks (one in the SQL code and one during XML parsing) + Selection is not removed after changing properties of a text element + Formattings in the text editor are kept for new paragraphs now + +Version 1.9.10 + Show name of used barkode engine for encoding + Added support for Terry Burtons Barcode Writer in Pure Postscript as + new Barcode backend with many new suported barcode formats. + +Version 1.9.9 + The encoding of input csv data can be specified + KDE addressbook integration. The addressbook can now be used as + datasource for batchprinting + Fixed CSV to SQL import + Fixed CSV import when the separator is part in a quoted region + Fixed a few memory leaks found by valgrind + +Version 1.9.8 + Added [col] and [row] tokens + Text fields have now a line distance of 1 instead of 1.5 + Fixed center horizontally and vertically + Fixed barcode without text + Removed Undo Limit option from preferences (makes the dialog easier) + Fixed compilation on RH9, Mandrake 10 + Fixed empty user defined fields + Added a busy cursor while creating databases + Uses references instead of pointers and fix a memory leak + +Version 1.9.7 + Fixed --label commandline option + Added text rotation support + Fixed printing out of the label. Positions on screen are now also + positions on the printer! + Fixed barcode resizing + Undo/Redo for raise/lower is now possible + Implemented a confortable wizard for inserting tokens + +Version 1.9.6 + Fixed y-scaling issues during printing + Faster barcode generation through the usage of pipes + Fixed image printing (images were not scaled on the printer) + Improved the layout of the visibility script dialog + Fixed clipping issues during printing + Fixed TBarcode Support + Fixed CSV Import + +Version 1.9.5 + Fixed next button in batchwizard for data import + Moved image creation settings from preferences to batchwizard + BatchWizard opens image creation directory after creating images + automatically + Added new commandline options and DCOP methods to allow for easier + scripting of KBarcode + Fixed file open from label editor (do not show new label dialog when + opening files) + Fixed enable/disable of KLineEdit in TokenDialog + Added JavaScript support + Removed LabelPrinter class (replaced by BatchWizard) + Made the new label dialog smaller in size and therefore more useable + Fixed an image scaling bug + Greatly improved image support, image path can now also be an + expression + Fixed crashes in the label editor with undo/redo by making TCanvasItem + objects referencecounted + +Version 1.9.4 + Fixed barcode sequence start values and stepping + All legacy barcode should now load succesfully + Readded TBarcode and PDF417 support + Fixed PDF417 support + Fixed dancing objects in the labeleditor when resizing + Fixed undo delete + Make default grid size smaller + Added the sqlquery statement + Fixed drawing of invalid barcodes from the PixmapBarcode engine + Fixed resizing og items to a negative value (which is not allowed + anmore) + Improved the grid in the labeleditor a bit, still not perfect + Fixed compilation warnings + Added border support for TextLineItems + Added support for user defined variables + Added a completely new full featured and fantastic batch printing + wizard + Fixed CTRL+P short cut being used twice in labeleditor + Added CSVFile abstraction class to parse CSVFiles + Fixed memory leaks when printing to images + +Version 1.9.3 + Fixed positions of printed textitems + Improved printing speed + Fixed characters being dropped while printing + Added keyboard accessors to the barcode widget + Merged Barkode - the new barcode engine for KBarcode + Fixed file extension being added twice when saving a barcode + Reenabled copy and paste of single barcodes + Added a protect position and size feature to the labeleditor + +Version 1.9.2 + Generate button is now default in the barcode dialog + Size and position can be specified in inch now + Barcode are resized correctly in the label editor + Added a select/deselect all option to the label editor + Fixed barcode printing (they are printed in the correct size now) + Laurent Montel fixed a memory leak in NewLabel dialog + Faster compilation thanks to Laurent's include moc patch + Fixed a memory leak in NewItem commands + Fixed copy and paste of text objects + Fixed a memory leak when changing the size of an existing label + Fixed lot's of printing bugs (text, barcode printing!) + Improved layout of BarcodeDialog and preview of large barcodes + Fixed a crash with PreviewDialog + Improved layout ot the TokenDialog (and size is stored now in the config) + Fixed edit properties menu action + +Version 1.9.1 + Merged EPCL Printer support from Brian Glass + Improved token selection + Refactored barcode printer codes + Faster image loading as PNG is now used internally (i.e smaller filesizes too) + More image options (scale, zoom,rotation readded,mirroring) + Fixed scrollbars in the LabelEditor for big labels + Merged TEC Printer support from Nyssa + Improved copy and paste support (select more than one item) + Fixed textprinting for all Qt versions + Added a dialog for easier printing to barcode printers + Lot's of bug fixes and improvements + +Version 1.9.0 + --- Only anounced on the Mailinglist --- + +Version 1.8.2 + Printing works on all kde versions again + +Version 1.8.1 + Display a progress dialog when loading label definitions + Converted label definitions to UTF-8 + Fix text printing with Qt 3.3.x + Fixed a bug which caused definitions to be loaded twice + Fixed compilation errors due to missing time.h include + +Version 1.8.0 + Minor changes + +Version 1.7.5 + Added the option to change properties from the menus + Delete option gets disabled properly + +Version 1.7.4 + Fixed CSV import in to batch printing mode + Updated automake + Replaced convert by ghostscript -> less dependencies and more speed! + +Version 1.7.3 + Fixed compilation with --enable-final (added necessary ifdef's around headers) + Fixed compilation (don't declare default args in the implementation) + Fixed an UPC-A generation bug + Added a Polnish translation by Benedykt P. Barszcz + Fixed CSV import when the line does not end with the separator + Fixed barcode size being different on screen and printer + Fixed warnings about returnign reference to temporaries + Added --print option also for the label editor + +Version 1.7.2 + Major code refactoring to make everything cleaner and simpler + Faster because of using less tempfiles + Improved UI of Batch Printing dialog + Fixed bug in group completion support + Fixed CSV file import into PostgreSQL + KBarcode File Plugin is now part of the KBarcode Source distribution + +Version 1.7.1 + Fixed grid not beeing updated + Speed improvements in token provider + Fixed printing + Improved DCOP interface + Fixed moving items on grid has been greatly improved + Serial indexing support + +Version 1.7.0 + The default page size is read from KDE + Increased speed when loading label definitions from file + Support for inch and millimeter + Added a powerful DCOP interface + +Version 1.6.2 + Fixed an UPC-A generation bug + Added greek translation + +Version 1.6.0 + KDE 3.0.x compilation fixes + Fixed wrong barcode positions + +Version 1.6.0rc-2 + Fixed the rect icon in the labeleditor + Fixed compilation with Qt 3.0.x + Fixed a crash for paragraphs with one character only + Improved printing of large pictures + Fixed a bug with text lines drawn twice + +Version 1.6.0rc-1 + Build System fixes + Fixed a segmentation fault + Removed debug messages + Fixed focus of multi line edit dialog + +Version 1.5.5 + Fixed compilation with Qt 3.1.x + Fixed some IPL issues + Fixed rich text rendering bug with empty paragraph + Fixed display of "field0-9" fields + Fixed spacing of the first line of each paragraph + Spellchecked German translation + Switched to KDevelop 3.0.0beta1 + +Version 1.5.4 + Further dynamic datafields fixes in the labeleditor + Using own rich text engine (-> anti aliased fonts in printout) + Removed screen resolution printing mode as 300dpi has better results + Simplified configuration wizard + greatly improved API documentation + Added system check utility + Updated German translation + Added experimental IPL support + +Version 1.5.3 + Fixed display of dynamic datafields in the label editor + Fixed a crash in the preview of the label editor + Fixed sequences with more barcodes on a label + Added ZPL export + Removed "USE" statement in DB code + Started work on an own rich text rendering implementation + +Version 1.5.2 + Added TBarcode auto correction feature + Fixed copy and paste in the labeleditor + Lot's of database creation fixes + Added a progress dialog to the CSV import + Fixed a memory leak, when the definition where read from a file + Speed improvements when no database is used (because of caching) + +Version 1.5.1 + Added Advanced button for barcode settings + Added [resolution], [index], [page] keywords (datafields) + Added text above barcodes for tbarcode backend + Added escape sequence support for tbarcode backend + Added support to select more than one element in the label editor (press CTRL) + Added 1200dpi printing mode + Added PostgreSQL and SQLite support (ODBC should work, too) + Added API Documentation + Added support for barcode sequences + Added support for checkdigits with TBarcode + Enabling crop marks (borders) is now much easier + Cut/scale is now reset to 100/1000 if disabled + Fixed and improved the barcode cache + Fixed CSVImportDlg, which allowed to insert data in not existant table fields + Fixed placement of new items + Fixed preview in the label editor + Removed 72dpi printing mode completely + Removed convert -quality commandline option + Datafields are now even shown in the label editor + Changed double SQL datatypes to NUMERIC (and smallint to int) + Made some varchars in the SQL code larger (to varchar(255)) + The index of the label can be specified in the label editor preview + +Version 1.5.0 + Added TBarcode support (lot's of new barcode formats!) + Added harddisk barcode cache + Added CSV file import dialog + Added support to configure the preview page size + Added configuration of PDF417 err correction level and size + Update SQL Tables so that 2D barcodes will work + Fixed bug with barcode value not shown in the label editor + Fixed fonts with Qt 3.2 + Removed some warning messages + Removed useless functions: copyBarcode and printBarcode + Removed grayscale option + Removed bg and fg colors, because they are not supported + Refactored SQL code to make it much easier (introduced SQL widget ) + Changed default: labeleditor asks for new label on startup + +Version 1.4.1 + Fixed compilation error with compound literals + +Version 1.4.0 + Fixed image positions when printing + +Version 1.4.0-rc1 + Fixed bugs with image rotation + Fixed printing of barcodes + Fixed recent files menu + Fixed automatic text resizing + Fixed bug with getting max length barcode values from the database + +Version 1.3.6 + Don't use private KPrinter API + Fixed sql table creation + Fixed drawing of lines + Removed not working spellchecker + KBarcode defaults to printing at 300dpi + Updated Hungarian, Italian and Spanish translation + Added own grid icon + Updated documentation download URL + +Version 1.3.5 + Fixed free space around label in the label editor + Improved label preview dialog a lot + Align to grid can be undone now + Improved printing speed. Labels are read only once from harddisk. + Fixed database problems with batch printing + Cancelling of creating images works now + Pages are calculated correctly again + Improved layout of barcode dialog + Fixed saving of barcodes + +Version 1.3.4 + Added a button to insert all values from barcode_basic to batchprinting + Improved the configuration wizard + Improved batch printer GUI with import menu item + Fixed SQL connection bug in batch printer + Remove X, Y Correction stuff + Refactore printer setup code + Removed antialiased stuff, with Qt 3.2 we'll have pretty fonts anyway + Fixed a memory leak in the image generation code + Stopped maintaining two different printer codes, LabelEditor prints from the XML file now, too + Fixed printing for all resolutions + Improved the layout of the barcode dialog + Fixed closing of main window + Greatly enhanced PDF417 support + Restructered preferences dialog + Fixed textprinting bug + Removed useless functions scalePainter() & renderPix() + +Version 1.3.3 + Fixed Qt 3.0.x compilation + Fixed a segfault at startup + +Version 1.3.2 + Resizing with shift pressed keeps ratio now + Fixed image rotation + Fixed keyboard shortcuts + Refactor lot's of code in command.cpp + Fixed caption of Label Editor after using the preview + 72dpi can only be selected in the preferences if it is better than screenresolution + Refactored some resolution calculations + Fixed a memory leak in MyCanvasView + Removed not working label scaling stuff + Added more free fields to the "barcode_basic" table to improve handling of labels without barcodes (e.g. address labels) + Improved and refactored printing code + Fixed resizing of the label editor window + Fixed grid and changed default gridsize to 20 pixels + Moved drawing toolbar to the left side of the window + Disable cut, copy and paste actions when no document is loaded + Ported lot's of dialogs to KDialogBase + Fixed move by value + Databases are updated automatically on connection + Fixed (one) undo/redo crash + Fixed badly broken batchprinting with database values + Fixed undo/redo crash + Improved printing speed a little bit + Fixed a crash with enabled grid + + diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..2a61247 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,246 @@ +# Doxyfile 1.3.4-KDevelop + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = kbarcode.kdevelop +PROJECT_NUMBER = 1.5.9 +OUTPUT_DIRECTORY = +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/dominik/Desktop/Programming/kbarcode +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.C \ + *.H \ + *.tlh \ + *.diff \ + *.patch \ + *.moc \ + *.xpm \ + *.dox +RECURSIVE = yes +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = yes +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..02a4a07 --- /dev/null +++ b/INSTALL @@ -0,0 +1,167 @@ +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 a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +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. + + 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. + +`--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/Makefile.am b/Makefile.am new file mode 100644 index 0000000..51a569f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,26 @@ +SUBDIRS = kbarcode fileplugin po + +$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +EXTRA_DIST = admin COPYING configure.in.in + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs +noinst_DATA = kbarcode.spec acinclude.m4 aclocal.m4 AUTHORS ChangeLog \ + config.h.in configure configure.in configure.in.in COPYING Doxyfile INSTALL \ + libtool Makefile.am Makefile.cvs Makefile.in NEWS README stamp-h.in \ + subdirs diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..4c0afd1 --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,10 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + $(MAKE) -f admin/Makefile.common cvs + +dist: + $(MAKE) -f admin/Makefile.common dist + +.SILENT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..0e05c15 --- /dev/null +++ b/README @@ -0,0 +1,59 @@ +kBarcode + +General Information: +Project Webpage: http://www.kbarcode.net +Core Members: Stonki + Dom +Mailinglist: kbarcode-users@lists.sourceforge.net +IRC Channel: irc.openprojects.net #kbarcode + + +Project Description: +==================== +KBarcode is a barcode and label printing application for Linux and KDE 3. It can +be used to print every thing from simple business cards up to complex +labels with several barcodes (e.g. article descriptions). KBarcode +comes with an easy to use WYSIWYG label designer, a setup wizard, +batch import of labels (directly from the delivery note), thousands +of predefined labels, database managment tools and translations +in many languages. Even printing more than 10.000 labels in one go is +no problem for KBarcode. Additionally it is a simply xbarcode +replacement for the creation of barcodes. All major types of barcodes +like EAN, UPC, CODE39, DataMatrix and ISBN are supported. + +It works of course on any platform supported by KDE and not only Linux! + +Languages: +* English +* German +* Hungarian +* Italian +* Finish +* French +* Spanish +* Swedish + +Requirements: +* KDE 3.x +* GnuBarcode (RunTime) +* TBarcode(RunTime) +* ImageMackick (RunTime) +* Qt SQL Tools (optional) + +Germany, 05. June 2002 + (updated 31.10.2002) + (updated 02.02.2003) + (updated 22.10.2003) + +Compiling KBarcode from CVS: +============================ + +To compile KBarcode from CVS you have to use the following commands: + +make -f admin/Makefile.common +./configure +make +su +make install + +Be sure to use the first step which will create the configure script for you. diff --git a/TODO b/TODO new file mode 100644 index 0000000..11d7641 --- /dev/null +++ b/TODO @@ -0,0 +1,60 @@ +Hi Andrew, + +Saving as PNG or JPEG works for me, if you select PNG or JPEG in the filter combo box at the bottom of the save dialog. +The problem is that the default seems to be PBM if no other file format is selected and saving to PBM does not work for some reason (maybe the barcode is grayscale which is not support by PBM). +Anyways, this is a useabillity problem in KBarcode which has to be addressed and will be addressed for the 2.0 release. + +Thanks for reporting and I hope the workaround with selecting the destination file format by hand will work for you. + +best regards, + Dom + +Am Tuesday, 7. February 2006 16:14 schrieb Andrew Lord: +> Hi, +> +> The subject line says it all, really. When I creat barcode images under +> kbarcode, click 'Save' and enter a file name to save as (*.png or *.jpg), I +> get an alert message saying "An error occurred during saving the image". +> The file fails to save. +> Has anyone else experienced this difficulty or is there perhaps some +> further information that I could send to help diagnose the cause of this +> problem (such as the shell output, after booting and running from shell). +> +> Cheers, +> +> Andrew Lord +> +> +> ------------------------------------------------------- +> This SF.net email is sponsored by: Splunk Inc. Do you grep through log +> files for problems? Stop! Download the new AJAX search engine that makes +> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! +> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 +> _______________________________________________ +> Kbarcode-users mailing list +> Kbarcode-users@lists.sourceforge.net +> https://lists.sourceforge.net/lists/listinfo/kbarcode-users + +-- +********************************************************************** +Dominik Seichter - domseichter@web.de +KRename - http://www.krename.net - Powerful batch renamer for KDE +KBarcode - http://www.kbarcode.net - Barcode and label printing +SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game, for KDE +Alan - http://alan.sf.net - A Turing Machine in Java +********************************************************************** +================ + +TBarcode support: See forum: + +Ok, so here is an demonstration of what I want and how it is done with Tbarcode 2: + + /usr/bin/tbarcode -f PS -x 30 -y 30 -w 80 -h 30 -b 48 -d 64206119701234567 --text=below --font="Helvetica" --fontsize=14 -o footest.ps + +================ + +Dominik: +-Change Label should start with current label +-KMyMoney integration +- --batch should work again! + diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..3317873 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,11862 @@ +## -*- autoconf -*- + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +dnl Boston, MA 02110-1301, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +# KDE_PATH_X_DIRECT +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN([KDE_PATH_X_DIRECT], +[ +AC_REQUIRE([KDE_CHECK_LIB64]) + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK([#include ], [${x_direct_test_function}(1)], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \ + /usr/X11/lib${kdelibsuff} \ + /usr/X11R6/lib${kdelibsuff} \ + /usr/X11R5/lib${kdelibsuff} \ + /usr/X11R4/lib${kdelibsuff} \ + \ + /usr/lib${kdelibsuff}/X11 \ + /usr/lib${kdelibsuff}/X11R6 \ + /usr/lib${kdelibsuff}/X11R5 \ + /usr/lib${kdelibsuff}/X11R4 \ + \ + /usr/local/X11/lib${kdelibsuff} \ + /usr/local/X11R6/lib${kdelibsuff} \ + /usr/local/X11R5/lib${kdelibsuff} \ + /usr/local/X11R4/lib${kdelibsuff} \ + \ + /usr/local/lib${kdelibsuff}/X11 \ + /usr/local/lib${kdelibsuff}/X11R6 \ + /usr/local/lib${kdelibsuff}/X11R5 \ + /usr/local/lib${kdelibsuff}/X11R4 \ + \ + /usr/X386/lib${kdelibsuff} \ + /usr/x386/lib${kdelibsuff} \ + /usr/XFree86/lib${kdelibsuff}/X11 \ + \ + /usr/lib${kdelibsuff} \ + /usr/local/lib${kdelibsuff} \ + /usr/unsupported/lib${kdelibsuff} \ + /usr/athena/lib${kdelibsuff} \ + /usr/local/x11r5/lib${kdelibsuff} \ + /usr/lpp/Xamples/lib${kdelibsuff} \ + /lib/usr/lib${kdelibsuff}/X11 \ + \ + /usr/openwin/lib${kdelibsuff} \ + /usr/openwin/share/lib${kdelibsuff} \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_FIND_FILE], +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs, +dnl if-not-found, test-parameter, prepend-path) +dnl +dnl Look for program-name in list-of-dirs+$PATH. +dnl If prepend-path is set, look in $PATH+list-of-dirs instead. +dnl If found, $variable-name is set. If not, if-not-found is evaluated. +dnl test-parameter: if set, the program is executed with this arg, +dnl and only a successful exit code is required. +AC_DEFUN([KDE_FIND_PATH], +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + dirs="" + for dir in $PATH; do + dirs="$dirs $dir" + done + if test -z "$6"; then dnl Append dirs in PATH (default) + dirs="$3 $dirs" + else dnl Prepend dirs in PATH (if 6th arg is set) + dirs="$dirs $3" + fi + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN([KDE_MOC_ERROR_MESSAGE], +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN([KDE_UIC_ERROR_MESSAGE], +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + + +AC_DEFUN([KDE_CHECK_UIC_FLAG], +[ + AC_MSG_CHECKING([whether uic supports -$1 ]) + kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'` + AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache, + [ + cat >conftest.ui < +EOT + ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null" + if AC_TRY_EVAL(ac_uic_testrun); then + eval "kde_cv_prog_uic_$kde_cache=yes" + else + eval "kde_cv_prog_uic_$kde_cache=no" + fi + rm -f conftest* + ]) + + if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then + AC_MSG_RESULT([yes]) + : + $3 + else + AC_MSG_RESULT([no]) + : + $4 + fi +]) + + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_MOC_UIC], +[ + AC_REQUIRE([KDE_CHECK_PERL]) + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""]) + if test -z "$UIC_PATH" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + else + UIC=$UIC_PATH + + if test $kde_qtver = 3; then + KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no) + KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no) + + if test x$ac_uic_supports_libpath = xyes; then + UIC="$UIC -L \$(kde_widgetdir)" + fi + if test x$ac_uic_supports_nounload = xyes; then + UIC="$UIC -nounload" + fi + fi + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) + + UIC_TR="i18n" + if test $kde_qtver = 3; then + UIC_TR="tr2i18n" + fi + + AC_SUBST(UIC_TR) +]) + +AC_DEFUN([KDE_1_CHECK_PATHS], +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN([KDE_SET_PATHS], +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_kcfgdir=\"$kde_kcfgdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_styledir=\"$kde_styledir\" \ + kde_widgetdir=\"$kde_widgetdir\" \ + xdg_appsdir=\"$xdg_appsdir\" \ + xdg_menudir=\"$xdg_menudir\" \ + xdg_directorydir=\"$xdg_directorydir\" \ + kde_result=$1" +]) + +AC_DEFUN([KDE_SET_DEFAULT_PATHS], +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${datadir}/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${datadir}/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${datadir}/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${datadir}/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${datadir}/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${datadir}/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${datadir}/config' + fi + if test -z "$kde_kcfgdir"; then + kde_kcfgdir='\${datadir}/config.kcfg' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${datadir}/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${datadir}/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${datadir}/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${datadir}/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${datadir}/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${datadir}/servicetypes' + fi + if test -z "$kde_moduledir"; then + if test "$kde_qtver" = "2"; then + kde_moduledir='\${libdir}/kde2' + else + kde_moduledir='\${libdir}/kde3' + fi + fi + if test -z "$kde_styledir"; then + kde_styledir='\${libdir}/kde3/plugins/styles' + fi + if test -z "$kde_widgetdir"; then + kde_widgetdir='\${libdir}/kde3/plugins/designer' + fi + if test -z "$xdg_appsdir"; then + xdg_appsdir='\${datadir}/applications/kde' + fi + if test -z "$xdg_menudir"; then + xdg_menudir='\${sysconfdir}/xdg/menus' + fi + if test -z "$xdg_directorydir"; then + xdg_directorydir='\${datadir}/desktop-directories' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS], +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_kcfgdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test -z "$kde_styledir" || test -z "kde_widgetdir" || + test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" || + test "x$kde_have_all_paths" != "xyes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN([KDE_MISSING_PROG_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN([KDE_MISSING_ARTS_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed aRts correctly or use +--without-arts to compile without aRts support (this will remove functionality). +]) +]) + +AC_DEFUN([KDE_SET_DEFAULT_BINDIRS], +[ + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin" + test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi +]) + +AC_DEFUN([KDE_SUBST_PROGRAMS], +[ + AC_ARG_WITH(arts, + AC_HELP_STRING([--without-arts],[build without aRts [default=no]]), + [build_arts=$withval], + [build_arts=yes] + ) + AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no") + if test "$build_arts" = "no"; then + AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts]) + fi + + KDE_SET_DEFAULT_BINDIRS + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + if test "$build_arts" '!=' "no"; then + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)]) + fi + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + kde32ornewer=1 + kde33ornewer=1 + if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then + kde32ornewer= + kde33ornewer= + else + if test "$kde_qtver" = "3"; then + if test "$kde_qtsubver" -le 1; then + kde32ornewer= + fi + if test "$kde_qtsubver" -le 2; then + kde33ornewer= + fi + if test "$KDECONFIG" != "compiled"; then + if test `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then + kde33ornewer= + fi + fi + fi + fi + + if test -n "$kde32ornewer"; then + KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)]) + KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)]) + fi + if test -n "$kde33ornewer"; then + KDE_FIND_PATH(makekdewidgets, MAKEKDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(makekdewidgets)]) + AC_SUBST(MAKEKDEWIDGETS) + fi + KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""]) + + if test -n "$MEINPROC" -a "$MEINPROC" != "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + if test -n "$kde32ornewer"; then + KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)' + DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)' + AC_SUBST(KCONFIG_COMPILER) + AC_SUBST(KCFG_DEPENDENCIES) + AC_SUBST(DCOPIDLNG) + fi + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + AC_SUBST(XMLLINT) +])dnl + +AC_DEFUN([AC_CREATE_KFSSTND], +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + kde_styledir= + kde_widgetdir= + xdg_appsdir = xdg_menudir= xdg_directorydir= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN([AC_SUBST_KFSSTND], +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_kcfgdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl X Desktop Group standards +AC_SUBST(xdg_appsdir) +AC_SUBST(xdg_menudir) +AC_SUBST(xdg_directorydir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +AC_SUBST(kdeinitdir, '$(kde_moduledir)') +AC_SUBST(kde_styledir) +AC_SUBST(kde_widgetdir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN([KDE_MISC_TESTS], +[ + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # more headers that need to be explicitly included on darwin + AC_CHECK_HEADERS(sys/types.h stdint.h) + + # sys/bitypes.h is needed for uint32_t and friends on Tru64 + AC_CHECK_HEADERS(sys/bitypes.h) + + # darwin requires a poll emulation library + AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll") + + # for some image handling on Mac OS X + AC_CHECK_HEADERS(Carbon/Carbon.h) + + # CoreAudio framework + AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [ + AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API]) + FRAMEWORK_COREAUDIO="-Xlinker -framework -Xlinker CoreAudio" + ]) + + AC_CHECK_RES_INIT + AC_SUBST(LIB_POLL) + AC_SUBST(FRAMEWORK_COREAUDIO) + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL + KDE_CHECK_STRLCPY + KDE_CHECK_PIE_SUPPORT + +# darwin needs this to initialize the environment +AC_CHECK_HEADERS(crt_externs.h) +AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) + +AH_VERBATIM(_DARWIN_ENVIRON, +[ +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include +# include +# define environ (*_NSGetEnviron()) +#endif +]) + +AH_VERBATIM(_AIX_STRINGS_H_BZERO, +[ +/* + * AIX defines FD_SET in terms of bzero, but fails to include + * that defines bzero. + */ + +#if defined(_AIX) +#include +#endif +]) + +AC_CHECK_FUNCS([vsnprintf snprintf]) + +AH_VERBATIM(_TRU64,[ +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include +#include +#else +#include +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([K_PATH_X], +[ +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_ARG_ENABLE( + embedded, + AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]), + kde_use_qt_emb=$enableval, + kde_use_qt_emb=no +) + +AC_ARG_ENABLE( + qtopia, + AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]), + kde_use_qt_emb_palm=$enableval, + kde_use_qt_emb_palm=no +) + +AC_ARG_ENABLE( + mac, + AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]), + kde_use_qt_mac=$enableval, + kde_use_qt_mac=no +) + +# used to disable x11-specific stuff on special platforms +AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no") + +if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then + +AC_MSG_CHECKING(for X) + +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +KDE_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib${kdelibsuff}" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS" + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +LDFLAGS="$ac_save_LDFLAGS" + +LIB_X11='-lX11 $(LIBSOCKET)' + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include +#ifdef STDC_HEADERS +# include +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no +) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe +]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +LIB_XEXT="-lXext" +QTE_NORTTI="" + +elif test "$kde_use_qt_emb" = "yes"; then + dnl We're using QT Embedded + CPPFLAGS=-DQWS + CXXFLAGS="$CXXFLAGS -fno-rtti" + QTE_NORTTI="-fno-rtti -DQWS" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +elif test "$kde_use_qt_mac" = "yes"; then + dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to + dnl be included to get the information) --Sam + CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" + CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +fi +AC_SUBST(X_PRE_LIBS) +AC_SUBST(LIB_X11) +AC_SUBST(LIB_XRENDER) +AC_SUBST(LIBSM) +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_includes) +AC_SUBST(x_libraries) +AC_SUBST(QTE_NORTTI) +AC_SUBST(LIB_XEXT) + +]) + +AC_DEFUN([KDE_PRINT_QT_PROGRAM], +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext < +#include +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext < +#include +#include +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <> conftest.$ac_ext < +#include +#include +EOF +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_1_3], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]), + kde_use_qt_mt=$enableval, + [ + if test $kde_qtver = 3; then + kde_use_qt_mt=yes + else + kde_use_qt_mt=no + fi + ] +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +KDE_MT_LDFLAGS= +KDE_MT_LIBS= +if test "x$kde_use_qt_mt" = "xyes"; then + KDE_CHECK_THREADING + if test "x$kde_use_threading" = "xyes"; then + CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS" + KDE_MT_LDFLAGS="$USE_THREADS" + KDE_MT_LIBS="$LIBPTHREAD" + else + kde_use_qt_mt=no + fi +fi +AC_SUBST(KDE_MT_LDFLAGS) +AC_SUBST(KDE_MT_LIBS) + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ +if test -z "$LIBQT_GLOB"; then + if test "x$kde_use_qt_emb" = "xyes"; then + LIBQT_GLOB="libqte.*" + else + LIBQT_GLOB="libqt.*" + fi +fi + +dnl ------------------------------------------------------------ +dnl If we got --enable-embedded then adjust the Qt library name. +dnl ------------------------------------------------------------ +if test "x$kde_use_qt_emb" = "xyes"; then + qtlib="qte" +else + qtlib="qt" +fi + +kde_int_qt="-l$qtlib" + +if test -z "$LIBQPE"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-palmtop then add -lqpe to the link line +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + if test "x$kde_use_qt_emb_palm" = "xyes"; then + LIB_QPE="-lqpe" + else + LIB_QPE="" + fi + else + LIB_QPE="" + fi +fi + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + LIBQT="-l$qtlib-mt" + kde_int_qt="-l$qtlib-mt" + LIBQT_GLOB="lib$qtlib-mt.*" + USING_QT_MT="using -mt" +else + LIBQT="-l$qtlib" +fi + +if test $kde_qtver != 1; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +if test $kde_qtver = 3; then + AC_REQUIRE([KDE_CHECK_LIBDL]) + LIBQT="$LIBQT $LIBDL" +fi + +AC_MSG_CHECKING([for Qt]) + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +fi +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]), + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib${kdelibsuff} + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]), + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]), + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" != "1"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIBQT="$LIBQT ${kde_int_qt}_incremental" + break + fi +done + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" +LIBS="$LIBS $LIBQT $KDE_MT_LIBS" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + missing_qt_mt="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + if test "x$kde_use_qt_mt" = "xyes"; then + missing_qt_mt=" +Make sure that you have compiled Qt with thread support!" + ac_qt_notfound="(library $qtlib-mt)"; + else + ac_qt_notfound="(library $qtlib)"; + fi + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.$missing_qt_mt]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then + KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES="" +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$QT_LDFLAGS $all_libraries" +fi +test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS" + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +KDE_CHECK_QT_JPEG + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)' +else +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)' +fi +test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS" +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIB_QT="$LIB_QT ${kde_int_qt}_incremental" + break + fi +done + +AC_SUBST(LIB_QT) +AC_SUBST(LIB_QPE) + +AC_SUBST(kde_qtver) +]) + +AC_DEFUN([AC_PATH_QT], +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN([KDE_CHECK_UIC_PLUGINS], +[ +AC_REQUIRE([AC_PATH_QT_MOC_UIC]) + +if test x$ac_uic_supports_libpath = xyes; then + +AC_MSG_CHECKING([if UIC has KDE plugins available]) +AC_CACHE_VAL(kde_cv_uic_plugins, +[ +cat > actest.ui << EOF + +NewConnectionDialog + + + + testInput + + + + +EOF + + + +kde_cv_uic_plugins=no +kde_line="$UIC_PATH -L $kde_widgetdir" +if test x$ac_uic_supports_nounload = xyes; then + kde_line="$kde_line -nounload" +fi +kde_line="$kde_line -impl actest.h actest.ui > actest.cpp" +if AC_TRY_EVAL(kde_line); then + # if you're trying to debug this check and think it's incorrect, + # better check your installation. The check _is_ correct - your + # installation is not. + if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then + kde_cv_uic_plugins=yes + fi +fi +rm -f actest.ui actest.cpp +]) + +AC_MSG_RESULT([$kde_cv_uic_plugins]) +if test "$kde_cv_uic_plugins" != yes; then + AC_MSG_ERROR([ +you need to install kdelibs first. + +If you did install kdelibs, then the Qt version that is picked up by +this configure is not the same version you used to compile kdelibs. +The Qt Plugin installed by kdelibs is *ONLY* loadable if it is the +_same Qt version_, compiled with the _same compiler_ and the same Qt +configuration settings. +]) +fi +fi +]) + +AC_DEFUN([KDE_CHECK_FINAL], +[ + AC_ARG_ENABLE(final, + AC_HELP_STRING([--enable-final], + [build size optimized apps (experimental - needs lots of memory)]), + kde_use_final=$enableval, kde_use_final=no) + + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) +]) + +AC_DEFUN([KDE_CHECK_CLOSURE], +[ + AC_ARG_ENABLE(closure, + AC_HELP_STRING([--enable-closure],[delay template instantiation]), + kde_use_closure=$enableval, kde_use_closure=no) + + KDE_NO_UNDEFINED="" + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + KDE_NO_UNDEFINED="" + case $host in + *-*-linux-gnu) + KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined], + [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined], + [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"], + [KDE_NO_UNDEFINED=""])], + [KDE_NO_UNDEFINED=""]) + ;; + esac + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) + AC_SUBST(KDE_NO_UNDEFINED) +]) + +dnl Check if the linker supports --enable-new-dtags and --as-needed +AC_DEFUN([KDE_CHECK_NEW_LDFLAGS], +[ + AC_ARG_ENABLE(new_ldflags, + AC_HELP_STRING([--enable-new-ldflags], + [enable the new linker flags]), + kde_use_new_ldflags=$enableval, + kde_use_new_ldflags=no) + + LDFLAGS_AS_NEEDED="" + LDFLAGS_NEW_DTAGS="" + if test "x$kde_use_new_ldflags" = "xyes"; then + LDFLAGS_NEW_DTAGS="" + KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags], + [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],) + + KDE_CHECK_COMPILER_FLAG([Wl,--as-needed], + [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],) + fi + AC_SUBST(LDFLAGS_AS_NEEDED) + AC_SUBST(LDFLAGS_NEW_DTAGS) +]) + +AC_DEFUN([KDE_CHECK_NMCHECK], +[ + AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]), + kde_use_nmcheck=$enableval, kde_use_nmcheck=no) + + if test "$kde_use_nmcheck" = "yes"; then + KDE_USE_NMCHECK_TRUE="" + KDE_USE_NMCHECK_FALSE="#" + else + KDE_USE_NMCHECK_TRUE="#" + KDE_USE_NMCHECK_FALSE="" + fi + AC_SUBST(KDE_USE_NMCHECK_TRUE) + AC_SUBST(KDE_USE_NMCHECK_FALSE) +]) + +AC_DEFUN([KDE_EXPAND_MAKEVAR], [ +savex=$exec_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +tmp=$$2 +while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done +exec_prefix=$savex +]) + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_BASE_PATH_KDE], +[ +AC_REQUIRE([KDE_CHECK_STL]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${includedir} + KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir) + + kde_libraries=${libdir} + KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir) + +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="$kde_libs_prefix/lib${kdelibsuff} /usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi + +if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +AC_MSG_ERROR([ +I can't find the designer plugins. These are required and should have been installed +by kdelibs]) +fi + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1, e.g. from kdelibs + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${libdir}" + kde_includes="${includedir}" + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION" + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$KDE_LDFLAGS $all_libraries" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +if test -z "$1"; then +KDE_CHECK_UIC_PLUGINS +fi + +ac_kde_libraries="$kde_libdir" + +AC_SUBST(AUTODIRS) + + +]) + +AC_DEFUN([KDE_CHECK_EXTRA_LIBS], +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]), + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]), + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN([KDE_1_CHECK_PATH_HEADERS], +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext < +#endif +#include +#include "confdefs.h" +#include + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + printf("kde_styledir=\\"/tmp/dummy\\"\n"); + printf("kde_widgetdir=\\"/tmp/dummy\\"\n"); + printf("xdg_appsdir=\\"/tmp/dummy\\"\n"); + printf("xdg_menudir=\\"/tmp/dummy\\"\n"); + printf("xdg_directorydir=\\"/tmp/dummy\\"\n"); + printf("kde_kcfgdir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$all_includes $CPPFLAGS" + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_CHECK_KDEQTADDON], +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN([KDE_CREATE_LIBS_ALIASES], +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 3; then + case $host in + *cygwin*) lib_kded="-lkdeinit_kded" ;; + *) lib_kded="" ;; + esac + AC_SUBST(LIB_KDED, $lib_kded) + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KJS, "-lkjs") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KABC, "-lkabc") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") + AC_SUBST(LIB_KUTILS, "-lkutils") + AC_SUBST(LIB_KDEPIM, "-lkdepim") + AC_SUBST(LIB_KIMPROXY, "-lkimproxy") + AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff") + AC_SUBST(LIB_KDNSSD, "-lkdnssd") + AC_SUBST(LIB_KUNITTEST, "-lkunittest") +# these are for backward compatibility + AC_SUBST(LIB_KSYCOCA, "-lkio") + AC_SUBST(LIB_KFILE, "-lkio") +elif test $kde_qtver = 2; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KSYCOCA, "-lksycoca") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KFILE, "-lkfile") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +else + AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") + AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") + AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") + AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") + AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)") +fi +]) + +AC_DEFUN([AC_PATH_KDE], +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]), + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl KDE_CHECK_FUNC_EXT(, [headers], [sample-use], [C prototype], [autoheader define], [call if found]) +AC_DEFUN([KDE_CHECK_FUNC_EXT], +[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(kde_cv_func_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GXX" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +$2 +], +[ +$3 +], +kde_cv_func_$1=yes, +kde_cv_func_$1=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS="$kde_safe_LIBS" +AC_LANG_RESTORE +]) + +AC_MSG_RESULT($kde_cv_func_$1) + +AC_MSG_CHECKING([if $1 needs custom prototype]) +AC_CACHE_VAL(kde_cv_proto_$1, +[ +if test "x$kde_cv_func_$1" = xyes; then + kde_cv_proto_$1=no +else + case "$1" in + setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) + kde_cv_proto_$1="yes - in libkdefakes" + ;; + *) + kde_cv_proto_$1=unknown + ;; + esac +fi + +if test "x$kde_cv_proto_$1" = xunknown; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +$2 + +extern "C" $4; +], +[ +$3 +], +[ kde_cv_func_$1=yes + kde_cv_proto_$1=yes ], + [kde_cv_proto_$1="$1 unavailable"] +) +LIBS=$kde_safe_libs +AC_LANG_RESTORE +fi +]) +AC_MSG_RESULT($kde_cv_proto_$1) + +if test "x$kde_cv_func_$1" = xyes; then + AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) + $6 +fi +if test "x$kde_cv_proto_$1" = xno; then + AC_DEFINE(HAVE_$5_PROTO, 1, + [Define if you have the $1 prototype]) +fi + +AH_VERBATIM([_HAVE_$5_PROTO], +[ +#if !defined(HAVE_$5_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +$4; +#ifdef __cplusplus +} +#endif +#endif +]) +]) + +AC_DEFUN([AC_CHECK_SETENV], +[ + KDE_CHECK_FUNC_EXT(setenv, [ +#include +], + [setenv("VAR", "VALUE", 1);], + [int setenv (const char *, const char *, int)], + [SETENV]) +]) + +AC_DEFUN([AC_CHECK_UNSETENV], +[ + KDE_CHECK_FUNC_EXT(unsetenv, [ +#include +], + [unsetenv("VAR");], + [void unsetenv (const char *)], + [UNSETENV]) +]) + +AC_DEFUN([AC_CHECK_GETDOMAINNAME], +[ + KDE_CHECK_FUNC_EXT(getdomainname, [ +#include +#include +#include +], + [ +char buffer[200]; +getdomainname(buffer, 200); +], + [#include + int getdomainname (char *, size_t)], + [GETDOMAINNAME]) +]) + +AC_DEFUN([AC_CHECK_GETHOSTNAME], +[ + KDE_CHECK_FUNC_EXT(gethostname, [ +#include +#include +], + [ +char buffer[200]; +gethostname(buffer, 200); +], + [int gethostname (char *, unsigned int)], + [GETHOSTNAME]) +]) + +AC_DEFUN([AC_CHECK_USLEEP], +[ + KDE_CHECK_FUNC_EXT(usleep, [ +#include +], + [ +usleep(200); +], + [int usleep (unsigned int)], + [USLEEP]) +]) + + +AC_DEFUN([AC_CHECK_RANDOM], +[ + KDE_CHECK_FUNC_EXT(random, [ +#include +], + [ +random(); +], + [long int random(void)], + [RANDOM]) + + KDE_CHECK_FUNC_EXT(srandom, [ +#include +], + [ +srandom(27); +], + [void srandom(unsigned int)], + [SRANDOM]) + +]) + +AC_DEFUN([AC_CHECK_INITGROUPS], +[ + KDE_CHECK_FUNC_EXT(initgroups, [ +#include +#include +#include +], + [ +char buffer[200]; +initgroups(buffer, 27); +], + [int initgroups(const char *, gid_t)], + [INITGROUPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMPS], +[ + KDE_CHECK_FUNC_EXT(mkstemps, [ +#include +#include +], + [ +mkstemps("/tmp/aaaXXXXXX", 6); +], + [int mkstemps(char *, int)], + [MKSTEMPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMP], +[ + KDE_CHECK_FUNC_EXT(mkstemp, [ +#include +#include +], + [ +mkstemp("/tmp/aaaXXXXXX"); +], + [int mkstemp(char *)], + [MKSTEMP]) +]) + +AC_DEFUN([AC_CHECK_MKDTEMP], +[ + KDE_CHECK_FUNC_EXT(mkdtemp, [ +#include +#include +], + [ +mkdtemp("/tmp/aaaXXXXXX"); +], + [char *mkdtemp(char *)], + [MKDTEMP]) +]) + + +AC_DEFUN([AC_CHECK_RES_INIT], +[ + AC_MSG_CHECKING([if res_init needs -lresolv]) + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( + [ +#include +#include +#include +#include + ], + [ + res_init(); + ], + [ + LIBRESOLV="-lresolv" + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) + LIBS=$kde_libs_safe + AC_SUBST(LIBRESOLV) + + KDE_CHECK_FUNC_EXT(res_init, + [ +#include +#include +#include +#include + ], + [res_init()], + [int res_init(void)], + [RES_INIT]) +]) + +AC_DEFUN([AC_CHECK_STRLCPY], +[ + KDE_CHECK_FUNC_EXT(strlcpy, [ +#include +], +[ char buf[20]; + strlcpy(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcpy(char*, const char*, unsigned long)], + [STRLCPY]) +]) + +AC_DEFUN([AC_CHECK_STRLCAT], +[ + KDE_CHECK_FUNC_EXT(strlcat, [ +#include +], +[ char buf[20]; + buf[0]='\0'; + strlcat(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcat(char*, const char*, unsigned long)], + [STRLCAT]) +]) + +AC_DEFUN([AC_CHECK_RES_QUERY], +[ + KDE_CHECK_FUNC_EXT(res_query, [ +#include +#include +#include +#include +#include +], +[ +res_query(NULL, 0, 0, NULL, 0); +], + [int res_query(const char *, int, int, unsigned char *, int)], + [RES_QUERY]) +]) + +AC_DEFUN([AC_CHECK_DN_SKIPNAME], +[ + KDE_CHECK_FUNC_EXT(dn_skipname, [ +#include +#include +#include +#include +], +[ +dn_skipname (NULL, NULL); +], + [int dn_skipname (unsigned char *, unsigned char *)], + [DN_SKIPNAME]) +]) + + +AC_DEFUN([AC_FIND_GIF], + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +else +LIBS="$all_libraries -lgif" +fi +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN([KDE_FIND_JPEG_HELPER], +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[ +#ifdef __cplusplus +extern "C" { +#endif +void jpeg_CreateDecompress(); +#ifdef __cplusplus +} +#endif +], +[jpeg_CreateDecompress();], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN([AC_FIND_JPEG], +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +AH_VERBATIM(_AC_CHECK_JPEG, +[/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif +]) +]) + +AC_DEFUN([KDE_CHECK_QT_JPEG], +[ +if test -n "$LIBJPEG"; then +AC_MSG_CHECKING([if Qt needs $LIBJPEG]) +AC_CACHE_VAL(kde_cv_qt_jpeg, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS $LIBQT" +LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[#include ], + [ + int argc; + char** argv; + QApplication app(argc, argv);], + eval "kde_cv_qt_jpeg=no", + eval "kde_cv_qt_jpeg=yes") +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +fi +]) + +if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then + AC_MSG_RESULT(yes) + LIBJPEG_QT='$(LIBJPEG)' +else + AC_MSG_RESULT(no) + LIBJPEG_QT= +fi + +]) + +AC_DEFUN([AC_FIND_ZLIB], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include +], +[ + char buf[42]; + gzFile f = (gzFile) 0; + /* this would segfault.. but we only link, don't run */ + (void) gzgets(f, buf, sizeof(buf)); + + return (zlibVersion() == ZLIB_VERSION); +], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. + Possibly configure picks up an outdated version + installed by XFree86. Remove it from your system. + + Check your installation and look into config.log) + LIBZ="" +fi +AC_SUBST(LIBZ) +]) + +AC_DEFUN([KDE_TRY_TIFFLIB], +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +else +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm" +fi +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN([AC_FIND_TIFF], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + +AC_DEFUN([KDE_FIND_LIBEXR], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_CACHE_VAL(ac_cv_libexr, +[ + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + AC_MSG_CHECKING([for OpenEXR libraries]) + + if test "$PKG_CONFIG" = "no" ; then + AC_MSG_RESULT(no) + 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 + if !(`$PKG_CONFIG --exists OpenEXR`) ; then + AC_MSG_RESULT(no) + EXRSTATUS=no + else + if !(`$PKG_CONFIG --atleast-version="1.1.1" OpenEXR`) ; then + AC_MSG_RESULT(no) + EXRSTATUS=old + else + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries $USER_LDFLAGS $LIBZ `pkg-config --libs OpenEXR`" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_CXXFLAGS="$CXXFLAGS" + EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR` + CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS" + + AC_TRY_LINK(dnl + [ + #include + ], + [ + using namespace Imf; + RgbaInputFile file ("dummy"); + return 0; + ], + eval "ac_cv_libexr='`pkg-config --libs OpenEXR`'", + eval "ac_cv_libexr=no" + ) + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + AC_LANG_RESTORE + ])dnl + if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR]) + LIB_EXR="$ac_cv_libexr" + AC_MSG_RESULT($ac_cv_libexr) + else + AC_MSG_RESULT(no) + LIB_EXR="" + fi + fi + fi + fi + AC_SUBST(LIB_EXR) + AC_SUBST(EXR_FLAGS) +]) + + + +AC_DEFUN([AC_FIND_PNG], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +else +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm" +fi +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + + +AC_DEFUN([AC_FIND_JASPER], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_MSG_CHECKING([for jasper]) +AC_CACHE_VAL(ac_cv_jasper, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include + ], + [ + return( jas_init() ); + ], + eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'", + eval "ac_cv_jasper=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper]) + LIB_JASPER="$ac_cv_jasper" + AC_MSG_RESULT($ac_cv_jasper) +else + AC_MSG_RESULT(no) + LIB_JASPER="" +fi +AC_SUBST(LIB_JASPER) +]) + +AC_DEFUN([AC_CHECK_BOOL], +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN([AC_CHECK_GNU_EXTENSIONS], +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN([KDE_CHECK_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CXX supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], []) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CC supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_C + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], []) + CFLAGS="$save_CFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN([AC_REMOVE_FORBIDDEN], +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + + +AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER], +[ + AC_MSG_CHECKING([whether $CC is blacklisted]) + + dnl In theory we have tu run this test against $CC and $CXX + dnl in C and in C++ mode, because its perfectly legal for + dnl the user to mix compiler versions, since C has a defined + dnl ABI. + dnl + dnl For now, we assume the user is not on crack. + + AC_TRY_COMPILE([ +#ifdef __GNUC__ +#if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0 +choke me +#endif +#endif +], , + kde_bad_compiler=no, + kde_bad_compiler=yes +) + + AC_MSG_RESULT($kde_bad_compiler) + +if test "$kde_bad_compiler" = "yes"; then + AC_MSG_ERROR([ + +This particular compiler version is blacklisted because it +is known to miscompile KDE. Please use a newer version, or +if that is not yet available, choose an older version. + +Please do not report a bug or bother us reporting this +configure error. We know about it, and we introduced +it by intention to avoid untraceable bugs or crashes in KDE. + +]) +fi + +]) + + +AC_DEFUN([KDE_CHECK_FOR_OPT_NOINLINE_MATCH], +[ + AC_CACHE_CHECK([whether system headers can cope with -O2 -fno-inline], + kde_cv_opt_noinline_match, + [ + kde_cv_opt_noinline_match=irrelevant + dnl if we don't use both -O2 and -fno-inline, this check is moot + if echo "$CFLAGS" | grep -qe -O2 \ + && echo "$CFLAGS" | grep -qe -fno-inline ; then + + ac_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS -D_USE_GNU" + + AC_TRY_LINK([ + #include +], [ const char *pt, *et; + et = __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p ( ";," ) && ((size_t)(const void *)(( ";," )+ 1) - (size_t)(const void *)( ";," ) == 1) ? ((__a0 =((__const char *) ( ";," ))[0], __a0 == '\0') ? ((void) ( pt ),((void *)0) ) : ((__a1 = ((__const char *) ( ";," ))[1], __a1== '\0') ? (__extension__ (__builtin_constant_p ( __a0 ) && ( __a0 ) == '\0' ? (char *) __rawmemchr ( pt , __a0) : strchr( pt , __a0 ))) : ((__a2 = ((__const char *) ( ";," ))[2], __a2 == '\0') ? __strpbrk_c2 ( pt , __a0, __a1) :(((__const char *) ( ";," ))[3] == '\0' ? __strpbrk_c3 ( pt ,__a0, __a1, __a2): strpbrk ( pt , ";," ))))) : strpbrk ( pt , ";," )); }) ; +], + kde_cv_opt_noinline_match=yes, + kde_cv_opt_noinline_match=no + ) + + CFLAGS="$ac_cflags_save" + fi + ]) +]) + + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN([AC_VALIDIFY_CXXFLAGS], +[dnl +if test "x$kde_use_qt_emb" != "xyes"; then + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +else + AC_REMOVE_FORBIDDEN(CXX, [-rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath]) +fi +]) + +AC_DEFUN([AC_CHECK_COMPILERS], +[ + AC_ARG_ENABLE(debug, + AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]), + [ + case $enableval in + yes) + kde_use_debug_code="yes" + kde_use_debug_define=no + ;; + full) + kde_use_debug_code="full" + kde_use_debug_define=no + ;; + *) + kde_use_debug_code="no" + kde_use_debug_define=yes + ;; + esac + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption, + AC_HELP_STRING([--disable-debug], + [disables debug output and debug symbols [default=no]]), + [],[]) + + AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], + [compiles with strict compiler options (may not work!)]), + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]), + [ + if test $enableval = "no"; then + kde_use_warnings="no" + else + kde_use_warnings="yes" + fi + ], [kde_use_warnings="yes"]) + + dnl enable warnings for debug build + if test "$kde_use_debug_code" != "no"; then + kde_use_warnings=yes + fi + + AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]), + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + AC_PROG_CPP + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" != "no"; then + if test $kde_use_debug_code = "full"; then + CFLAGS="-g3 -fno-inline $CFLAGS" + else + CFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CFLAGS" + fi + else + CFLAGS="-O2 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + KDE_CHECK_FOR_BAD_COMPILER + + if test "$GXX" = "yes" || test "$CXX" = "KCC"; then + if test "$kde_use_debug_code" != "no"; then + if test "$CXX" = "KCC"; then + CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS" + else + if test "$kde_use_debug_code" = "full"; then + CXXFLAGS="-g3 -fno-inline $CXXFLAGS" + else + CXXFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CXXFLAGS" + fi + fi + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + dnl convenience compiler flags + KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""]) + AC_SUBST(WOVERLOADED_VIRTUAL) + else + if test "$CXX" = "KCC"; then + CXXFLAGS="+K3 $CXXFLAGS" + else + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + if test "$kde_use_warnings" = "yes"; then + if test "$GCC" = "yes"; then + CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS" + case $host in + *-*-linux-gnu) + CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"]) + KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"]) + ;; + esac + KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + dnl ### FIXME: revert for KDE 4 + KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"]) + fi + fi + + if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS" + fi + + AC_ARG_ENABLE(pch, + AC_HELP_STRING([--enable-pch], + [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]), + [ kde_use_pch=$enableval ],[ kde_use_pch=no ]) + + HAVE_GCC_VISIBILITY=0 + AC_SUBST([HAVE_GCC_VISIBILITY]) + + if test "$GXX" = "yes"; then + gcc_no_reorder_blocks=NO + KDE_CHECK_COMPILER_FLAG(fno-reorder-blocks,[gcc_no_reorder_blocks=YES]) + if test $kde_use_debug_code != "no" && \ + test $kde_use_debug_code != "full" && \ + test "YES" = "$gcc_no_reorder_blocks" ; then + CXXFLAGS="$CXXFLAGS -fno-reorder-blocks" + CFLAGS="$CFLAGS -fno-reorder-blocks" + fi + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + ENABLE_PERMISSIVE_FLAG="-fpermissive" + + if test "$kde_use_pch" = "yes"; then + AC_MSG_CHECKING(whether gcc supports precompiling c header files) + echo >conftest.h + if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then + kde_gcc_supports_pch=yes + AC_MSG_RESULT(yes) + else + kde_gcc_supports_pch=no + AC_MSG_RESULT(no) + fi + if test "$kde_gcc_supports_pch" = "yes"; then + AC_MSG_CHECKING(whether gcc supports precompiling c++ header files) + if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then + kde_gcc_supports_pch=yes + AC_MSG_RESULT(yes) + else + kde_gcc_supports_pch=no + AC_MSG_RESULT(no) + fi + fi + rm -f conftest.h conftest.h.gch + fi + + KDE_CHECK_FOR_OPT_NOINLINE_MATCH + if test "x$kde_cv_opt_noinline_match" = "xno" ; then + CFLAGS="`echo "$CFLAGS" | sed "s/ -fno-inline//"`" + fi + fi + AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes") + if test "$CXX" = "KCC"; then + dnl unfortunately we currently cannot disable exception support in KCC + dnl because doing so is binary incompatible and Qt by default links with exceptions :-( + dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"]) + dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= ) + + if test "$kde_use_pch" = "yes"; then + dnl TODO: support --pch-dir! + KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"]) + dnl the below works (but the dir must exist), but it's + dnl useless for a whole package. + dnl The are precompiled headers for each source file, so when compiling + dnl from scratch, it doesn't make a difference, and they take up + dnl around ~5Mb _per_ sourcefile. + dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp, + dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"]) + fi + dnl this flag controls inlining. by default KCC inlines in optimisation mode + dnl all implementations that are defined inside the class {} declaration. + dnl because of templates-compatibility with broken gcc compilers, this + dnl can cause excessive inlining. This flag limits it to a sane level + KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"]) + KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"]) + KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"]) + KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"]) + dnl Some source files are shared between multiple executables + dnl (or libraries) and some of those need template instantiations. + dnl In that case KCC needs to compile those sources with + dnl --one_instantiation_per_object. To make it easy for us we compile + dnl _all_ objects with that flag (--one_per is a shorthand). + KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"]) + fi + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + if test "$GCC" = yes; then + NOOPT_CFLAGS=-O0 + fi + KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0]) + + AC_ARG_ENABLE(coverage, + AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [ + if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then + ac_coverage_compiler="-fprofile-arcs -ftest-coverage" + ac_coverage_linker="-lgcc" + elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then + ac_coverage_compiler="-fprofile-arcs -ftest-coverage" + ac_coverage_linker="" + else + AC_MSG_ERROR([coverage with your compiler is not supported]) + fi + CFLAGS="$CFLAGS $ac_coverage_compiler" + CXXFLAGS="$CXXFLAGS $ac_coverage_compiler" + LDFLAGS="$LDFLAGS $ac_coverage_linker" + ]) + + AC_SUBST(NOOPT_CXXFLAGS) + AC_SUBST(NOOPT_CFLAGS) + AC_SUBST(ENABLE_PERMISSIVE_FLAG) + + KDE_CHECK_NEW_LDFLAGS + KDE_CHECK_FINAL + KDE_CHECK_CLOSURE + KDE_CHECK_NMCHECK + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) +]) + +AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG], + [ + AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + safe_CXXFLAGS=$CXXFLAGS + safe_LDFLAGS=$LDFLAGS + CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0" + LDFLAGS="$LDFLAGS -shared -fPIC" + + AC_TRY_LINK( + [ + /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */ + #include + int some_function( void ) __attribute__ ((visibility("default"))); + int some_function( void ) + { + std::string s("blafasel"); + return 0; + } + ], [/* elvis is alive */], + kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes) + + CXXFLAGS=$safe_CXXFLAGS + LDFLAGS=$safe_LDFLAGS + AC_LANG_RESTORE + ] + ) + + if test x$kde_cv_val_gcc_visibility_bug = xno; then + CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" + fi + ] +) + +AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY], +[ + AC_BEFORE([AC_PATH_QT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY]) + + AC_MSG_CHECKING([grepping for visibility push/pop in headers]) + + if test "x$GXX" = "xyes"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_EGREP_CPP( + [GCC visibility push], + [ #include + ], + [ + AC_MSG_RESULT(yes) + kde_stdc_visibility_patched=yes ], + [ + AC_MSG_RESULT(no) + AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for + visibility support. Disabling -fvisibility=hidden]) + + kde_stdc_visibility_patched=no ]) + + AC_LANG_RESTORE + + kde_have_gcc_visibility=no + KDE_CHECK_COMPILER_FLAG(fvisibility=hidden, + [ + kde_have_gcc_visibility=yes + dnl the whole toolchain is just a mess, gcc is just too buggy + dnl to handle STL with visibility enabled. Lets reconsider + dnl when gcc 4.2 is out or when things get fixed in the compiler. + dnl Contact mueller@kde.org for details. + AC_ARG_ENABLE(gcc-hidden-visibility, + AC_HELP_STRING([--enable-gcc-hidden-visibility],[toolchain hidden visibility [default=no]]), + [kde_have_gcc_visibility=$enableval], + [kde_have_gcc_visibility=no]) + + AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + safe_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $all_includes" + + AC_TRY_COMPILE( + [ +#include +#if Q_EXPORT - 0 != 0 +/* if this compiles, then Q_EXPORT is undefined */ +/* if Q_EXPORT is nonempty, this will break compilation */ +#endif + ], [/* elvis is alive */], + kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes) + + CXXFLAGS=$safe_CXXFLAGS + AC_LANG_RESTORE + ] + ) + + if test x$kde_have_gcc_visibility = "xyes" && test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then + CXXFLAGS="$CXXFLAGS -fvisibility=hidden" + KDE_CHECK_VISIBILITY_GCC_BUG + HAVE_GCC_VISIBILITY=1 + AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported]) + fi + ]) + fi +]) + +AC_DEFUN([KDE_ADD_DEPENDENCIES], +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN([KDE_PROG_LIBTOOL], +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_OBJEXT +AC_EXEEXT + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)" +AC_SUBST(KDE_PLUGIN) + +# This hack ensures that libtool creates shared libs for kunittest plugins. By default check_LTLIBRARIES makes static libs. +KDE_CHECK_PLUGIN="\$(KDE_PLUGIN) -rpath \$(libdir)" +AC_SUBST(KDE_CHECK_PLUGIN) + +# we patch configure quite some so we better keep that consistent for incremental runs +AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure') +]) + +AC_DEFUN([KDE_CHECK_LIB64], +[ + kdelibsuff="$kde_libs_suffix" + if test -z "$kdelibsuff"; then + kdelibsuff="auto" + fi + AC_ARG_ENABLE(libsuffix, + AC_HELP_STRING([--enable-libsuffix], + [/lib directory suffix (64,32,none,auto[=default])]), + kdelibsuff=$enableval) + + if test "$kdelibsuff" = "auto"; then + +cat > conftest.c << EOF +#include +int main() { + return 0; +} +EOF + kdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out | grep -E "libc.so"| grep -E -o "/lib[[^\/]]*/" | sed "s/lib//" | sed "s/\/*//g"` + rm -rf conftest.* + fi + + if test "$kdelibsuff" = "no"; then + kdelibsuff= + fi + if test -z "$kdelibsuff"; then + AC_MSG_RESULT([not using lib directory suffix]) + AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories) + else + if test "$libdir" = '${exec_prefix}/lib'; then + libdir="$libdir${kdelibsuff}" + AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms + fi + AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${kdelibsuff}"], Suffix for lib directories) + AC_MSG_RESULT([using lib directory suffix $kdelibsuff]) + fi +]) + +AC_DEFUN([KDE_CHECK_TYPES], +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(short)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl +])dnl + +dnl Not used - kept for compat only? +AC_DEFUN([KDE_DO_IT_ALL], +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN([AC_CHECK_RPATH], +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]), + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(libdir)" + + if test "$kde_libraries" != "$libdir"; then + KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)" + fi + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + X_RPATH="-R \$(x_libraries)" + KDE_RPATH="$KDE_RPATH $X_RPATH" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_SUBST(X_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN([AC_CHECK_SOCKLEN_T], +[ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(kde_cv_socklen_t, + [ + AC_LANG_PUSH(C++) + kde_cv_socklen_t=no + AC_TRY_COMPILE([ + #include + #include + ], + [ + socklen_t len; + getpeername(0,0,&len); + ], + [ + kde_cv_socklen_t=yes + kde_cv_socklen_t_equiv=socklen_t + ]) + AC_LANG_POP(C++) + ]) + AC_MSG_RESULT($kde_cv_socklen_t) + if test $kde_cv_socklen_t = no; then + AC_MSG_CHECKING([for socklen_t equivalent for socket functions]) + AC_CACHE_VAL(kde_cv_socklen_t_equiv, + [ + kde_cv_socklen_t_equiv=int + AC_LANG_PUSH(C++) + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #include + #include + ], + [ + $t len; + getpeername(0,0,&len); + ], + [ + kde_cv_socklen_t_equiv="$t" + break + ]) + done + AC_LANG_POP(C++) + ]) + AC_MSG_RESULT($kde_cv_socklen_t_equiv) + fi + AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined]) + AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)]) +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in 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. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN([AM_KDE_WITH_NLS], + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + 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 programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE], +[# 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. + +# serial 1 + +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 locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN([AM_FUNC_OBSTACK], +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN([AM_KDE_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])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_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + 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 + + ]) + +AC_DEFUN([AC_HAVE_XPM], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]), + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + else + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET" + fi + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include ],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN([AC_HAVE_DPMS], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]), + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then + AC_MSG_RESULT(no) + ac_cv_have_dpms="no" + else + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries" + LIBS="-lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LIBS="-lXdpms $LIBS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + fi + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + ac_save_cflags="$CFLAGS" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO, + [Define if you have the DPMSCapable prototype in ]) + AC_CHECK_DECL(DPMSCapable, + AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),, + [#include + #include ]) + AH_TEMPLATE(HAVE_DPMSINFO_PROTO, + [Define if you have the DPMSInfo prototype in ]) + AC_CHECK_DECL(DPMSInfo, + AC_DEFINE(HAVE_DPMSINFO_PROTO),, + [#include + #include ]) + CFLAGS="$ac_save_cflags" + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN([AC_HAVE_GL], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]), + gl_test=$withval, gl_test="yes") + if test "x$kde_use_qt_emb" = "xyes"; then + # GL and Qt Embedded is a no-go for now. + ac_cv_have_gl=no + elif test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_ldflags=$LDFLAGS + ac_save_cxxflags=$CXXFLAGS + ac_save_libs=$LIBS + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries" + LIBS="$LIBS -lGL -lGLU" + test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11" + LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + AC_LANG_RESTORE + LDFLAGS=$ac_save_ldflags + CXXFLAGS=$ac_save_cxxflags + LIBS=$ac_save_libs + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + GLLIB='-lGLU -lGL $(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)' + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN([KDE_PAM], [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + want_pam= + AC_ARG_WITH(pam, + AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]), + [ if test "x$withval" = "xyes"; then + want_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + want_pam=no + else + want_pam=yes + pam_service=$withval + fi + ], [ pam_service=kde ]) + + use_pam= + PAMLIBS= + if test "x$want_pam" != xno; then + AC_CHECK_LIB(pam, pam_start, [ + AC_CHECK_HEADER(security/pam_appl.h, + [ pam_header=security/pam_appl.h ], + [ AC_CHECK_HEADER(pam/pam_appl.h, + [ pam_header=pam/pam_appl.h ], + [ + AC_MSG_WARN([PAM detected, but no headers found! +Make sure you have the necessary development packages installed.]) + ] + ) + ] + ) + ], , $LIBDL) + if test -z "$pam_header"; then + if test "x$want_pam" = xyes; then + AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!]) + fi + else + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + use_pam=yes + + dnl darwin claims to be something special + if test "$pam_header" = "pam/pam_appl.h"; then + AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/]) + fi + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], $pam_header, + [ AC_EGREP_HEADER([const struct pam_message], $pam_header, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN([DEF_PAM_SERVICE], [ + AC_ARG_WITH($1-pam, + AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]), + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE=$withval + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN([KDE_SHADOWPASSWD], [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + AC_HELP_STRING([--with-shadow],[If you want shadow password support]), + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN([KDE_PASSWDLIBS], [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but + dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires + dnl root to read, so kcheckpass needs to be root (even when using pam, since pam + dnl may need to read /etc/master.passwd). + case $host in + *-*-freebsd*) + SETUIDFLAGS="-m 4755 -o root" + ;; + *) + ;; + esac + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN([KDE_CHECK_LIBDL], +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN([KDE_CHECK_DLOPEN], +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]), +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING], +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN([KDE_ADD_INCLUDES], +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + +AC_DEFUN([KDE_CHECK_LIBPTHREAD], +[ + dnl This code is here specifically to handle the + dnl various flavors of threading library on FreeBSD + dnl 4-, 5-, and 6-, and the (weird) rules around it. + dnl There may be an environment PTHREAD_LIBS that + dnl specifies what to use; otherwise, search for it. + dnl -pthread is special cased and unsets LIBPTHREAD + dnl below if found. + LIBPTHREAD="" + + if test -n "$PTHREAD_LIBS"; then + if test "x$PTHREAD_LIBS" = "x-pthread" ; then + LIBPTHREAD="PTHREAD" + else + PTHREAD_LIBS_save="$PTHREAD_LIBS" + PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'` + AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS]) + KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [ + LIBPTHREAD="$PTHREAD_LIBS_save"]) + PTHREAD_LIBS="$PTHREAD_LIBS_save" + fi + fi + + dnl Is this test really needed, in the face of the Tru64 test below? + if test -z "$LIBPTHREAD"; then + AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"]) + fi + + dnl This is a special Tru64 check, see BR 76171 issue #18. + if test -z "$LIBPTHREAD" ; then + AC_MSG_CHECKING([for pthread_create in -lpthread]) + kde_safe_libs=$LIBS + LIBS="$LIBS -lpthread" + AC_TRY_LINK([#include ],[(void)pthread_create(0,0,0,0);],[ + AC_MSG_RESULT(yes) + LIBPTHREAD="-lpthread"],[ + AC_MSG_RESULT(no)]) + LIBS=$kde_safe_libs + fi + + dnl Un-special-case for FreeBSD. + if test "x$LIBPTHREAD" = "xPTHREAD" ; then + LIBPTHREAD="" + fi + + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_PTHREAD_OPTION], +[ + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"]) + fi + + AH_VERBATIM(__svr_define, [ +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif +]) + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + if test "$CXX" = "KCC"; then + CXXFLAGS="$CXXFLAGS --thread_safe" + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe" + fi + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_THREADING], +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + if test -z "$USE_THREADS"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]), + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN([KDE_TRY_LINK_PYTHON], +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi + +fi + +]) + +AC_DEFUN([KDE_CHECK_PYTHON_DIR], +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]), +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN([KDE_CHECK_PYTHON_INTERN], +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs" +AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.so; then + AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) + if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(db2, -ldb2) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm]) + KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this + and contact the authors to let them know about this problem]) + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN([KDE_CHECK_PYTHON], +[ + KDE_CHECK_PYTHON_INTERN("2.4", + [KDE_CHECK_PYTHON_INTERN("2.3", + [KDE_CHECK_PYTHON_INTERN("2.2", + [KDE_CHECK_PYTHON_INTERN("2.1", + [KDE_CHECK_PYTHON_INTERN("2.0", + [KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ]) + ]) + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_STL], +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + + AC_MSG_CHECKING([if C++ programs can be compiled]) + AC_CACHE_VAL(kde_cv_stl_works, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_works=yes, + kde_cv_stl_works=no) +]) + + AC_MSG_RESULT($kde_cv_stl_works) + + if test "$kde_cv_stl_works" = "yes"; then + # back compatible + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + else + AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs. +Check config.log for details - if you're using a Linux distribution you might miss +a package named similar to libstdc++-dev.]) + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN([AC_FIND_QIMGIO], + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include +#include +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN([AM_DISABLE_LIBRARIES], +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN([AC_CHECK_UTMP_FILE], +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN([KDE_CREATE_SUBDIRSLIST], +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" +TOPSUBDIRS="" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +ac_topsubdirs= +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +elif test -s $srcdir/subdirs; then + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + vari=`echo $i | sed -e 's,[[-+.@]],_,g'` + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + eval "$vari""_SUBDIR_included=yes" + else + eval "$vari""_SUBDIR_included=no" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN([KDE_CHECK_NAMESPACES], +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_S_ISSOCK], +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_TRY_LINK( +[ +#include +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi + +AH_VERBATIM(_ISSOCK, +[ +#ifndef HAVE_S_ISSOCK +#define HAVE_S_ISSOCK +#define S_ISSOCK(mode) (1==0) +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_KDEMAXPATHLEN], +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +cat > conftest.$ac_ext < +#endif +#include +#include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +AC_DEFUN([KDE_CHECK_HEADER], +[ + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER([$1], [$2], [$3], [$4]) + AC_LANG_RESTORE + CPPFLAGS=$kde_safe_cppflags +]) + +AC_DEFUN([KDE_CHECK_HEADERS], +[ + AH_CHECK_HEADERS([$1]) + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_FAST_CONFIGURE], +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]), + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN([KDE_CONF_FILES], +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +dnl This sets the prefix, for arts and kdelibs +dnl Do NOT use in any other module. +dnl It only looks at --prefix, KDEDIR and falls back to /usr/local/kde +AC_DEFUN([KDE_SET_PREFIX_CORE], +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$prefix" + fi + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + + +AC_DEFUN([KDE_SET_PREFIX], +[ + unset CDPATH + dnl We can't give real code to that macro, only a value. + dnl It only matters for --help, since we set the prefix in this function anyway. + AC_PREFIX_DEFAULT(${KDEDIR:-the kde prefix}) + + KDE_SET_DEFAULT_BINDIRS + if test "x$prefix" = "xNONE"; then + dnl no prefix given: look for kde-config in the PATH and deduce the prefix from it + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend) + else + dnl prefix given: look for kde-config, preferrably in prefix, otherwise in PATH + kde_save_PATH="$PATH" + PATH="$exec_prefix/bin:$prefix/bin:$PATH" + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)], [], prepend) + PATH="$kde_save_PATH" + fi + + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + kde_libs_suffix=`$KDECONFIG --libsuffix` + + AC_MSG_CHECKING([where to install]) + if test "x$prefix" = "xNONE"; then + prefix=$kde_libs_prefix + AC_MSG_RESULT([$prefix (as returned by kde-config)]) + else + dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different + given_prefix=$prefix + AC_MSG_RESULT([$prefix (as requested)]) + fi + + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + + AC_SUBST(KDECONFIG) + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) + + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN([KDE_LANG_CPLUSPLUS], +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN([KDE_CHECK_LONG_LONG], +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) + AC_LANG_RESTORE +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN([KDE_CHECK_LIB], +[ + kde_save_LDFLAGS="$LDFLAGS" + dnl AC_CHECK_LIB modifies LIBS, so save it here + kde_save_LIBS="$LIBS" + LDFLAGS="$LDFLAGS $all_libraries" + case $host_os in + aix*) LDFLAGS="-brtl $LDFLAGS" + test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LDFLAGS="$kde_save_LDFLAGS" + LIBS="$kde_save_LIBS" +]) + +AC_DEFUN([KDE_JAVA_PREFIX], +[ + dir=`dirname "$1"` + base=`basename "$1"` + list=`ls -1 $dir 2> /dev/null` + for entry in $list; do + if test -d $dir/$entry/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/bin" + ;; + esac + elif test -d $dir/$entry/jre/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/jre/bin" + ;; + esac + fi + done +]) + +dnl KDE_CHEC_JAVA_DIR(onlyjre) +AC_DEFUN([KDE_CHECK_JAVA_DIR], +[ + +AC_ARG_WITH(java, +AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]), +[ ac_java_dir=$withval +], ac_java_dir="" +) + +AC_MSG_CHECKING([for Java]) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = "xno"; then + kde_java_bindir=no + kde_java_includedir=no + kde_java_libjvmdir=no + kde_java_libgcjdir=no + kde_java_libhpidir=no +else + if test "x$ac_java_dir" = "x"; then + + + dnl No option set -> collect list of candidate paths + if test -n "$JAVA_HOME"; then + KDE_JAVA_PREFIX($JAVA_HOME) + fi + KDE_JAVA_PREFIX(/usr/j2se) + KDE_JAVA_PREFIX(/usr/lib/j2se) + KDE_JAVA_PREFIX(/usr/j*dk*) + KDE_JAVA_PREFIX(/usr/lib/j*dk*) + KDE_JAVA_PREFIX(/opt/j*sdk*) + KDE_JAVA_PREFIX(/usr/lib/java*) + KDE_JAVA_PREFIX(/usr/java*) + KDE_JAVA_PREFIX(/usr/java/j*dk*) + KDE_JAVA_PREFIX(/usr/java/j*re*) + KDE_JAVA_PREFIX(/usr/lib/SunJava2*) + KDE_JAVA_PREFIX(/usr/lib/SunJava*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava2*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava*) + KDE_JAVA_PREFIX(/opt/java*) + + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + if test -d "$dir"; then + javadirs="$javadirs $dir" + fi + done + IFS=$kde_save_IFS + jredirs= + + dnl Now javadirs contains a list of paths that exist, all ending with bin/ + for dir in $javadirs; do + dnl Check for the java executable + if test -x "$dir/java"; then + dnl And also check for a libjvm.so somewhere under there + dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big. + if test "$dir" != "/usr/bin"; then + libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + if test ! -f $libjvmdir/libjvm.so; then continue; fi + jredirs="$jredirs $dir" + fi + fi + done + + dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found + JAVAC= + JAVA= + kde_java_bindir=no + for dir in $jredirs; do + JAVA="$dir/java" + kde_java_bindir=$dir + if test -x "$dir/javac"; then + JAVAC="$dir/javac" + break + fi + done + + if test -n "$JAVAC"; then + dnl this substitution might not work - well, we test for jni.h below + kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'` + else + kde_java_includedir=no + fi + else + dnl config option set + kde_java_bindir=$ac_java_dir/bin + if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then + kde_java_includedir=no + else + kde_java_includedir=$ac_java_dir/include + fi + fi +fi + +dnl At this point kde_java_bindir and kde_java_includedir are either set or "no" +if test "x$kde_java_bindir" != "xno"; then + + dnl Look for libjvm.so + kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + dnl Look for libgcj.so + kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1` + dnl Look for libhpi.so and avoid green threads + kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1` + + dnl Now check everything's fine under there + dnl the include dir is our flag for having the JDK + if test -d "$kde_java_includedir"; then + if test ! -x "$kde_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.]) + fi + + jni_includes="-I$kde_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + + dnl not needed for gcj + + if test "x$kde_java_libgcjdir" = "x"; then + test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux" + test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris" + test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix" + fi + + else + JAVAC= + jni_includes= + fi + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) + fi + else + if test ! -r "$kde_java_libgcjdir/libgcj.so"; then + AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.]) + fi + fi + + if test ! -x "$kde_java_bindir/java"; then + AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + + dnl not needed for gcj compile + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) + fi + fi + + if test -n "$jni_includes"; then + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ + #include + ], + [ + #ifndef JNI_VERSION_1_2 + Syntax Error + #endif + ],[ kde_jni_works=yes ], + [ kde_jni_works=no ]) + + if test $kde_jni_works = no; then + AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + if test "x$kde_java_libgcjdir" = "x"; then + JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi" + else + JVMLIBS="-L$kde_java_libgcjdir -lgcj" + fi + AC_MSG_RESULT([java JDK in $kde_java_bindir]) + + else + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([java JRE in $kde_java_bindir]) + fi +elif test -d "/Library/Java/Home"; then + kde_java_bindir="/Library/Java/Home/bin" + jni_includes="-I/Library/Java/Home/include" + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + JVMLIBS="-Xlinker -framework -Xlinker JavaVM" + + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([Apple Java Framework]) +else + AC_MSG_RESULT([none found]) +fi + +AC_SUBST(JAVAC) +AC_SUBST(JAVAH) +AC_SUBST(JAR) +AC_SUBST(JVMLIBS) +AC_SUBST(jni_includes) + +# for backward compat +kde_cv_java_includedir=$kde_java_includedir +kde_cv_java_bindir=$kde_java_bindir +]) + +dnl this is a redefinition of autoconf 2.5x's AC_FOREACH. +dnl When the argument list becomes big, as in KDE for AC_OUTPUT in +dnl big packages, m4_foreach is dog-slow. So use our own version of +dnl it. (matz@kde.org) +m4_define([mm_foreach], +[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])]) +m4_define([mm_car], [[$1]]) +m4_define([mm_car2], [[$@]]) +m4_define([_mm_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1], + mm_car2(m4_shift($2)), + [$3])])]) +m4_define([AC_FOREACH], +[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + +AC_DEFUN([KDE_NEED_FLEX], +[ +kde_libs_safe=$LIBS +LIBS="$LIBS $USER_LDFLAGS" +AM_PROG_LEX +LIBS=$kde_libs_safe +if test -z "$LEXLIB"; then + AC_MSG_ERROR([You need to have flex installed.]) +fi +AC_SUBST(LEXLIB) +]) + +AC_DEFUN([AC_PATH_QTOPIA], +[ + dnl TODO: use AC_CACHE_VAL + + if test -z "$1"; then + qtopia_minver_maj=1 + qtopia_minver_min=5 + qtopia_minver_pat=0 + else + qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"` + qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"` + qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"` + fi + + qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat" + qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat" + + AC_REQUIRE([AC_PATH_QT]) + + AC_MSG_CHECKING([for Qtopia]) + + LIB_QTOPIA="-lqpe" + AC_SUBST(LIB_QTOPIA) + + kde_qtopia_dirs="$QPEDIR /opt/Qtopia" + + ac_qtopia_incdir=NO + + AC_ARG_WITH(qtopia-dir, + AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]), + [ ac_qtopia_incdir="$withval"/include] ) + + qtopia_incdirs="" + for dir in $kde_qtopia_dirs; do + qtopia_incdirs="$qtopia_incdirs $dir/include" + done + + if test ! "$ac_qtopia_incdir" = "NO"; then + qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs" + fi + + qtopia_incdir="" + AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir) + ac_qtopia_incdir="$qtopia_incdir" + + if test -z "$qtopia_incdir"; then + AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.]) + fi + + qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`; + qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`; + qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`; + + qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat" + qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat" + if test "$qtopia_ver" -lt "$qtopia_minver"; then + AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr +is required.]) + fi + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_cxxflags_safe="$CXXFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes" + LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" + LIBS="$LIBS $LIB_QTOPIA $LIBQT" + + cat > conftest.$ac_ext < +#include + +int main( int argc, char **argv ) +{ + QPEApplication app( argc, argv ); + return 0; +} +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* + else + rm -f conftest* + AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at +the end of config.log]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + QTOPIA_INCLUDES="-I$qtopia_incdir" + AC_SUBST(QTOPIA_INCLUDES) + + AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir]) +]) + + +AC_DEFUN([KDE_INIT_DOXYGEN], +[ +AC_MSG_CHECKING([for Qt docs]) +kde_qtdir= +if test "${with_qt_dir+set}" = set; then + kde_qtdir="$with_qt_dir" +fi + +AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) +AC_MSG_RESULT($QTDOCDIR) + +AC_SUBST(QTDOCDIR) + +KDE_FIND_PATH(dot, DOT, [], []) +if test -n "$DOT"; then + KDE_HAVE_DOT="YES" +else + KDE_HAVE_DOT="NO" +fi +AC_SUBST(KDE_HAVE_DOT) +KDE_FIND_PATH(doxygen, DOXYGEN, [], []) +AC_SUBST(DOXYGEN) + +DOXYGEN_PROJECT_NAME="$1" +DOXYGEN_PROJECT_NUMBER="$2" +AC_SUBST(DOXYGEN_PROJECT_NAME) +AC_SUBST(DOXYGEN_PROJECT_NUMBER) + +KDE_HAS_DOXYGEN=no +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then + KDE_HAS_DOXYGEN=yes +fi +AC_SUBST(KDE_HAS_DOXYGEN) + +]) + + +AC_DEFUN([AC_FIND_BZIP2], +[ +AC_MSG_CHECKING([for bzDecompress in libbz2]) +AC_CACHE_VAL(ac_cv_lib_bzip2, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET" +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#define BZ_NO_STDIO +#include +], + [ bz_stream s; (void) bzDecompress(&s); ], + eval "ac_cv_lib_bzip2='-lbz2'", + eval "ac_cv_lib_bzip2=no") +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +AC_MSG_RESULT($ac_cv_lib_bzip2) + +if test ! "$ac_cv_lib_bzip2" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2" + AC_SUBST(LIBBZ2) + +else + + cxx_shared_flag= + ld_shared_flag= + KDE_CHECK_COMPILER_FLAG(shared, [ + ld_shared_flag="-shared" + ]) + KDE_CHECK_COMPILER_FLAG(fPIC, [ + cxx_shared_flag="-fPIC" + ]) + + AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2]) + AC_CACHE_VAL(ac_cv_lib_bzip2_prefix, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET" + kde_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES" + + AC_TRY_LINK(dnl + [ + #define BZ_NO_STDIO + #include + ], + [ bz_stream s; (void) BZ2_bzDecompress(&s); ], + eval "ac_cv_lib_bzip2_prefix='-lbz2'", + eval "ac_cv_lib_bzip2_prefix=no") + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + AC_LANG_RESTORE + ])dnl + + AC_MSG_RESULT($ac_cv_lib_bzip2_prefix) + + if test ! "$ac_cv_lib_bzip2_prefix" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2_prefix" + AC_SUBST(LIBBZ2) + + AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix]) + dnl else, we just ignore this + fi + +fi +AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR") +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the SSL headers and libraries. +dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed) +dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([KDE_CHECK_SSL], +[ +LIBSSL="-lssl -lcrypto" +AC_REQUIRE([KDE_CHECK_LIB64]) + +ac_ssl_includes=NO ac_ssl_libraries=NO +ssl_libraries="" +ssl_includes="" +AC_ARG_WITH(ssl-dir, + AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]), + [ ac_ssl_includes="$withval"/include + ac_ssl_libraries="$withval"/lib$kdelibsuff + ]) + +want_ssl=yes +AC_ARG_WITH(ssl, + AC_HELP_STRING([--without-ssl],[disable SSL checks]), + [want_ssl=$withval]) + +if test $want_ssl = yes; then + +AC_MSG_CHECKING(for OpenSSL) + +AC_CACHE_VAL(ac_cv_have_ssl, +[#try to guess OpenSSL locations + + ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes" + ssl_incdirs="$ac_ssl_includes $ssl_incdirs" + AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir) + ac_ssl_includes="$ssl_incdir" + + ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs" + if test ! "$ac_ssl_libraries" = "NO"; then + ssl_libdirs="$ac_ssl_libraries $ssl_libdirs" + fi + + test=NONE + ssl_libdir=NONE + for dir in $ssl_libdirs; do + try="ls -1 $dir/libssl*" + if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done + + ac_ssl_libraries="$ssl_libdir" + + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries" + LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref" + + AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();, + ac_ssl_rsaref="yes" + , + ac_ssl_rsaref="no" + ) + + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then + have_ssl=no + else + have_ssl=yes; + fi + + ]) + + eval "$ac_cv_have_ssl" + + AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes]) + + AC_MSG_CHECKING([whether OpenSSL uses rsaref]) + AC_MSG_RESULT($ac_ssl_rsaref) + + AC_MSG_CHECKING([for easter eggs]) + AC_MSG_RESULT([none found]) + +else + have_ssl=no +fi + +if test "$have_ssl" = yes; then + AC_MSG_CHECKING(for OpenSSL version) + dnl Check for SSL version + AC_CACHE_VAL(ac_cv_ssl_version, + [ + + cat >conftest.$ac_ext < +#include + int main() { + +#ifndef OPENSSL_VERSION_NUMBER + printf("ssl_version=\\"error\\"\n"); +#else + if (OPENSSL_VERSION_NUMBER < 0x00906000) + printf("ssl_version=\\"old\\"\n"); + else + printf("ssl_version=\\"ok\\"\n"); +#endif + return (0); + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + if test "$ac_ssl_includes" != "/usr/include"; then + CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes" + fi + + if AC_TRY_EVAL(ac_link); then + + if eval `./conftest 2>&5`; then + if test $ssl_version = error; then + AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !]) + else + if test $ssl_version = old; then + AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.]) + have_ssl=no + fi + fi + ac_cv_ssl_version="ssl_version=$ssl_version" + else + AC_MSG_ERROR([Your system couldn't run a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure , attaching your config.log]) + fi + + else + AC_MSG_ERROR([Your system couldn't link a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure , attaching your config.log]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + ]) + + eval "$ac_cv_ssl_version" + AC_MSG_RESULT($ssl_version) +fi + +if test "$have_ssl" != yes; then + LIBSSL=""; +else + AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL]) + ac_cv_have_ssl="have_ssl=yes \ + ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref" + + + ssl_libraries="$ac_ssl_libraries" + ssl_includes="$ac_ssl_includes" + + if test "$ac_ssl_rsaref" = yes; then + LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" + fi + + if test $ssl_version = "old"; then + AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6]) + fi +fi + +SSL_INCLUDES= + +if test "$ssl_includes" = "/usr/include"; then + if test -f /usr/kerberos/include/krb5.h; then + SSL_INCLUDES="-I/usr/kerberos/include" + fi +elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then + SSL_INCLUDES="-I$ssl_includes" +fi + +if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then + SSL_LDFLAGS="" +else + SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries" +fi + +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_LDFLAGS) +AC_SUBST(LIBSSL) +]) + +AC_DEFUN([KDE_CHECK_STRLCPY], +[ + AC_REQUIRE([AC_CHECK_STRLCAT]) + AC_REQUIRE([AC_CHECK_STRLCPY]) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(unsigned long) + + AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long]) + AC_TRY_COMPILE(,[ + #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG + choke me + #endif + ],AC_MSG_RESULT([yes]),[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + Apparently on your system our assumption sizeof size_t == sizeof unsigned long + does not apply. Please mail kde-devel@kde.org with a description of your system! + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_BINUTILS], +[ + AC_MSG_CHECKING([if ld supports unversioned version maps]) + + kde_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo "{ local: extern \"C++\" { foo }; };" > conftest.map + AC_TRY_LINK([int foo;], +[ +#ifdef __INTEL_COMPILER +icc apparently does not support libtools version-info and version-script +at the same time. Dunno where the bug is, but until somebody figured out, +better disable the optional version scripts. +#endif + + foo = 42; +], kde_supports_versionmaps=yes, kde_supports_versionmaps=no) + LDFLAGS="$kde_save_LDFLAGS" + rm -f conftest.map + AM_CONDITIONAL(include_VERSION_SCRIPT, + [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"]) + + AC_MSG_RESULT($kde_supports_versionmaps) +]) + +AC_DEFUN([AM_PROG_OBJC],[ +AC_CHECK_PROGS(OBJC, gcc, gcc) +test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH]) +if test "x${OBJCFLAGS-unset}" = xunset; then + OBJCFLAGS="-g -O2" +fi +AC_SUBST(OBJCFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)]) +]) + +AC_DEFUN([KDE_CHECK_PERL], +[ + KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [ + AC_MSG_ERROR([No Perl found in your $PATH. +We need perl to generate some code.]) + ]) + AC_SUBST(PERL) +]) + +AC_DEFUN([KDE_CHECK_LARGEFILE], +[ +AC_SYS_LARGEFILE +if test "$ac_cv_sys_file_offset_bits" != no; then + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" +fi + +if test "x$ac_cv_sys_large_files" != "xno"; then + CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1" +fi + +]) + +dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in) +dnl which allows to search for libs that get installed into the KDE prefix. +dnl +dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not) +dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page +dnl also defines KSTUFF_PKG_ERRORS on error +AC_DEFUN([KDE_PKG_CHECK_MODULES], [ + + PKG_CONFIG_PATH="$prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH" + if test "$prefix" != "$kde_libs_prefix"; then + PKG_CONFIG_PATH="$kde_libs_prefix/lib${kdelibsuff}/pkgconfig:$PKG_CONFIG_PATH" + fi + export PKG_CONFIG_PATH + PKG_CHECK_MODULES([$1],[$2],[$3],[$4]) +]) + + +dnl Check for PIE support in the compiler and linker +AC_DEFUN([KDE_CHECK_PIE_SUPPORT], +[ + AC_CACHE_CHECK([for PIE support], kde_cv_val_pie_support, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + safe_CXXFLAGS=$CXXFLAGS + safe_LDFLAGS=$LDFLAGS + CXXFLAGS="$CXXFLAGS -fpie" + LDFLAGS="$LDFLAGS -pie" + + AC_TRY_LINK([int foo;], [], [kde_cv_val_pie_support=yes], [kde_cv_val_pie_support=no]) + + CXXFLAGS=$safe_CXXFLAGS + LDFLAGS=$safe_LDFLAGS + AC_LANG_RESTORE + ]) + + AC_MSG_CHECKING(if enabling -pie/fpie support) + + AC_ARG_ENABLE(pie, + AC_HELP_STRING([--enable-pie],[platform supports PIE linking [default=detect]]), + [kde_has_pie_support=$enableval], + [kde_has_pie_support=detect]) + + if test "$kde_has_pie_support" = "detect"; then + kde_has_pie_support=$kde_cv_val_pie_support + fi + + AC_MSG_RESULT([$kde_has_pie_support]) + + KDE_USE_FPIE="" + KDE_USE_PIE="" + + AC_SUBST([KDE_USE_FPIE]) + AC_SUBST([KDE_USE_PIE]) + + if test "$kde_has_pie_support" = "yes"; then + KDE_USE_FPIE="-fpie" + KDE_USE_PIE="-pie" + fi +]) +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LINUX_64_MODE="32" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + LINUX_64_MODE="64" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + libsuff= + if test "x$LINUX_64_MODE" = x64; then + # Some platforms are per default 64-bit, so there's no /lib64 + if test -d /lib64; then + libsuff=64 + fi + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips* | powerpc* | sparc* | s390* | sh* | x86_64* ) + lt_cv_deplibs_check_method=pass_all ;; + # the debian people say, arm and glibc 2.3.1 works for them with pass_all + arm* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $compiler_flags $predep_objects $libobjs $deplibs $postdep_objects~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $compiler_flags $libobjs $deplibs -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $compiler_flags $libobjs $deplibs ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=no + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $compiler_flags $libobjs `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-flat_namespace -Wl,-undefined -Wl,suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-Wl,-undefined -Wl,dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $compiler_flags $libobjs $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $compiler_flags $deplibs -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $compiler_flags $libobjs $deplibs~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $compiler_flags $libobjs $deplibs~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $compiler_flags $libobjs $deplibs' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $compiler_flags $libobjs $deplibs$output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $compiler_flags $libobjs $deplibs ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $compiler_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $compiler_flags $libobjs $deplibs' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..dd92cb3 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,863 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file 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. + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +# serial 12 + +# 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. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])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 + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file 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. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $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]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file 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. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..055c089 --- /dev/null +++ b/config.h.in @@ -0,0 +1,244 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_CARBON_CARBON_H + +/* Define if you have the CoreAudio API */ +#undef HAVE_COREAUDIO + +/* Define to 1 if you have the header file. */ +#undef HAVE_CRT_EXTERNS_H + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have a working libpthread (will enable threaded code) */ +#undef HAVE_LIBPTHREAD + +/* Define if you have libz */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + +/* Define if you have res_init */ +#undef HAVE_RES_INIT + +/* Define if you have the res_init prototype */ +#undef HAVE_RES_INIT_PROTO + +/* Define if you have a STL implementation by SGI */ +#undef HAVE_SGI_STL + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have strlcat */ +#undef HAVE_STRLCAT + +/* Define if you have the strlcat prototype */ +#undef HAVE_STRLCAT_PROTO + +/* Define if you have strlcpy */ +#undef HAVE_STRLCPY + +/* Define if you have the strlcpy prototype */ +#undef HAVE_STRLCPY_PROTO + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Suffix for lib directories */ +#undef KDELIBSUFF + +/* Define a safe value for MAXPATHLEN */ +#undef KDEMAXPATHLEN + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Defined if compiling without arts */ +#undef WITHOUT_ARTS + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif + + + +/* + * AIX defines FD_SET in terms of bzero, but fails to include + * that defines bzero. + */ + +#if defined(_AIX) +#include +#endif + + + +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include +# include +# define environ (*_NSGetEnviron()) +#endif + + + +#if !defined(HAVE_RES_INIT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +int res_init(void); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include +#include +#else +#include +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif + + + +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif + + +/* type to use in place of socklen_t if not defined */ +#undef kde_socklen_t + +/* type to use in place of socklen_t if not defined (deprecated, use + kde_socklen_t) */ +#undef ksize_t diff --git a/configure.files b/configure.files new file mode 100644 index 0000000..030bce8 --- /dev/null +++ b/configure.files @@ -0,0 +1,2 @@ +./admin/configure.in.min +configure.in.in diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..56e858d --- /dev/null +++ b/configure.in @@ -0,0 +1,122 @@ +dnl ======================================================= +dnl FILE: ./admin/configure.in.min +dnl ======================================================= + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +dnl Boston, MA 02110-1301, USA. + +# Original Author was Kalle@kde.org +# I lifted it in some mater. (Stephan Kulow) +# I used much code from Janos Farkas + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(acinclude.m4) dnl a source file from your sub dir + +dnl This is so we can use kde-common +AC_CONFIG_AUX_DIR(admin) + +dnl This ksh/zsh feature conflicts with `cd blah ; pwd` +unset CDPATH + +dnl Checking host/target/build systems, for make, install etc. +AC_CANONICAL_SYSTEM +dnl Perform program name transformation +AC_ARG_PROGRAM + +dnl Automake doc recommends to do this only here. (Janos) +AM_INIT_AUTOMAKE(kbarcode, 2.0.6) dnl searches for some needed programs + +KDE_SET_PREFIX + +dnl generate the config header +AM_CONFIG_HEADER(config.h) dnl at the distribution this done + +dnl Checks for programs. +AC_CHECK_COMPILERS +AC_ENABLE_SHARED(yes) +AC_ENABLE_STATIC(no) +KDE_PROG_LIBTOOL + +dnl for NLS support. Call them in this order! +dnl WITH_NLS is for the po files +AM_KDE_WITH_NLS + +KDE_USE_QT(3.0.0) +AC_PATH_KDE +dnl ======================================================= +dnl FILE: configure.in.in +dnl ======================================================= + +#MIN_CONFIG(3.0.0) + +dnl PACKAGE set before +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +KDE_CREATE_SUBDIRSLIST +AC_CONFIG_FILES([ Makefile ]) +AC_CONFIG_FILES([ fileplugin/Makefile ]) +AC_CONFIG_FILES([ kbarcode/Makefile ]) +AC_CONFIG_FILES([ po/Makefile ]) +AC_OUTPUT +# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure +if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then + # And if so, warn when they don't match + if test "$kde_libs_prefix" != "$given_prefix"; then + # And if kde doesn't know about the prefix yet + echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null + if test $? -ne 0; then + echo "" + echo "Warning: you chose to install this package in $given_prefix," + echo "but KDE was found in $kde_libs_prefix." + echo "For this to work, you will need to tell KDE about the new prefix, by ensuring" + echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix" + echo "Then restart KDE." + echo "" + fi + fi +fi + +if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then + echo "" + echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility" + echo "was not included. Therefore, GCC symbol visibility support remains disabled." + echo "" + echo "For better performance, consider including the Qt visibility supporting patch" + echo "located at:" + echo "" + echo "http://bugs.kde.org/show_bug.cgi?id=109386" + echo "" + echo "and recompile all of Qt and KDE. Note, this is entirely optional and" + echo "everything will continue to work just fine without it." + echo "" +fi + +if test "$all_tests" = "bad"; then + if test ! "$cache_file" = "/dev/null"; then + echo "" + echo "Please remove the file $cache_file after changing your setup" + echo "so that configure will find the changes next time." + echo "" + fi +else + echo "" + echo "Good - your configure finished. Start make now" + echo "" +fi diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 0000000..c03082c --- /dev/null +++ b/configure.in.in @@ -0,0 +1,6 @@ +#MIN_CONFIG(3.0.0) + +AM_INIT_AUTOMAKE(kbarcode, 2.0.6) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + diff --git a/fileplugin/Makefile.am b/fileplugin/Makefile.am new file mode 100644 index 0000000..83e54db --- /dev/null +++ b/fileplugin/Makefile.am @@ -0,0 +1,18 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kfile_kbarcode.la + +kfile_kbarcode_la_SOURCES = kfile_kbarcode.cpp +kfile_kbarcode_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +kfile_kbarcode_la_LIBADD = $(LIB_KSYCOCA) $(LIB_KDECORE) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +# messages: rc.cpp +# $(XGETTEXT) *.cpp -o $(podir)/kfile_kbarcode.pot + +services_DATA = kfile_kbarcode.desktop +servicesdir = $(kde_servicesdir) + diff --git a/fileplugin/kfile_kbarcode.cpp b/fileplugin/kfile_kbarcode.cpp new file mode 100644 index 0000000..bd2c1c8 --- /dev/null +++ b/fileplugin/kfile_kbarcode.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2003 Dominik Seichter + */ + +#include "kfile_kbarcode.h" + +#include +#include + +#include +#include + +K_EXPORT_COMPONENT_FACTORY(kfile_kbarcode, KGenericFactory( "kfile_kbarcode" )); + +KBarcodePlugin::KBarcodePlugin(QObject *parent, const char *name, + const QStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "application/kbarcode-label" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Label", i18n("Label")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Manufacturer", i18n("Manufacturer"), QVariant::String ); + item = addItemInfo(group, "Type", i18n("Type"), QVariant::String); + item = addItemInfo(group, "Description", i18n("Description"), QVariant::String ); + item = addItemInfo(group, "Id", i18n("Label Id"), QVariant::String ); + item = addItemInfo(group, "Dimensions", i18n("Dimensions"), QVariant::Size); + setHint( item, KFileMimeTypeInfo::Size ); + setUnit(item, KFileMimeTypeInfo::Centimeters ); +} + + +bool KBarcodePlugin::readInfo( KFileMetaInfo& info, uint ) +{ + QFile f( info.path() ); + if ( !f.open( IO_ReadOnly ) ) + return false; + + QDomDocument doc( "KBarcodeLabel" ); + if ( !doc.setContent( &f ) ) { + f.close(); + return false; + } + + KFileMetaInfoGroup group = appendGroup(info, "Label"); + + QDomNode n = doc.documentElement().firstChild(); + while( !n.isNull() ) { + QDomElement e = n.toElement(); // try to convert the node to an element. + if( !e.isNull() ) + if( e.tagName() == "label" ) { + QDomNode node = e.firstChild(); + while( !node.isNull() ) { + QDomElement e = node.toElement(); // try to convert the node to an element. + if( !e.isNull() ) + if( e.tagName() == "description" ) + appendItem(group, "Description", e.text() ); + else if( e.tagName() == "id" ) { + appendItem(group, "Manufacturer", e.attribute("producer", "") ); + appendItem(group, "Type", e.attribute("type", "") ); + appendItem(group, "Id", e.text() ); + appendItem(group, "Dimensions", + QSize( int(e.attribute("width", "0").toDouble()/10), int(e.attribute("height", "0").toDouble()/10) ) ); + } + + node = node.nextSibling(); + } + n = n.nextSibling(); + } + + n = n.nextSibling(); + } + + + f.close(); + return true; +} + +#include "kfile_kbarcode.moc" diff --git a/fileplugin/kfile_kbarcode.desktop b/fileplugin/kfile_kbarcode.desktop new file mode 100644 index 0000000..e9a9d33 --- /dev/null +++ b/fileplugin/kfile_kbarcode.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Service +Name=KBarcode Info +Comment=KBarcode Info +Icon=kbarcode +ServiceTypes=KFilePlugin +MimeType=application/kbarcode-label +X-KDE-Library=kfile_kbarcode +SupportsThumbnail= diff --git a/fileplugin/kfile_kbarcode.h b/fileplugin/kfile_kbarcode.h new file mode 100644 index 0000000..fd71ada --- /dev/null +++ b/fileplugin/kfile_kbarcode.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2003 Dominik Seichter + */ + +#ifndef _PLUGIN_KBARCODEFILEPLUGIN_H_ +#define _PLUGIN_KBARCODEFILEPLUGIN_H_ + +#include + +class QStringList; + +class KBarcodePlugin: public KFilePlugin +{ + Q_OBJECT + +public: + KBarcodePlugin( QObject *parent, const char *name, const QStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint ); +}; + + +#endif // _PLUGIN_KBARCODEFILEPLUGIN_H_ diff --git a/kbarcode.kdevelop b/kbarcode.kdevelop new file mode 100644 index 0000000..2356a72 --- /dev/null +++ b/kbarcode.kdevelop @@ -0,0 +1,193 @@ + + + + Dominik Seichter + domseichter@web.de + 1.9.1 + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + DCOP + + . + false + + + + SQL + + + + + kbarcode/kbarcode + default + + + kbarcode/kbarcode + executable + + + + / + + false + true + + + + + optimized + GccOptions + GppOptions + G77Options + -O2 -g0 + + + --enable-debug=full + debug + GccOptions + GppOptions + G77Options + -O0 -g3 + + + + + + + + + + + true + 1 + false + + 0 + + + + + + + + + + false + false + + + *.o,*.lo,CVS + false + false + + + + + gtk + gnustep + python + php + perl + + + html/ + html/ + + + + + + + + + libtool + + + + + + true + false + false + + + true + true + 10 + + + + + + + + + + + + + KDElibs + + + true + true + true + false + true + true + true + 250 + 400 + 250 + + + + + .h + .cpp + + + + false + false + + kbarcode + 1.8.0 + + + GPL + + + + + + false + false + false + 0 + false + false + false + false + + + + true + true + true + true + -C + + + + + + + + + diff --git a/kbarcode.spec b/kbarcode.spec new file mode 100644 index 0000000..9d031b3 --- /dev/null +++ b/kbarcode.spec @@ -0,0 +1,50 @@ +%define name kbarcode +%define version 2.0.6 +Summary: A barcode and label printing application for KDE +Name: %{name} +Version: %{version} +Release: 1 +License: GPL +Vendor: Dominik Seichter +Url: http://www.kbarcode.net +Packager: Dominik Seichter +Group: kde/utilities +Source: %{name}-%{version}.tar.gz +BuildRoot: /var/tmp/%{name}-%{version} + +%description +KBarcode is a barcode and label printing application for Linux and KDE 3. It can be used to print every thing from simple business cards up to complex labels with several barcodes (e.g. article descriptions). KBarcode comes with an easy to use WYSIWYG label designer, a setup wizard, batch import of labels (directly from the delivery note), thousands of predefined labels, database managment tools and translations in many languages. Even printing more than 10.000 labels in one go is no problem for KBarcode. Additionally it is a simply xbarcode replacement for the creation of barcodes. All major types of barcodes like EAN, UPC, CODE39 and ISBN are supported. + +%prep +%setup +./configure + +%build + +# Setup for parallel builds +numprocs=`egrep -c ^cpu[0-9]+ /proc/stat || :` +if [ "$numprocs" = "0" ]; then + numprocs=1 +fi + +make -j$numprocs + +%install +make install DESTDIR=$RPM_BUILD_ROOT + +cd $RPM_BUILD_ROOT +find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > $RPM_BUILD_DIR/file.list.kbarcode +find . -type f | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/file.list.kbarcode +find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> $RPM_BUILD_DIR/file.list.kbarcode + +%clean +rm -rf $RPM_BUILD_ROOT/* +rm -rf $RPM_BUILD_DIR/kbarcode-%{version} +rm -rf ../file.list.kbarcode + + +%files -f ../file.list.kbarcode + + + + diff --git a/kbarcode/Makefile.am b/kbarcode/Makefile.am new file mode 100644 index 0000000..665c3f2 --- /dev/null +++ b/kbarcode/Makefile.am @@ -0,0 +1,58 @@ +## Makefile.am for kbarcode + +# set the include path for X, qt and KDE +INCLUDES = -I$(top_srcdir)/src $(all_includes) + +# these are the headers for your project + + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO +KDE_ICON = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kdedcoptest.pot + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = kbarcode + +# the application source, library search path, and link libraries + +kbarcode_LDFLAGS = $(KDE_RPATH) $(all_libraries) +kbarcode_LDADD = $(LIB_KABC) $(LIB_KSPELL) $(LIB_KDEPRINT) \ + $(LIB_KDEUI) -lkjs -lpcre + +noinst_HEADERS = barcodecombo.h barcodedialog.h barcodedialogs.h \ + commands.h configdialog.h confwizard.h csvimportdlg.h databasebrowser.h \ + definition.h definitiondialog.h dsmainwindow.h dsrichtext.h kbarcode.h label.h \ + labeleditor.h labelutils.h mimesources.h multilineeditdlg.h \ + mycanvasitem.h mycanvasview.h mydatatable.h newlabel.h previewdialog.h \ + printersettings.h printlabeldlg.h rectsettingsdlg.h smalldialogs.h sqltables.h \ + tokenprovider.h xmlutils.h zplutils.h measurements.h editoriface.h kbarcodeiface.h \ + batchiface.h kbarcodesettings.h batchprinter.h barcodeitem.h documentitem.h \ + lineitem.h rectitem.h tcanvasitem.h textitem.h imageitem.h documentitemdlg.h \ + propertywidget.h tec.h barcodeprinterdlg.h textlineitem.h textlineedit.h tokendialog.h \ + barkode.h gnubarcode.h barkodeengine.h pixmapbarcode.h batchwizard.h csvfile.h \ + referencecounted.h dstextedit.h encodingcombo.h purepostscript.h tbarcode2.h \ + kactionmap.h + +kbarcode_SOURCES = barcodecombo.cpp barcodedialog.cpp \ + barcodedialogs.cpp commands.cpp configdialog.cpp confwizard.cpp csvimportdlg.cpp \ + databasebrowser.cpp definition.cpp definitiondialog.cpp dsmainwindow.cpp dsrichtext.cpp \ + kbarcode.cpp label.cpp labeleditor.cpp labelutils.cpp main.cpp \ + mimesources.cpp multilineeditdlg.cpp mycanvasitem.cpp mycanvasview.cpp mydatatable.cpp \ + newlabel.cpp previewdialog.cpp printersettings.cpp printlabeldlg.cpp \ + rectsettingsdlg.cpp smalldialogs.cpp sqltables.cpp tokenprovider.cpp xmlutils.cpp \ + zplutils.cpp measurements.cpp editoriface.skel kbarcodeiface.skel batchiface.skel \ + kbarcodesettings.cpp batchprinter.cpp barcodeitem.cpp documentitem.cpp lineitem.cpp \ + rectitem.cpp tcanvasitem.cpp textitem.cpp imageitem.cpp documentitemdlg.cpp \ + propertywidget.cpp tec.cpp barcodeprinterdlg.cpp textlineitem.cpp textlineedit.cpp \ + tokendialog.cpp barkode.cpp gnubarcode.cpp barkodeengine.cpp pixmapbarcode.cpp batchwizard.cpp \ + csvfile.cpp referencecounted.cpp dstextedit.cpp encodingcombo.cpp purepostscript.cpp tbarcode2.cpp \ + kactionmap.cpp + +xdg_apps_DATA = kbarcode.desktop kbarcode-batch.desktop kbarcode-editor.desktop kbarcode-label.desktop kbarcode-single.desktop + +datafiles_DATA = logo.png barcodes.html exampledata.sql labeldefinitions.sql barcode.ps rules.xml +datafilesdir = $(kde_datadir)/kbarcode diff --git a/kbarcode/barcode.ps b/kbarcode/barcode.ps new file mode 100644 index 0000000..686a31a --- /dev/null +++ b/kbarcode/barcode.ps @@ -0,0 +1,3563 @@ +%!PS-Adobe-2.0 +%%Creator: Terry Burton +%%DocumentPaperSizes: a4 +%%EndComments +%%EndProlog + +% Barcode Writer in Pure PostScript - Version 2006-09-26 +% http://www.terryburton.co.uk/barcodewriter/ +% +% Copyright (c) 2006 Terry Burton - tez@terryburton.co.uk +% +% Permission is hereby granted, free of charge, to any +% person obtaining a copy of this software and associated +% documentation files (the "Software"), to deal in the +% Software without restriction, including without +% limitation the rights to use, copy, modify, merge, +% publish, distribute, sublicense, and/or sell copies of +% the Software, and to permit persons to whom the Software +% is furnished to do so, subject to the following +% conditions: +% +% The above copyright notice and this permission notice +% shall be included in all copies or substantial portions +% of the Software. +% +% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +% KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +% THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +% PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +% THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +% DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +% CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +% IN THE SOFTWARE. + +% Uncomment this next line to allow these procedure definitions to +% remain resident within a printer's PostScript virtual machine +% so that the barcode generation capability persists between jobs. + +% serverdict begin 0 exitserver + +% --BEGIN TEMPLATE-- + +% --BEGIN ENCODER ean13-- +% --DESC: EAN-13 +% --EXAM: 977147396801 +/ean13 { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Helvetica def + /textsize 12 def + /textpos -4 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + /barlen barcode length def % Length of the code + + % Add checksum digit to barcode if length is even + barlen 2 mod 0 eq { + /pad barlen 1 add string def % Create pad one bigger than barcode + /checksum 0 def + 0 1 barlen 1 sub { + /i exch def + /barchar barcode i get 48 sub def + i 2 mod 0 eq { + /checksum barchar checksum add def + } { + /checksum barchar 3 mul checksum add def + } ifelse + } for + /checksum 10 checksum 10 mod sub 10 mod def + pad 0 barcode putinterval % Add barcode to the start of the pad + pad barlen checksum 48 add put % Put ascii for checksum at end of pad + /barcode pad def % barcode=pad + /barlen barlen 1 add def % barlen++ + } if + + % Create an array containing the character mappings + /encs + [ (3211) (2221) (2122) (1411) (1132) + (1231) (1114) (1312) (1213) (3112) + (111) (11111) (111) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + % Digits to mirror on left side + /mirrormaps + [ (000000) (001011) (001101) (001110) (010011) + (011001) (011100) (010101) (010110) (011010) + ] def + + /sbs barlen 1 sub 4 mul 11 add string def + /txt barlen array def + + % Put the start character + sbs 0 encs 10 get putinterval + + % First digit - determine mirrormap by this and show before guard bars + /mirrormap mirrormaps barcode 0 get 48 sub get def + txt 0 [barcode 0 1 getinterval -10 textpos textfont textsize] put + + % Left side - performs mirroring + 1 1 6 { + % Lookup the encoding for the each barcode character + /i exch def + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + mirrormap i 1 sub get 49 eq { % Reverse enc if 1 in this position in mirrormap + /enclen enc length def + /revenc enclen string def + 0 1 enclen 1 sub { + /j exch def + /char enc j get def + revenc enclen j sub 1 sub char put + } for + /enc revenc def + } if + sbs i 1 sub 4 mul 3 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textpos textfont textsize] put + } for + + % Put the middle character + sbs 7 1 sub 4 mul 3 add encs 11 get putinterval + + % Right side + 7 1 12 { + % Lookup the encoding for the each barcode character + /i exch def + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 1 sub 4 mul 8 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 1 sub 7 mul 8 add textpos textfont textsize] put + } for + + % Put the end character + sbs barlen 1 sub 4 mul 8 add encs 12 get putinterval + + % Return the arguments + /retval 4 dict def + retval (sbs) [sbs {48 sub} forall] put + includetext { + retval (bhs) [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] put + retval (bbs) [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] put + retval (txt) txt put + } { + retval (bhs) [30{height}repeat] put + retval (bbs) [30{0}repeat] put + } ifelse + retval (opt) useropts put + retval (guardrightpos) 10 put + retval (borderbottom) 5 put + retval + + end + +} bind def +/ean13 load 0 1 dict put +% --END ENCODER ean13-- + +% --BEGIN ENCODER ean8-- +% --DESC: EAN-8 +% --EXAM: 01335583 +/ean8 { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Helvetica def + /textsize 12 def + /textpos -4 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (3211) (2221) (2122) (1411) (1132) + (1231) (1114) (1312) (1213) (3112) + (111) (11111) (111) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + /barlen barcode length def % Length of the code + /sbs barlen 4 mul 11 add string def + /txt barlen array def + + % Put the start character + sbs 0 encs 10 get putinterval + + % Left side + 0 1 3 { + % Lookup the encoding for the each barcode character + /i exch def + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 4 mul 3 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 7 mul 4 add textpos textfont textsize] put + } for + + % Put the middle character + sbs 4 4 mul 3 add encs 11 get putinterval + + % Right side + 4 1 7 { + % Lookup the encoding for the each barcode character + /i exch def + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 4 mul 8 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 7 mul 8 add textpos textfont textsize] put + } for + + % Put the end character + sbs barlen 4 mul 8 add encs 12 get putinterval + + % Return the arguments + /retval 4 dict def + retval (sbs) [sbs {48 sub} forall] put + includetext { + retval (bhs) [height height 8{height .075 sub}repeat height height 8{height .075 sub}repeat height height] put + retval (bbs) [0 0 8{.075}repeat 0 0 8{.075}repeat 0 0] put + retval (txt) txt put + } { + retval (bhs) [22{height}repeat] put + retval (bbs) [22{0}repeat] put + } ifelse + retval (opt) useropts put + retval (guardleftpos) 10 put + retval (guardrightpos) 10 put + retval (borderbottom) 5 put + retval + + end + +} bind def +/ean8 load 0 1 dict put +% --END ENCODER ean8-- + +% --BEGIN ENCODER upca-- +% --DESC: UPC-A +% --EXAM: 78858101497 +/upca { + + 0 begin + + /options exch def + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Helvetica def + /textsize 12 def + /textpos -4 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + /barlen barcode length def % Length of the code + + % Add checksum digit to barcode if length is odd + barlen 2 mod 0 ne { + /pad barlen 1 add string def % Create pad one bigger than barcode + /checksum 0 def + 0 1 barlen 1 sub { + /i exch def + /barchar barcode i get 48 sub def + i 2 mod 0 ne { + /checksum checksum barchar add def + } { + /checksum checksum barchar 3 mul add def + } ifelse + } for + /checksum 10 checksum 10 mod sub 10 mod def + pad 0 barcode putinterval % Add barcode to the start of the pad + pad barlen checksum 48 add put % Put ascii for checksum at end of pad + /barcode pad def % barcode=pad + /barlen barlen 1 add def % barlen++ + } if + + % Create an array containing the character mappings + /encs + [ (3211) (2221) (2122) (1411) (1132) + (1231) (1114) (1312) (1213) (3112) + (111) (11111) (111) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + /sbs barlen 4 mul 11 add string def + /txt barlen array def + + % Put the start character + sbs 0 encs 10 get putinterval + + % Left side + 0 1 5 { + % Lookup the encoding for the each barcode character + /i exch def + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 4 mul 3 add enc putinterval % Put encoded digit into sbs + i 0 eq { % First digit is before the guard bars + txt 0 [barcode 0 1 getinterval -7 textpos textfont textsize 2 sub] put + } { + txt i [barcode i 1 getinterval i 7 mul 4 add textpos textfont textsize] put + } ifelse + } for + + % Put the middle character + sbs 6 4 mul 3 add encs 11 get putinterval + + % Right side + 6 1 11 { + % Lookup the encoding for the each barcode character + /i exch def + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 4 mul 8 add enc putinterval % Put encoded digit into sbs + i 11 eq { % Last digit is after guard bars + txt 11 [barcode 11 1 getinterval 96 textpos textfont textsize 2 sub] put + } { + txt i [barcode i 1 getinterval i 7 mul 8 add textpos textfont textsize] put + } ifelse + } for + + % Put the end character + sbs barlen 4 mul 8 add encs 12 get putinterval + + % Return the arguments + /retval 4 dict def + retval (sbs) [sbs {48 sub} forall] put + includetext { + retval (bhs) [4{height}repeat 10{height .075 sub}repeat height height 10{height .075 sub}repeat 5{height}repeat] put + retval (bbs) [0 0 0 0 10{.075}repeat 0 0 10{.075}repeat 0 0 0 0 0] put + retval (txt) txt put + } { + retval (bhs) [31{height}repeat] put + retval (bbs) [31{0}repeat] put + } ifelse + retval (opt) useropts put + retval (borderbottom) 5 put + retval + + end + +} bind def +/upca load 0 1 dict put +% --END ENCODER upca-- + +% --BEGIN ENCODER upce-- +% --DESC: UPC-E +% --EXAM: 0123456 +/upce { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Helvetica def + /textsize 12 def + /textpos -4 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + /barlen barcode length def % Length of the code + + % Create an array containing the character mappings + /encs + [ (3211) (2221) (2122) (1411) (1132) + (1231) (1114) (1312) (1213) (3112) + (111) (1111111) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + /mirrormaps + [ (000111) (001011) (001101) (001110) (010011) + (011001) (011100) (010101) (010110) (011010) + ] def + + % Add checksum digit to barcode if length is odd + barlen 2 mod 0 ne { + /pad barlen 1 add string def % Create pad one bigger than barcode + /checksum 0 def + 0 1 barlen 1 sub { + /i exch def + /barchar barcode i get 48 sub def + i 2 mod 0 ne { + /checksum barchar checksum add def + } { + /checksum barchar 3 mul checksum add def + } ifelse + } for + /checksum 10 checksum 10 mod sub 10 mod def + pad 0 barcode putinterval % Add barcode to the start of the pad + pad barlen checksum 48 add put % Put ascii for checksum at end of pad + /barcode pad def % barcode=pad + /barlen barlen 1 add def % barlen++ + } if + /txt barlen array def + txt 0 [barcode 0 1 getinterval -7 textpos textfont textsize 2 sub] put + + % Determine the mirror map based on checksum + /mirrormap mirrormaps barcode barlen 1 sub get 48 sub get def + + % Invert the mirrormap if we are using a non-zero number system + barcode 0 get 48 eq { + /invt mirrormap length string def + 0 1 mirrormap length 1 sub { + /i exch def + mirrormap i get 48 eq { + invt i 49 put + } { + invt i 48 put + } ifelse + } for + /mirrormap invt def + } if + + /sbs barlen 2 sub 4 mul 10 add string def + + % Put the start character + sbs 0 encs 10 get putinterval + + 1 1 6 { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + mirrormap i 1 sub get 49 eq { % Reverse enc if 1 in this position in mirrormap + /enclen enc length def + /revenc enclen string def + 0 1 enclen 1 sub { + /j exch def + /char enc j get def + revenc enclen j sub 1 sub char put + } for + /enc revenc def + } if + sbs i 1 sub 4 mul 3 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textpos textfont textsize] put + } for + + txt 7 [barcode 7 1 getinterval 6 7 mul 11 add textpos textfont textsize 2 sub] put + + % Put the end character + sbs barlen 2 sub 4 mul 3 add encs 11 get putinterval + + % Return the arguments + /retval 4 dict def + retval (sbs) [sbs {48 sub} forall] put + includetext { + retval (bhs) [height height 12{height .075 sub}repeat height height height] put + retval (bbs) [0 0 12{.075}repeat 0 0 0] put + retval (txt) txt put + } { + retval (bhs) [17{height}repeat] put + retval (bbs) [17{0}repeat] put + } ifelse + retval (opt) useropts put + retval (borderbottom) 5 put + retval + + end + +} bind def +/upce load 0 1 dict put +% --END ENCODER upce-- + +% --BEGIN ENCODER ean5-- +% --DESC: EAN-5 (5 digit addon) +% --EXAM: 0123456 +/ean5 { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Helvetica def + /textsize 12 def + /textpos (unset) def + /height 0.7 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /height height cvr def + textpos (unset) eq { + /textpos height 72 mul 1 add def + } { + /textpos textpos cvr def + } ifelse + + /barlen barcode length def % Length of the code + + % Create an array containing the character mappings + /encs + [ (3211) (2221) (2122) (1411) (1132) + (1231) (1114) (1312) (1213) (3112) + (112) (11) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + % Determine the mirror map based on mod 10 checksum + /mirrormaps + [ (11000) (10100) (10010) (10001) (01100) + (00110) (00011) (01010) (01001) (00101) + ] def + /checksum 0 def + 0 1 4 { + /i exch def + /barchar barcode i get 48 sub def + i 2 mod 0 eq { + /checksum barchar 3 mul checksum add def + } { + /checksum barchar 9 mul checksum add def + } ifelse + } for + /checksum checksum 10 mod def + /mirrormap mirrormaps checksum get def + + /sbs 31 string def + /txt 5 array def + + 0 1 4 { + /i exch def + + % Prefix with either a start character or separator character + i 0 eq { + sbs 0 encs 10 get putinterval + } { + sbs i 1 sub 6 mul 7 add encs 11 get putinterval + } ifelse + + % Lookup the encoding for the barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + mirrormap i get 49 eq { % Reverse enc if 1 in this position in mirrormap + /enclen enc length def + /revenc enclen string def + 0 1 enclen 1 sub { + /j exch def + /char enc j get def + revenc enclen j sub 1 sub char put + } for + /enc revenc def + } if + sbs i 6 mul 3 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 1 sub 9 mul 13 add textpos textfont textsize] put + } for + + % Return the arguments + /retval 4 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [16{height}repeat] put + retval (bbs) [16{0}repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval (guardrightpos) 10 put + retval (guardrightypos) textpos 4 add put + retval (bordertop) 10 put + retval + + end + +} bind def +/ean5 load 0 1 dict put +% --END ENCODER ean5-- + +% --BEGIN ENCODER ean2-- +% --DESC: EAN-2 (2 digit addon) +% --EXAM: 05 +/ean2 { + + 0 begin + + /options exch def % We are given an options string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Helvetica def + /textsize 12 def + /textpos (unset) def + /height 0.7 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /height height cvr def + textpos (unset) eq { + /textpos height 72 mul 1 add def + } { + /textpos textpos cvr def + } ifelse + + /barlen barcode length def % Length of the code + + % Create an array containing the character mappings + /encs + [ (3211) (2221) (2122) (1411) (1132) + (1231) (1114) (1312) (1213) (3112) + (112) (11) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + % Determine the mirror map based on mod 4 checksum + /mirrormap [(00) (01) (10) (11)] barcode 0 2 getinterval cvi 4 mod get def + + /sbs 13 string def + /txt 2 array def + + 0 1 1 { + /i exch def + + % Prefix with either a start character or separator character + i 0 eq { + sbs 0 encs 10 get putinterval + } { + sbs i 1 sub 6 mul 7 add encs 11 get putinterval + } ifelse + + % Lookup the encoding for the barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + mirrormap i get 49 eq { % Reverse enc if 1 in this position in mirrormap + /enclen enc length def + /revenc enclen string def + 0 1 enclen 1 sub { + /j exch def + /char enc j get def + revenc enclen j sub 1 sub char put + } for + /enc revenc def + } if + sbs i 6 mul 3 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 1 sub 9 mul 13 add textpos textfont textsize] put + } for + + % Return the arguments + /retval 4 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [12{height}repeat] put + retval (bbs) [12{0}repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval (guardrightpos) 10 put + retval (guardrightypos) textpos 4 add put + retval (bordertop) 10 put + retval + + end + +} bind def +/ean2 load 0 1 dict put +% --END ENCODER ean2-- + +% --BEGIN ENCODER isbn-- +% --REQUIRES ean13-- +% --DESC: ISBN +% --EXAM: 1-86074-271 +/isbn { + + 0 begin + + /options exch def % We are given an options string + /useropts options def + /isbntxt exch def % We are given the isbn text with dashes + + /includetext false def % Enable/disable ISBN text + /isbnfont /Courier def + /isbnsize 9 def + /isbnpos (unset) def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /isbnfont isbnfont cvlit def + /isbnsize isbnsize cvr def + /height height cvr def + isbnpos (unset) eq { + /isbnpos height 72 mul 3 add def + } { + /isbnpos isbnpos cvr def + } ifelse + + % Read the digits from isbntxt and calculate checksums + /isbn 13 string def + /checksum10 0 def + /checksum13 0 def + /i 0 def /n 0 def + { % loop + /isbnchar isbntxt i get 48 sub def + isbnchar -3 ne { % Ignore dashes + isbn n isbnchar 48 add put + /checksum10 checksum10 10 n sub isbnchar mul add def + n 2 mod 0 eq { + /checksum13 isbnchar checksum13 add def + } { + /checksum13 isbnchar 3 mul checksum13 add def + } ifelse + /n n 1 add def + } if + /i i 1 add def + i isbntxt length eq {exit} if + } loop + + % Add the ISBN header to the isbntxt + n 9 eq n 10 eq or { + /checksum 11 checksum10 11 mod sub 11 mod def + /isbn isbn 0 9 getinterval def + /pad 18 string def + } { + /checksum 10 checksum13 10 mod sub 10 mod def + /isbn isbn 0 12 getinterval def + /pad 22 string def + } ifelse + pad 0 (ISBN ) putinterval + pad 5 isbntxt putinterval % Add isbntxt to the pad + + % Add checksum digit if isbntxt length is 11 or 15 + isbntxt length 11 eq isbntxt length 15 eq or { + pad isbntxt length 5 add 45 put % Put a dash + checksum 10 eq { + pad isbntxt length 6 add checksum 78 add put % Check digit for 10 is X + } { + pad isbntxt length 6 add checksum 48 add put % Put check digit + } ifelse + } if + /isbntxt pad def % isbntxt=pad + + % Convert ISBN digits to EAN-13 + /barcode 12 string def + isbn length 9 eq { + barcode 0 (978) putinterval + barcode 3 isbn putinterval + } { + barcode 0 isbn putinterval + } ifelse + + % Get the result of encoding with ean13 + /args barcode options ean13 def + + % Add the ISBN text + includetext { + isbn length 9 eq { + /isbnxpos -1 def + } { + /isbnxpos -12 def + } ifelse + args (txt) known { + /txt args (txt) get def + /newtxt txt length 1 add array def + newtxt 0 txt putinterval + newtxt newtxt length 1 sub [isbntxt isbnxpos isbnpos isbnfont isbnsize] put + args (txt) newtxt put + } { + args (txt) [ [isbntxt isbnxpos isbnpos isbnfont isbnsize] ] put + } ifelse + } if + + args (opt) useropts put + args + + end + +} bind def +/isbn load 0 1 dict put +% --END ENCODER isbn-- + +% --BEGIN ENCODER code128-- +% --DESC: Code 128 +% --EXAM: ^104^102Count^0990123456789^101! +/code128 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (212222) (222122) (222221) (121223) (121322) (131222) (122213) + (122312) (132212) (221213) (221312) (231212) (112232) (122132) + (122231) (113222) (123122) (123221) (223211) (221132) (221231) + (213212) (223112) (312131) (311222) (321122) (321221) (312212) + (322112) (322211) (212123) (212321) (232121) (111323) (131123) + (131321) (112313) (132113) (132311) (211313) (231113) (231311) + (112133) (112331) (132131) (113123) (113321) (133121) (313121) + (211331) (231131) (213113) (213311) (213131) (311123) (311321) + (331121) (312113) (312311) (332111) (314111) (221411) (431111) + (111224) (111422) (121124) (121421) (141122) (141221) (112214) + (112412) (122114) (122411) (142112) (142211) (241211) (221114) + (413111) (241112) (134111) (111242) (121142) (121241) (114212) + (124112) (124211) (411212) (421112) (421211) (212141) (214121) + (412121) (111143) (111341) (131141) (114113) (114311) (411113) + (411311) (113141) (114131) (311141) (411131) (211412) (211214) + (211232) (2331112) + ] def + + % Create a string of the available characters for alphabets A and B + /barchars ( !"#$%&'\(\)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~) def + /barlen barcode length def % Length of the code + /sbs barlen 6 mul string def % sbs is 6 times length of barcode + /txt barlen array def + + /mode -1 def % A=0, B=1, C=2 + /checksum barcode 1 3 getinterval cvi def % Initialise the checksum + + /i 0 def /j 0 def + { % loop + i barlen eq {exit} if + barcode i 1 getinterval (^) eq { + % indx is given by the next three characters + /indx barcode i 1 add 3 getinterval cvi def + txt j [( ) j 11 mul textpos textfont textsize] put + /i i 4 add def + } { + % indx depends on the mode + mode 2 eq { + /indx barcode i 2 getinterval cvi def + txt j [barcode i 2 getinterval j 11 mul textpos textfont textsize] put + /i i 2 add def + } { + barchars barcode i 1 getinterval search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + txt j [barchars indx 1 getinterval j 11 mul textpos textfont textsize] put + /i i 1 add def + } ifelse + } ifelse + /enc encs indx get def % Get the indxth encoding + sbs j 6 mul enc putinterval % Put encoded digit into sbs + + % Update the mode + indx 101 eq indx 103 eq or {/mode 0 def} if + indx 100 eq indx 104 eq or {/mode 1 def} if + indx 99 eq indx 105 eq or {/mode 2 def} if + + /checksum indx j mul checksum add def % checksum+=indx*j + /j j 1 add def + } loop + + % Put the checksum character + /checksum checksum 103 mod def + sbs j 6 mul encs checksum get putinterval + + % Put the end character + sbs j 6 mul 6 add encs 106 get putinterval + + % Shrink sbs and txt to fit exactly + /sbs sbs 0 j 6 mul 13 add getinterval def + /txt txt 0 j getinterval def + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/code128 load 0 1 dict put +% --END ENCODER code128-- + +% --BEGIN ENCODER code39-- +% --DESC: Code 39 +% --EXAM: THIS IS CODE 39 +/code39 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def % Enable/disable checkdigit + /includetext false def + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (1113313111) (3113111131) (1133111131) (3133111111) (1113311131) + (3113311111) (1133311111) (1113113131) (3113113111) (1133113111) + (3111131131) (1131131131) (3131131111) (1111331131) (3111331111) + (1131331111) (1111133131) (3111133111) (1131133111) (1111333111) + (3111111331) (1131111331) (3131111311) (1111311331) (3111311311) + (1131311311) (1111113331) (3111113311) (1131113311) (1111313311) + (3311111131) (1331111131) (3331111111) (1311311131) (3311311111) + (1331311111) (1311113131) (3311113111) (1331113111) (1313131111) + (1313111311) (1311131311) (1113131311) (1311313111) + ] def + + % Create a string of the available characters + /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*) def + + /barlen barcode length def % Length of the code + + includecheck { + /sbs barlen 10 mul 30 add string def + /txt barlen 3 add array def + } { + /sbs barlen 10 mul 20 add string def + /txt barlen 2 add array def + } ifelse + + /checksum 0 def + + % Put the start character + sbs 0 encs 43 get putinterval + txt 0 [(*) 0 textpos textfont textsize] put + + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 10 mul 10 add enc putinterval % Put encoded digit into sbs + txt i 1 add [barcode i 1 getinterval i 1 add 16 mul textpos textfont textsize] put + /checksum checksum indx add def + } for + + % Put the checksum and end characters + includecheck { + /checksum checksum 43 mod def + sbs barlen 10 mul 10 add encs checksum get putinterval + includecheckintext { + txt barlen 1 add [barchars checksum 1 getinterval barlen 1 add 16 mul textpos textfont textsize] put + } { + txt barlen 1 add [() barlen 1 add 16 mul textpos textfont textsize] put + } ifelse + sbs barlen 10 mul 20 add encs 43 get putinterval + txt barlen 2 add [(*) barlen 2 add 16 mul textpos textfont textsize] put + } { + sbs barlen 10 mul 10 add encs 43 get putinterval + txt barlen 1 add [(*) barlen 1 add 16 mul textpos textfont textsize] put + } ifelse + + % Return the arguments + /retval 2 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/code39 load 0 1 dict put +% --END ENCODER code39-- + +% --BEGIN ENCODER code93-- +% --DESC: Code 93 +% --EXAM: THIS IS CODE 93 +/code93 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def % Enable/disable checkdigit + /includetext false def % Enable/disable text + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + /encs + [ (131112) (111213) (111312) (111411) (121113) + (121212) (121311) (111114) (131211) (141111) + (211113) (211212) (211311) (221112) (221211) + (231111) (112113) (112212) (112311) (122112) + (132111) (111123) (111222) (111321) (121122) + (131121) (212112) (212211) (211122) (211221) + (221121) (222111) (112122) (112221) (122121) + (123111) (121131) (311112) (311211) (321111) + (112131) (113121) (211131) (121221) (312111) + (311121) (122211) (111141) (1111411) + ] def + + % Create a string of the available characters + /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def + + /barlen barcode length def % Length of the code + barcode { + (^) search false eq {pop exit} if + pop pop /barlen barlen 3 sub def + } loop + + includecheck { + /sbs barlen 6 mul 25 add string def + } { + /sbs barlen 6 mul 13 add string def + } ifelse + /txt barlen array def + + % Put the start character + sbs 0 encs 47 get putinterval + + /checksum1 0 def /checksum2 0 def + + /i 0 def /j 0 def + { % loop + j barlen eq {exit} if + barcode i 1 getinterval (^) eq { + % indx is given by the next three characters + /indx barcode i 1 add 3 getinterval cvi def + txt j [( ) j 9 mul 9 add textpos textfont textsize] put + /i i 4 add def + } { + barchars barcode i 1 getinterval search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + txt j [barchars indx 1 getinterval j 9 mul 9 add textpos textfont textsize] put + /i i 1 add def + } ifelse + /enc encs indx get def % Get the indxth encoding + sbs j 6 mul 6 add enc putinterval % Put encoded digit into sbs + /checksum1 checksum1 barlen j sub 1 sub 20 mod 1 add indx mul add def + /checksum2 checksum2 barlen j sub 15 mod 1 add indx mul add def + /j j 1 add def + } loop + + includecheck { + % Put the first checksum character + /checksum1 checksum1 47 mod def + /checksum2 checksum2 checksum1 add 47 mod def + sbs j 6 mul 6 add encs checksum1 get putinterval + sbs j 6 mul 12 add encs checksum2 get putinterval + % Put the end character + sbs j 6 mul 18 add encs 48 get putinterval + } { + % Put the end character + sbs j 6 mul 6 add encs 48 get putinterval + } ifelse + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/code93 load 0 1 dict put +% --END ENCODER code93-- + +% --BEGIN ENCODER interleaved2of5-- +% --DESC: Interleaved 2 of 5 (ITF) +% --EXAM: 24012345678905 +/interleaved2of5 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def % Enable/disable checkdigit + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + /barlen barcode length def % Length of the code + + % Prefix 0 to barcode if length is even and including checkdigit + % or length is odd and not including checkdigit + barlen 2 mod 0 eq includecheck and % even & includecheck + barlen 2 mod 0 ne includecheck not and or { % odd & !includecheck + /pad barlen 1 add string def % Create pad one bigger than barcode + pad 0 48 put % Put ascii 0 at start of pad + pad 1 barcode putinterval % Add barcode to the end of pad + /barcode pad def % barcode=pad + /barlen barlen 1 add def % barlen++ + } if + + % Add checksum to end of barcode + includecheck { + /checksum 0 def + 0 1 barlen 1 sub { + /i exch def + i 2 mod 0 eq { + /checksum checksum barcode i get 48 sub 3 mul add def + } { + /checksum checksum barcode i get 48 sub add def + } ifelse + } for + /checksum 10 checksum 10 mod sub 10 mod def + /pad barlen 1 add string def % Create pad one bigger than barcode + pad 0 barcode putinterval % Add barcode to the start of pad + pad barlen checksum 48 add put % Add checksum to end of pad + /barcode pad def % barcode=pad + /barlen barlen 1 add def % barlen++ + } if + + % Create an array containing the character mappings + /encs + [ (11331) (31113) (13113) (33111) (11313) + (31311) (13311) (11133) (31131) (13131) + (1111) (3111) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + /sbs barlen 5 mul 8 add string def + /txt barlen array def + + % Put the start character + sbs 0 encs 10 get putinterval + + 0 2 barlen 1 sub { + /i exch def + % Lookup the encodings for two consecutive barcode characters + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enca encs indx get def % Get the indxth encoding + + barcode i 1 add 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /encb encs indx get def % Get the indxth encoding + + % Interleave the two character encodings + /intl enca length 2 mul string def + 0 1 enca length 1 sub { + /j exch def + /achar enca j get def + /bchar encb j get def + intl j 2 mul achar put + intl j 2 mul 1 add bchar put + } for + + sbs i 5 mul 4 add intl putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 9 mul 4 add textpos textfont textsize] put + includecheck includecheckintext not and barlen 2 sub i eq and { + txt i 1 add [( ) i 1 add 9 mul 4 add textpos textfont textsize] put + } { + txt i 1 add [barcode i 1 add 1 getinterval i 1 add 9 mul 4 add textpos textfont textsize] put + } ifelse + } for + + % Put the end character + sbs barlen 5 mul 4 add encs 11 get putinterval + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/interleaved2of5 load 0 1 dict put +% --END ENCODER interleaved2of5-- + +% --BEGIN ENCODER rss14-- +% --DESC: Reduced Space Symbology 14 (RSS-14) +% --EXAM: 24012345678905 +/rss14 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 1 def + /linkage false def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /getRSSwidths { + /mw exch def + /nm exch def + /val exch def + /j 0 def /i 0 def { + /v () def + mw 1 ne {/v i mw 4 string cvrs def} if + 0 v {48 sub add} forall 4 add nm eq { + j val eq {exit} if + /j j 1 add def + } if + /i i 1 add def + } loop + [4 {1} repeat v {47 sub} forall] v length 4 getinterval + } bind def + + /binval [barcode {48 sub} forall] def + /binval [linkage {1} {0} ifelse binval 0 13 getinterval {} forall] def + + 0 1 12 { + /i exch def + binval i 1 add 2 copy get binval i get 4537077 mod 10 mul add put + binval i binval i get 4537077 idiv put + } for + /right binval 13 get 4537077 mod def + binval 13 2 copy get 4537077 idiv put + + /left 0 def + /i true def + 0 1 13 { + /j exch def + binval j get + dup 0 eq i and { + pop + } { + /i false def + /left left 3 -1 roll 10 13 j sub exp cvi mul add def + } ifelse + } for + + /d1 left 1597 idiv def + /d2 left 1597 mod def + /d3 right 1597 idiv def + /d4 right 1597 mod def + + /tab164 [ + 160 0 12 4 8 1 161 1 + 960 161 10 6 6 3 80 10 + 2014 961 8 8 4 5 31 34 + 2714 2015 6 10 3 6 10 70 + 2840 2715 4 12 1 8 1 126 + ] def + + /tab154 [ + 335 0 5 10 2 7 4 84 + 1035 336 7 8 4 5 20 35 + 1515 1036 9 6 6 3 48 10 + 1596 1516 11 4 8 1 81 1 + ] def + + /i 0 def { + d1 tab164 i get le { + tab164 i 1 add 7 getinterval {} forall + /d1te exch def /d1to exch def + /d1mwe exch def /d1mwo exch def + /d1ele exch def /d1elo exch def + /d1gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d2 tab154 i get le { + tab154 i 1 add 7 getinterval {} forall + /d2te exch def /d2to exch def + /d2mwe exch def /d2mwo exch def + /d2ele exch def /d2elo exch def + /d2gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d3 tab164 i get le { + tab164 i 1 add 7 getinterval {} forall + /d3te exch def /d3to exch def + /d3mwe exch def /d3mwo exch def + /d3ele exch def /d3elo exch def + /d3gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d4 tab154 i get le { + tab154 i 1 add 7 getinterval {} forall + /d4te exch def /d4to exch def + /d4mwe exch def /d4mwo exch def + /d4ele exch def /d4elo exch def + /d4gs exch def + exit + } if + /i i 8 add def + } loop + + /d1wo d1 d1gs sub d1te idiv d1elo d1mwo getRSSwidths def + /d1we d1 d1gs sub d1te mod d1ele d1mwe getRSSwidths def + /d2wo d2 d2gs sub d2to mod d2elo d2mwo getRSSwidths def + /d2we d2 d2gs sub d2to idiv d2ele d2mwe getRSSwidths def + /d3wo d3 d3gs sub d3te idiv d3elo d3mwo getRSSwidths def + /d3we d3 d3gs sub d3te mod d3ele d3mwe getRSSwidths def + /d4wo d4 d4gs sub d4to mod d4elo d4mwo getRSSwidths def + /d4we d4 d4gs sub d4to idiv d4ele d4mwe getRSSwidths def + + /d1w 8 array def + 0 1 3 { + /i exch def + d1w i 2 mul d1wo i get put + d1w i 2 mul 1 add d1we i get put + } for + + /d2w 8 array def + 0 1 3 { + /i exch def + d2w 7 i 2 mul sub d2wo i get put + d2w 6 i 2 mul sub d2we i get put + } for + + /d3w 8 array def + 0 1 3 { + /i exch def + d3w 7 i 2 mul sub d3wo i get put + d3w 6 i 2 mul sub d3we i get put + } for + + /d4w 8 array def + 0 1 3 { + /i exch def + d4w i 2 mul d4wo i get put + d4w i 2 mul 1 add d4we i get put + } for + + /widths [ + d1w {} forall + d2w {} forall + d3w {} forall + d4w {} forall + ] def + + /checkweights [ + 1 3 9 27 2 6 18 54 + 58 72 24 8 29 36 12 4 + 74 51 17 32 37 65 48 16 + 64 34 23 69 49 68 46 59 + ] def + + /checkwidths [ + 3 8 2 1 1 3 5 5 1 1 3 3 7 1 1 + 3 1 9 1 1 2 7 4 1 1 2 5 6 1 1 + 2 3 8 1 1 1 5 7 1 1 1 3 9 1 1 + ] def + + /checksum 0 def + 0 1 31 { + /i exch def + /checksum checksum widths i get checkweights i get mul add def + } for + /checksum checksum 79 mod def + checksum 8 ge {/checksum checksum 1 add def} if + checksum 72 ge {/checksum checksum 1 add def} if + /checklt checkwidths checksum 9 idiv 5 mul 5 getinterval def + /checkrtrev checkwidths checksum 9 mod 5 mul 5 getinterval def + /checkrt 5 array def + 0 1 4 { + /i exch def + checkrt i checkrtrev 4 i sub get put + } for + + /sbs [ + 1 d1w {} forall checklt {} forall d2w {} + forall d4w {} forall checkrt {} forall d3w {} forall 1 1 + ] def + + % Return the arguments + /retval 1 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/rss14 load 0 1 dict put +% --END ENCODER rss14-- + +% --BEGIN ENCODER rsslimited-- +% --DESC: Reduced Space Symbology Limited (RSS-Limited) +% --EXAM: 00978186074271 +/rsslimited { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /getRSSwidths { + /el exch def + /mw exch def + /nm exch def + /val exch def + /j 0 def /i 0 def { + /v () def + mw 1 ne {/v i mw el string cvrs def} if + 0 v {48 sub add} forall el add nm eq { + j val eq {exit} if + /j j 1 add def + } if + /i i 1 add def + } loop + [el {1} repeat v {47 sub} forall] v length el getinterval + } bind def + + /binval [barcode {48 sub} forall] def + /binval [binval 0 13 getinterval {} forall] def + + 0 1 11 { + /i exch def + binval i 1 add 2 copy get binval i get 2013571 mod 10 mul add put + binval i binval i get 2013571 idiv put + } for + /d2 binval 12 get 2013571 mod def + binval 12 2 copy get 2013571 idiv put + + /d1 0 def + /i true def + 0 1 12 { + /j exch def + binval j get + dup 0 eq i and { + pop + } { + /i false def + /d1 d1 3 -1 roll 10 12 j sub exp cvi mul add def + } ifelse + } for + + /tab267 [ + 183063 0 17 9 6 3 6538 28 + 820063 183064 13 13 5 4 875 728 + 1000775 820064 9 17 3 6 28 6454 + 1491020 1000776 15 11 5 4 2415 203 + 1979844 1491021 11 15 4 5 203 2408 + 1996938 1979845 19 7 8 1 17094 1 + 2013570 1996939 7 19 1 8 1 16632 + ] def + + /i 0 def { + d1 tab267 i get le { + tab267 i 1 add 7 getinterval {} forall + /d1te exch def /d1to exch def + /d1mwe exch def /d1mwo exch def + /d1ele exch def /d1elo exch def + /d1gs exch def + exit + } if + /i i 8 add def + } loop + + /i 0 def { + d2 tab267 i get le { + tab267 i 1 add 7 getinterval {} forall + /d2te exch def /d2to exch def + /d2mwe exch def /d2mwo exch def + /d2ele exch def /d2elo exch def + /d2gs exch def + exit + } if + /i i 8 add def + } loop + + /d1wo d1 d1gs sub d1te idiv d1elo d1mwo 7 getRSSwidths def + /d1we d1 d1gs sub d1te mod d1ele d1mwe 7 getRSSwidths def + /d2wo d2 d2gs sub d2te idiv d2elo d2mwo 7 getRSSwidths def + /d2we d2 d2gs sub d2te mod d2ele d2mwe 7 getRSSwidths def + + /d1w 14 array def + 0 1 6 { + /i exch def + d1w i 2 mul d1wo i get put + d1w i 2 mul 1 add d1we i get put + } for + + /d2w 14 array def + 0 1 6 { + /i exch def + d2w i 2 mul d2wo i get put + d2w i 2 mul 1 add d2we i get put + } for + + /widths [ + d1w {} forall + d2w {} forall + ] def + + /checkweights [ + 1 3 9 27 81 65 17 51 64 14 42 37 22 66 + 20 60 2 6 18 54 73 41 34 13 39 28 84 74 + ] def + + /checkseq [ + 0 1 43 {} for + 45 52 57 + 63 1 66 {} for + 73 1 79 {} for + 82 + 126 1 130 {} for + 132 + 141 1 146 {} for + 210 1 217 {} for + 220 + 316 1 323 {} for + 326 337 + ] def + + /checksum 0 def + 0 1 27 { + /i exch def + /checksum checksum widths i get checkweights i get mul add def + } for + /checksum checksum 89 mod def + /seq checkseq checksum get def + /swidths seq 21 idiv 8 3 6 getRSSwidths def + /bwidths seq 21 mod 8 3 6 getRSSwidths def + + /checkwidths [0 0 0 0 0 0 0 0 0 0 0 0 1 1] def + 0 1 5 { + /i exch def + checkwidths i 2 mul swidths i get put + checkwidths i 2 mul 1 add bwidths i get put + } for + + /sbs [ + 1 d1w {} forall checkwidths {} forall d2w {} forall 1 1 + ] def + + % Return the arguments + /retval 1 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/rsslimited load 0 1 dict put +% --END ENCODER rsslimited-- + +% --BEGIN ENCODER rssexpanded-- +% --DESC: Reduced Space Symbology Expanded (RSS-Expanded) +% --EXAM: 000000010011001010100001000000010000 +/rssexpanded { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /getRSSwidths { + /mw exch def + /nm exch def + /val exch def + /j 0 def /i 0 def { + /v () def + mw 1 ne {/v i mw 4 string cvrs def} if + 0 v {48 sub add} forall 4 add nm eq { + j val eq {exit} if + /j j 1 add def + } if + /i i 1 add def + } loop + [4 {1} repeat v {47 sub} forall] v length 4 getinterval + } bind def + + /binval [barcode {48 sub} forall] def + /datalen binval length 12 idiv def + + /tab174 [ + 347 0 12 5 7 2 87 4 + 1387 348 10 7 5 4 52 20 + 2947 1388 8 9 4 5 30 52 + 3987 2948 6 11 3 6 10 104 + 4191 3988 4 13 1 8 1 204 + ] def + + /dxw datalen array def + + 0 1 datalen 1 sub { + + /x exch def + + /d binval x 12 mul 12 getinterval def + /d 0 0 1 11 {/j exch def 2 11 j sub exp cvi d j get mul add} for def + + /j 0 def { + d tab174 j get le { + tab174 j 1 add 7 getinterval {} forall + /dte exch def /dto exch def + /dmwe exch def /dmwo exch def + /dele exch def /delo exch def + /dgs exch def + exit + } if + /j j 8 add def + } loop + + /dwo d dgs sub dte idiv delo dmwo getRSSwidths def + /dwe d dgs sub dte mod dele dmwe getRSSwidths def + + /dw 8 array def + x 2 mod 0 eq { + 0 1 3 { + /j exch def + dw 7 j 2 mul sub dwo j get put + dw 6 j 2 mul sub dwe j get put + } for + } { + 0 1 3 { + /j exch def + dw j 2 mul dwo j get put + dw j 2 mul 1 add dwe j get put + } for + } ifelse + + dxw x dw put + + } for + + /widths [ + dxw {{} forall} forall + ] def + + /checkweights [ + 77 96 32 81 27 9 3 1 + 20 60 180 118 143 7 21 63 + 205 209 140 117 39 13 145 189 + 193 157 49 147 19 57 171 91 + 132 44 85 169 197 136 186 62 + 185 133 188 142 4 12 36 108 + 50 87 29 80 97 173 128 113 + 150 28 84 41 123 158 52 156 + 166 196 206 139 187 203 138 46 + 76 17 51 153 37 111 122 155 + 146 119 110 107 106 176 129 43 + 16 48 144 10 30 90 59 177 + 164 125 112 178 200 137 116 109 + 70 210 208 202 184 130 179 115 + 190 204 68 93 31 151 191 134 + 148 22 66 198 172 94 71 2 + 40 154 192 64 162 54 18 6 + 120 149 25 75 14 42 126 167 + 175 199 207 69 23 78 26 79 + 103 98 83 38 114 131 182 124 + 159 53 88 170 127 183 61 161 + 55 165 73 8 24 72 5 15 + 89 100 174 58 160 194 135 45 + ] def + + /checksum 0 def + 0 1 widths length 1 sub { + /i exch def + /checksum checksum widths i get checkweights i get mul add def + } for + /checksum checksum 211 mod datalen 3 sub 211 mul add def + + /i 0 def { + checksum tab174 i get le { + tab174 i 1 add 7 getinterval {} forall + /cte exch def /cto exch def + /cmwe exch def /cmwo exch def + /cele exch def /celo exch def + /cgs exch def + exit + } if + /i i 8 add def + } loop + + /cwo checksum cgs sub cte idiv celo cmwo getRSSwidths def + /cwe checksum cgs sub cte mod cele cmwe getRSSwidths def + + /cw 8 array def + 0 1 3 { + /i exch def + cw i 2 mul cwo i get put + cw i 2 mul 1 add cwe i get put + } for + + /finderwidths [ + 1 8 4 1 1 1 1 4 8 1 + 3 6 4 1 1 1 1 4 6 3 + 3 4 6 1 1 1 1 6 4 3 + 3 2 8 1 1 1 1 8 2 3 + 2 6 5 1 1 1 1 5 6 2 + 2 2 9 1 1 1 1 9 2 2 + ] def + + /finderseq [ + [0 1] + [0 3 2] + [0 5 2 7] + [0 9 2 7 4] + [0 9 2 7 6 11] + [0 9 2 7 8 11 10] + [0 1 2 3 4 5 6 7] + [0 1 2 3 4 5 6 9 8] + [0 1 2 3 4 5 6 9 10 11] + [0 1 2 3 4 7 6 9 8 11 10] + ] def + + /seq finderseq datalen 2 add 2 idiv 2 sub get def + /fxw seq length array def + 0 1 seq length 1 sub { + /x exch def + fxw x finderwidths seq x get 5 mul 5 getinterval put + } for + + /sbs [ + 1 + cw {} forall + 0 1 datalen 1 sub { + /i exch def + i 2 mod 0 eq {fxw i 2 idiv get {} forall} if + dxw i get {} forall + } for + 1 1 + ] def + + % Return the arguments + /retval 1 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/rssexpanded load 0 1 dict put +% --END ENCODER rssexpanded-- + +% --BEGIN ENCODER code2of5-- +% --DESC: Code 25 +% --EXAM: 01234567 +/code2of5 { + + % Thanks to Michael Landers + + 0 begin % Confine variable to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (1111313111) (3111111131) (1131111131) (3131111111) + (1111311131) (3111311111) (1131311111) (1111113131) + (3111113111) (1131113111) (313111) (311131) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + /barlen barcode length def % Length of the code + + includecheck { + /sbs barlen 10 mul 22 add string def + /txt barlen 1 add array def + } { + /sbs barlen 10 mul 12 add string def + /txt barlen array def + } ifelse + + % Put the start character + sbs 0 encs 10 get putinterval + + /checksum 0 def + + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 10 mul 6 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 14 mul 10 add textpos textfont textsize] put + barlen i sub 2 mod 0 eq { + /checksum checksum indx add def + } { + /checksum checksum indx 3 mul add def + } ifelse + } for + + % Put the checksum and end characters + includecheck { + /checksum 10 checksum 10 mod sub 10 mod def + sbs barlen 10 mul 6 add encs checksum get putinterval + sbs barlen 10 mul 16 add encs 11 get putinterval + includecheckintext { + txt barlen [barchars checksum 1 getinterval barlen 14 mul 10 add textpos textfont textsize] put + } { + txt barlen [( ) barlen 14 mul 10 add textpos textfont textsize] put + } ifelse + } { + sbs barlen 10 mul 6 add encs 11 get putinterval + } ifelse + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/code2of5 load 0 1 dict put +% --END ENCODER code2of5-- + +% --BEGIN ENCODER code11-- +% --DESC: Code 11 +% --EXAM: 0123456789 +/code11 { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def + /includetext false def + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (111131) (311131) (131131) (331111) (113131) + (313111) (133111) (111331) (311311) (311111) + (113111) (113311) + ] def + + % Create a string of the available characters + /barchars (0123456789-) def + + /barlen barcode length def % Length of the code + + includecheck { + barlen 10 ge { + /sbs barlen 6 mul 24 add string def + /txt barlen 2 add array def + } { + /sbs barlen 6 mul 18 add string def + /txt barlen 1 add array def + } ifelse + } { + /sbs barlen 6 mul 12 add string def + /txt barlen array def + } ifelse + + % Put the start character + sbs 0 encs 10 get putinterval + + /checksum1 0 def /checksum2 0 def + + /xpos 8 def + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 6 mul 6 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval xpos textpos textfont textsize] put + 0 1 5 { % xpos+=width of the character + /xpos exch enc exch get 48 sub xpos add def + } for + /checksum1 checksum1 barlen i sub 1 sub 10 mod 1 add indx mul add def + /checksum2 checksum2 barlen i sub 9 mod 1 add indx mul add def + } for + + % Put the checksum and end characters + includecheck { + /checksum1 checksum1 11 mod def + barlen 10 ge { + /checksum2 checksum2 checksum1 add 11 mod def + sbs barlen 6 mul 6 add encs checksum1 get putinterval + sbs barlen 6 mul 12 add encs checksum2 get putinterval + includecheckintext { + txt barlen [barchars checksum1 1 getinterval xpos textpos textfont textsize] put + /enc encs checksum1 get def + 0 1 5 { % xpos+=width of the character + /xpos exch enc exch get 48 sub xpos add def + } for + txt barlen 1 add [barchars checksum2 1 getinterval xpos textpos textfont textsize] put + } { + txt barlen [() xpos textpos textfont textsize] put + txt barlen 1 add [() xpos textpos textfont textsize] put + } ifelse + sbs barlen 6 mul 18 add encs 11 get putinterval + } { + sbs barlen 6 mul 6 add encs checksum1 get putinterval + includecheckintext { + txt barlen [barchars checksum1 1 getinterval xpos textpos textfont textsize] put + } { + txt barlen [() xpos textpos textfont textsize] put + } ifelse + sbs barlen 6 mul 12 add encs 11 get putinterval + } ifelse + } { + sbs barlen 6 mul 6 add encs 11 get putinterval + } ifelse + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/code11 load 0 1 dict put +% --END ENCODER code11-- + +% --BEGIN ENCODER rationalizedCodabar-- +% --DESC: Rationalized Codabar +% --EXAM: A0123456789B +/rationalizedCodabar { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def % Enable/disable checkdigit + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (11111331) (11113311) (11131131) (33111111) (11311311) + (31111311) (13111131) (13113111) (13311111) (31131111) + (11133111) (11331111) (31113131) (31311131) (31313111) + (11313131) (11331311) (13131131) (11131331) (11133311) + ] def + + % Create a string of the available characters + /barchars (0123456789-$:/.+ABCD) def + + /barlen barcode length def % Length of the code + + includecheck { + /sbs barlen 8 mul 8 add string def + /txt barlen 1 add array def + } { + /sbs barlen 8 mul string def + /txt barlen array def + } ifelse + + /checksum 0 def + /xpos 0 def + 0 1 barlen 2 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 8 mul enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval xpos textpos textfont textsize] put + 0 1 7 { % xpos+=width of the character + /xpos exch enc exch get 48 sub xpos add def + } for + /checksum checksum indx add def + } for + + % Find index of last character + barcode barlen 1 sub 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + + includecheck { + % Put the checksum character + /checksum checksum indx add def + /checksum 16 checksum 16 mod sub 16 mod def + sbs barlen 8 mul 8 sub encs checksum get putinterval + includecheckintext { + txt barlen 1 sub [barchars checksum 1 getinterval xpos textpos textfont textsize] put + } { + txt barlen 1 sub [( ) xpos textpos textfont textsize] put + } ifelse + 0 1 7 { % xpos+=width of the character + /xpos exch encs checksum get exch get 48 sub xpos add def + } for + % Put the end character + /enc encs indx get def % Get the indxth encoding + sbs barlen 8 mul enc putinterval % Put encoded digit into sbs + txt barlen [barcode barlen 1 sub 1 getinterval xpos textpos textfont textsize] put + } { + % Put the end character + /enc encs indx get def % Get the indxth encoding + sbs barlen 8 mul 8 sub enc putinterval % Put encoded digit into sbs + txt barlen 1 sub [barcode barlen 1 sub 1 getinterval xpos textpos textfont textsize] put + } ifelse + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/rationalizedCodabar load 0 1 dict put +% --END ENCODER rationalizedCodabar-- + +% --BEGIN ENCODER onecode-- +% --DESC: United States Postal Service OneCode +% --EXAM: 0123456709498765432101234567891 +/onecode { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 0.175 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + + /barlen barcode length def + + /normalize { + /base exch def + /num exch def + num length 1 sub -1 1 { + /i exch def + num i 1 sub 2 copy get num i get base idiv add put + num i num i get base mod put + } for + { %loop - extend input as necessary + num 0 get base lt {exit} if + /num [0 num {} forall] def + num 0 num 0 get num 1 get base idiv add put + num 1 num 1 get base mod put + } loop + % Trim leading zeros + /num [/i true def num {dup 0 eq i and {pop} {/i false def} ifelse} forall] def + num length 0 eq {/num [0] def} if + num + } bind def + + /bigadd { + 2 copy length exch length + 2 copy sub abs /offset exch def + lt {exch} if + /a exch def /b exch def + 0 1 b length 1 sub { + dup a exch offset add 2 copy get b 5 -1 roll get add put + } for + a + } bind def + + % Conversion of data fields into binary data + barlen 20 eq {[0]} if + barlen 25 eq {[1]} if + barlen 29 eq {[1 0 0 0 0 1]} if + barlen 31 eq {[1 0 0 0 1 0 0 0 0 1]} if + /binval exch [barcode 20 barlen 20 sub getinterval {48 sub} forall] bigadd def + /binval [binval {} forall barcode 0 get 48 sub] def + /binval [binval {5 mul} forall] [barcode 1 get 48 sub] bigadd 10 normalize def + /binval [binval {} forall barcode 2 18 getinterval {48 sub} forall] def + + % Conversion of binary data into byte array + /bytes 13 array def + /bintmp [binval {} forall] def + 12 -1 0 { + /i exch def + 0 1 bintmp length 2 sub { + /j exch def + bintmp j 1 add 2 copy get bintmp j get 256 mod 10 mul add put + bintmp j bintmp j get 256 idiv put + } for + bytes i bintmp bintmp length 1 sub get 256 mod put + bintmp bintmp length 1 sub 2 copy get 256 idiv put + } for + + % Generation of 11-bit CRC on byte array + /fcs 2047 def + /dat bytes 0 get 5 bitshift def + 6 { + fcs dat xor 1024 and 0 ne { + /fcs fcs 1 bitshift 3893 xor def + } { + /fcs fcs 1 bitshift def + } ifelse + /fcs fcs 2047 and def + /dat dat 1 bitshift def + } repeat + 1 1 12 { + bytes exch get 3 bitshift /dat exch def + 8 { + fcs dat xor 1024 and 0 ne { + /fcs fcs 1 bitshift 3893 xor def + } { + /fcs fcs 1 bitshift def + } ifelse + /fcs fcs 2047 and def + /dat dat 1 bitshift def + } repeat + } for + + % Conversion from binary data to codewords + /codewords 10 array def + 9 -1 0 { + /i exch def + i 9 eq { + /b 636 def + } { + /b 1365 def + } ifelse + 0 1 binval length 2 sub { + /j exch def + binval j 1 add 2 copy get binval j get b mod 10 mul add put + binval j binval j get b idiv put + } for + codewords i binval binval length 1 sub get b mod put + binval binval length 1 sub 2 copy get b idiv put + } for + + % Inserting additional information into codewords + codewords 9 codewords 9 get 2 mul put + fcs 1024 and 0 ne { + codewords 0 codewords 0 get 659 add put + } if + + % Conversion from codewords to characters + /tab513 1287 dict def + /lo 0 def + /hi 1286 def + 0 1 8191 { + { % no loop - provides common exit point + /i exch def + /onbits 0 def + 0 1 12 { + i exch 1 exch bitshift and 0 ne { + /onbits onbits 1 add def + } if + } for + onbits 5 ne {exit} if + /j i def + /rev 0 def + 16 { + /rev rev 1 bitshift j 1 and or def + /j j -1 bitshift def + } repeat + /rev rev -3 bitshift def + rev i lt {exit} if + rev i eq { + tab513 hi i put + /hi hi 1 sub def + } { + tab513 lo i put + tab513 lo 1 add rev put + /lo lo 2 add def + } ifelse + exit + } loop + } for + + /tab213 78 dict def + /lo 0 def + /hi 77 def + 0 1 8191 { + { % no loop - provides common exit point + /i exch def + /onbits 0 def + 0 1 12 { + i exch 1 exch bitshift and 0 ne { + /onbits onbits 1 add def + } if + } for + onbits 2 ne {exit} if + /j i def + /rev 0 def + 16 { + /rev rev 1 bitshift j 1 and or def + /j j -1 bitshift def + } repeat + /rev rev -3 bitshift def + rev i lt {exit} if + rev i eq { + tab213 hi i put + /hi hi 1 sub def + } { + tab213 lo i put + tab213 lo 1 add rev put + /lo lo 2 add def + } ifelse + exit + } loop + } for + + /chars 10 array def + 0 1 9 { + /i exch def + codewords i get dup 1286 le { + tab513 exch get + } { + tab213 exch 1287 sub get + } ifelse + chars i 3 -1 roll put + } for + + 9 -1 0 { + /i exch def + 2 i exp cvi fcs and 0 ne { + chars i chars i get 8191 xor put + } if + } for + + % Conversion from characters to the OneCode encoding + /barmap [ + 7 2 4 3 1 10 0 0 9 12 2 8 5 5 6 11 8 9 3 1 + 0 1 5 12 2 5 1 8 4 4 9 11 6 3 8 10 3 9 7 6 + 5 11 1 4 8 5 2 12 9 10 0 2 7 1 6 7 3 6 4 9 + 0 3 8 6 6 4 2 7 1 1 9 9 7 10 5 2 4 0 3 8 + 6 2 0 4 8 11 1 0 9 8 3 12 2 6 7 7 5 1 4 10 + 1 12 6 9 7 3 8 0 5 8 9 7 4 6 2 10 3 4 0 5 + 8 4 5 7 7 11 1 9 6 0 9 6 0 6 4 8 2 1 3 2 + 5 9 8 12 4 11 6 1 9 5 7 4 3 3 1 2 0 7 2 0 + 1 3 4 1 6 10 3 5 8 7 9 4 2 11 5 6 0 8 7 12 + 4 2 8 1 5 10 3 0 9 3 0 9 6 5 2 4 7 8 1 7 + 5 0 4 5 2 3 0 10 6 12 9 2 3 11 1 6 8 8 7 9 + 5 4 0 11 1 5 2 2 9 1 4 12 8 3 6 6 7 0 3 7 + 4 7 7 5 0 12 1 11 2 9 9 0 6 8 5 3 3 10 8 2 + ] def + + /bbs 65 array def + /bhs 65 array def + 0 1 64 { + /i exch def + /dec chars barmap i 4 mul get get 2 barmap i 4 mul 1 add get exp cvi and 0 ne def + /asc chars barmap i 4 mul 2 add get get 2 barmap i 4 mul 3 add get exp cvi and 0 ne def + dec not asc not and { + bbs i 3 height mul 8 div put + bhs i 2 height mul 8 div put + } if + dec not asc and { + bbs i 3 height mul 8 div put + bhs i 5 height mul 8 div put + } if + dec asc not and { + bbs i 0 height mul 8 div put + bhs i 5 height mul 8 div put + } if + dec asc and { + bbs i 0 height mul 8 div put + bhs i 8 height mul 8 div put + } if + } for + + /retval 4 dict def + retval (bbs) bbs put + retval (bhs) bhs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put + retval (opt) useropts put + retval + + end + +} bind def +/onecode load 0 1 dict put +% --END ENCODER onecode-- + +% --BEGIN ENCODER postnet-- +% --DESC: United States Postal Service Postnet +% --EXAM: 012345 +/postnet { + + % Thanks to Ross McFarland + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 0.125 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + /barlen barcode length def + + % Create an array containing the character mappings + /encs + [ (55222) (22255) (22525) (22552) (25225) + (25252) (25522) (52225) (52252) (52522) + (5) (5) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + /bhs barlen 5 mul 7 add array def + /txt barlen 1 add array def + + % Put start character + /enc encs 10 get def + /heights enc length array def + 0 1 enc length 1 sub { + /j exch def + heights j enc j 1 getinterval cvi height mul 5 div put + } for + bhs 0 heights putinterval % Put encoded digit into sbs + + /checksum 0 def + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + /heights enc length array def + 0 1 enc length 1 sub { + /j exch def + heights j enc j 1 getinterval cvi height mul 5 div put + } for + bhs i 5 mul 1 add heights putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 5 mul 1 add 3.312 mul textpos textfont textsize] put + /checksum checksum indx add def % checksum+=indx + } for + + % Put the checksum character + /checksum 10 checksum 10 mod sub 10 mod def + /enc encs checksum get def + /heights enc length array def + 0 1 enc length 1 sub { + /j exch def + heights j enc j 1 getinterval cvi height mul 5 div put + } for + bhs barlen 5 mul 1 add heights putinterval + + includecheckintext { + txt barlen [barchars checksum 1 getinterval barlen 5 mul 1 add 3.312 mul textpos textfont textsize] put + } { + txt barlen [( ) barlen 5 mul 1 add 72 mul 25 div textpos textfont textsize] put + } ifelse + + % Put end character + /enc encs 11 get def + /heights enc length array def + 0 1 enc length 1 sub { + /j exch def + heights j enc j 1 getinterval cvi height mul 5 div put + } for + bhs barlen 5 mul 6 add heights putinterval + + /retval 1 dict def + retval (bhs) bhs put + retval (bbs) [bhs length {0} repeat] put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/postnet load 0 1 dict put +% --END ENCODER postnet-- + +% --BEGIN ENCODER royalmail-- +% --DESC: Royal Mail 4 State Customer Code (RM4SCC) +% --EXAM: LE28HS9Z +/royalmail { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 0.175 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (3300) (2211) (2301) (2310) (3201) (3210) + (1122) (0033) (0123) (0132) (1023) (1032) + (1302) (0213) (0303) (0312) (1203) (1212) + (1320) (0231) (0321) (0330) (1221) (1230) + (3102) (2013) (2103) (2112) (3003) (3012) + (3120) (2031) (2121) (2130) (3021) (3030) + (2) (3) + ] def + + % Create a string of the available characters + /barchars (ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS) def + + /barlen barcode length def + /encstr barlen 4 mul 6 add string def + /txt barlen 1 add array def + + % Put start character + encstr 0 encs 36 get putinterval + + /checksumrow 0 def + /checksumcol 0 def + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + encstr i 4 mul 1 add enc putinterval + txt i [barcode i 1 getinterval i 4 mul 1 add 3.312 mul textpos textfont textsize] put + /checksumrow checksumrow indx 6 idiv add def + /checksumcol checksumcol indx 6 mod add def + } for + + % Put the checksum character + /checksum checksumrow 6 mod 6 mul checksumcol 6 mod add def + /enc encs checksum get def + encstr barlen 4 mul 1 add enc putinterval + includecheckintext { + txt barlen [barchars checksum 1 getinterval barlen 4 mul 1 add 3.312 mul textpos textfont textsize] put + } { + txt barlen [( ) barlen 4 mul 1 add 3.312 mul textpos textfont textsize] put + } ifelse + + % Put end character + encstr barlen 4 mul 5 add encs 37 get putinterval + + /bbs encstr length array def + /bhs encstr length array def + 0 1 encstr length 1 sub { + /i exch def + /enc encstr i 1 getinterval def + enc (0) eq { + bbs i 3 height mul 8 div put + bhs i 2 height mul 8 div put + } if + enc (1) eq { + bbs i 0 height mul 8 div put + bhs i 5 height mul 8 div put + } if + enc (2) eq { + bbs i 3 height mul 8 div put + bhs i 5 height mul 8 div put + } if + enc (3) eq { + bbs i 0 height mul 8 div put + bhs i 8 height mul 8 div put + } if + } for + + /retval 4 dict def + retval (bbs) bbs put + retval (bhs) bhs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/royalmail load 0 1 dict put +% --END ENCODER royalmail-- + +% --BEGIN ENCODER auspost-- +% --DESC: AusPost 4 State Customer Code +% --EXAM: 5956439111ABA 9 +/auspost { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 0.175 def + /custinfoenc (character) def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (000) (001) (002) (010) (011) (012) (020) (021) + (022) (100) (101) (102) (110) (111) (112) (120) + (121) (122) (200) (201) (202) (210) (211) (212) + (220) (221) (222) (300) (301) (302) (310) (311) + (312) (320) (321) (322) (023) (030) (031) (032) + (033) (103) (113) (123) (130) (131) (132) (133) + (203) (213) (223) (230) (231) (232) (233) (303) + (313) (323) (330) (331) (332) (333) (003) (013) + (00) (01) (02) (10) (11) (12) (20) (21) (22) (30) + (13) (3) + ] def + + % Create a string of the available characters + /barchars (ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz #) def + + /barlen barcode length def + barcode 0 2 getinterval (11) eq {37} if + barcode 0 2 getinterval (59) eq {52} if + barcode 0 2 getinterval (62) eq {67} if + /encstr exch string def + /txt barlen 2 sub array def + + % Put start character + encstr 0 encs 74 get putinterval + + % Encode the FCC + 0 1 1 { + /i exch def + encs barcode i 1 getinterval cvi 64 add get + encstr i 2 mul 2 add 3 2 roll putinterval + } for + + % Encode the DPID + 2 1 9 { + /i exch def + encs barcode i 1 getinterval cvi 64 add get + encstr i 2 mul 2 add 3 2 roll putinterval + txt i 2 sub [barcode i 1 getinterval i 2 sub 2 mul 6 add 3.312 mul textpos textfont textsize] put + } for + + % Encode the customer information + custinfoenc (numeric) eq { + 0 1 barlen 11 sub { + /i exch def + encs barcode i 10 add 1 getinterval cvi 64 add get + encstr i 2 mul 22 add 3 2 roll putinterval + txt i 8 add [barcode i 10 add 1 getinterval i 2 mul 22 add 3.312 mul textpos textfont textsize] put + } for + /ciflen barlen 10 sub 2 mul def + } { + 0 1 barlen 11 sub { + /i exch def + barcode i 10 add 1 getinterval barchars exch search + pop + length /indx exch def + pop pop + /enc encs indx get def + encstr i 3 mul 22 add enc putinterval + txt i 8 add [barcode i 10 add 1 getinterval i 3 mul 22 add 3.312 mul textpos textfont textsize] put + } for + /ciflen barlen 10 sub 3 mul def + } ifelse + + % Add any filler characters + 22 ciflen add 1 encstr length 14 sub { + encstr exch encs 75 get putinterval + } for + + % Create the 64x64 Reed-Solomon table + /rstable 64 64 mul array def + rstable 0 [ 64 {0} repeat ] putinterval + rstable 64 [ 0 1 63 {} for ] putinterval + /prev 1 def + 64 { + /next prev 1 bitshift def + next 64 and 0 ne { + /next next 67 xor def + } if + 0 1 63 { + /j exch def + /nextcell {rstable 64 next mul j add} def + nextcell rstable 64 prev mul j add get 1 bitshift put + nextcell get 64 and 0 ne { + nextcell nextcell get 67 xor put + } if + } for + /prev next def + } repeat + + % Calculate the Reed-Solomon codes for triples + /rscodes encstr length 16 sub 3 idiv 4 add array def + rscodes 0 [ 4 {0} repeat ] putinterval + 2 3 encstr length 16 sub { + /i exch def + rscodes rscodes length i 2 sub 3 idiv sub 1 sub + encstr i 1 getinterval cvi 16 mul + encstr i 1 add 1 getinterval cvi 4 mul add + encstr i 2 add 1 getinterval cvi add + put + } for + rscodes length 5 sub -1 0 { + /i exch def + 0 1 4 { + /j exch def + rscodes i j add rscodes i j add get + rstable 64 [48 17 29 30 1] j get mul rscodes i 4 add get add get + xor put + } for + } for + /checkcode (000000000000) def + 0 1 3 { + /i exch def + /enc rscodes 3 i sub get 4 3 string cvrs def + checkcode i 3 mul 3 enc length sub add enc putinterval + } for + + % Put checkcode and end characters + encstr encstr length 14 sub checkcode putinterval + encstr encstr length 2 sub encs 74 get putinterval + + /bbs encstr length array def + /bhs encstr length array def + 0 1 encstr length 1 sub { + /i exch def + /enc encstr i 1 getinterval def + enc (0) eq { + bbs i 0 height mul 8 div put + bhs i 8 height mul 8 div put + } if + enc (1) eq { + bbs i 3 height mul 8 div put + bhs i 5 height mul 8 div put + } if + enc (2) eq { + bbs i 0 height mul 8 div put + bhs i 5 height mul 8 div put + } if + enc (3) eq { + bbs i 3 height mul 8 div put + bhs i 2 height mul 8 div put + } if + } for + + /retval 4 dict def + retval (bbs) bbs put + retval (bhs) bhs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/auspost load 0 1 dict put +% --END ENCODER auspost-- + +% --BEGIN ENCODER kix-- +% --DESC: Royal Dutch TPG Post KIX 4-State Barcode +% --EXAM: 1231FZ13XHS +/kix { + + 0 begin + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 0.175 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (0033) (0123) (0132) (1023) (1032) (1122) + (0213) (0303) (0312) (1203) (1212) (1302) + (0231) (0321) (0330) (1221) (1230) (1320) + (2013) (2103) (2112) (3003) (3012) (3102) + (2031) (2121) (2130) (3021) (3030) (3120) + (2211) (2301) (2310) (3201) (3210) (3300) + ] def + + % Create a string of the available characters + /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ) def + + /barlen barcode length def + /encstr barlen 4 mul string def + /txt barlen array def + + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + encstr i 4 mul enc putinterval + txt i [barcode i 1 getinterval i 4 mul 3.312 mul textpos textfont textsize] put + } for + + /bbs encstr length array def + /bhs encstr length array def + 0 1 encstr length 1 sub { + /i exch def + /enc encstr i 1 getinterval def + enc (0) eq { + bbs i 3 height mul 8 div put + bhs i 2 height mul 8 div put + } if + enc (1) eq { + bbs i 0 height mul 8 div put + bhs i 5 height mul 8 div put + } if + enc (2) eq { + bbs i 3 height mul 8 div put + bhs i 5 height mul 8 div put + } if + enc (3) eq { + bbs i 0 height mul 8 div put + bhs i 8 height mul 8 div put + } if + } for + + /retval 4 dict def + retval (bbs) bbs put + retval (bhs) bhs put + retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/kix load 0 1 dict put +% --END ENCODER kix-- + +% --BEGIN ENCODER msi-- +% --DESC: MSI Modified Plessey +% --EXAM: 0123456789 +/msi { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includecheck false def % Enable/disable checkdigit + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (13131313) (13131331) (13133113) (13133131) (13311313) + (13311331) (13313113) (13313131) (31131313) (31131331) + (31) (131) + ] def + + % Create a string of the available characters + /barchars (0123456789) def + + /barlen barcode length def % Length of the code + + includecheck { + /sbs barlen 8 mul 13 add string def + /txt barlen 1 add array def + } { + /sbs barlen 8 mul 5 add string def + /txt barlen array def + } ifelse + + + % Put start character + sbs 0 encs 10 get putinterval + /checksum 0 def + + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 8 mul 2 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 16 mul 4 add textpos textfont textsize] put + barlen i sub 2 mod 0 eq { + /checksum indx checksum add def + } { + /checksum indx 2 mul dup 10 idiv add checksum add def + } ifelse + } for + + % Put the checksum and end characters + includecheck { + /checksum 10 checksum 10 mod sub 10 mod def + sbs barlen 8 mul 2 add encs checksum get putinterval + includecheckintext { + txt barlen [barchars checksum 1 getinterval barlen 16 mul 4 add textpos textfont textsize] put + } { + txt barlen [( ) barlen 16 mul 4 add textpos textfont textsize] put + } ifelse + sbs barlen 8 mul 10 add encs 11 get putinterval + } { + sbs barlen 8 mul 2 add encs 11 get putinterval + } ifelse + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/msi load 0 1 dict put +% --END ENCODER msi-- + +% --BEGIN ENCODER plessey-- +% --DESC: Plessey +% --EXAM: 01234ABCD +/plessey { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /includetext false def % Enable/disable text + /includecheckintext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /textfont textfont cvlit def + /textsize textsize cvr def + /textpos textpos cvr def + /height height cvr def + + % Create an array containing the character mappings + /encs + [ (13131313) (31131313) (13311313) (31311313) + (13133113) (31133113) (13313113) (31313113) + (13131331) (31131331) (13311331) (31311331) + (13133131) (31133131) (13313131) (31313131) + (31311331) (331311313) + ] def + + % Create a string of the available characters + /barchars (0123456789ABCDEF) def + + /barlen barcode length def % Length of the code + /sbs barlen 8 mul 33 add string def + /txt barlen 2 add array def + /checkbits barlen 4 mul 8 add array def + checkbits barlen 4 mul [ 0 0 0 0 0 0 0 0 ] putinterval + + % Put start character + sbs 0 encs 16 get putinterval + + 0 1 barlen 1 sub { + /i exch def + % Lookup the encoding for the each barcode character + barcode i 1 getinterval barchars exch search + pop % Discard true leaving pre + length /indx exch def % indx is the length of pre + pop pop % Discard seek and post + /enc encs indx get def % Get the indxth encoding + sbs i 8 mul 8 add enc putinterval % Put encoded digit into sbs + txt i [barcode i 1 getinterval i 16 mul 16 add textpos textfont textsize] put + checkbits i 4 mul [ + indx 1 and + indx -1 bitshift 1 and + indx -2 bitshift 1 and + indx -3 bitshift + ] putinterval + } for + + % Checksum is last 8 bits of a CRC using a salt + /checksalt [ 1 1 1 1 0 1 0 0 1 ] def + 0 1 barlen 4 mul 1 sub { + /i exch def + checkbits i get 1 eq { + 0 1 8 { + /j exch def + checkbits i j add checkbits i j add get checksalt j get xor put + } for + } if + } for + + % Calculate the value of the checksum digits + /checkval 0 def + 0 1 7 { + /i exch def + /checkval checkval 2 7 i sub exp cvi checkbits barlen 4 mul i add get mul add def + } for + + % Put the checksum characters + /checksum1 checkval -4 bitshift def + /checksum2 checkval 15 and def + sbs barlen 8 mul 8 add encs checksum1 get putinterval + sbs barlen 8 mul 16 add encs checksum2 get putinterval + includecheckintext { + txt barlen [barchars checksum1 1 getinterval barlen 16 mul 16 add textpos textfont textsize] put + txt barlen 1 add [barchars checksum2 1 getinterval barlen 1 add 16 mul 16 add textpos textfont textsize] put + } { + txt barlen [( ) barlen 16 mul 16 add textpos textfont textsize] put + txt barlen 1 add [( ) barlen 1 add 16 mul 16 add textpos textfont textsize] put + } ifelse + + % Put end character + sbs barlen 8 mul 24 add encs 17 get putinterval + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + includetext { + retval (txt) txt put + } if + retval (opt) useropts put + retval + + end + +} bind def +/plessey load 0 1 dict put +% --END ENCODER plessey-- + +% --BEGIN ENCODER raw-- +% --DESC: Raw bar space succession for custom symbologies +% --EXAM: 331132131313411122131311333213114131131221323 +/raw { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /sbs exch def % We are given a barcode string + + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + /height height cvr def + + % Return the arguments + /retval 1 dict def + retval (sbs) [sbs {48 sub} forall] put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/raw load 0 1 dict put +% --END ENCODER raw-- + +% --BEGIN ENCODER symbol-- +% --DESC: Miscellaneous symbols +% --EXAM: fima +/symbol { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /barcode exch def % We are given a barcode string + + barcode (fima) eq { + /sbs [2.25 2.25 2.25 11.25 2.25 11.25 2.25 2.25 2.25] def + /bhs [.625 .625 .625 .625 .625] def + /bbs [0 0 0 0 0] def + } if + + barcode (fimb) eq { + /sbs [2.25 6.75 2.25 2.25 2.25 6.25 2.25 2.25 2.25 6.75 2.25] def + /bhs [.625 .625 .625 .625 .625 .625] def + /bbs [0 0 0 0 0 0] def + } if + + barcode (fimc) eq { + /sbs [2.25 2.25 2.25 6.75 2.25 6.75 2.25 6.75 2.25 2.25 2.25] def + /bhs [.625 .625 .625 .625 .625 .625] def + /bbs [0 0 0 0 0 0] def + } if + + barcode (fimd) eq { + /sbs [2.25 2.25 2.25 2.25 2.25 6.75 2.25 6.75 2.25 2.25 2.25 2.25 2.25] def + /bhs [.625 .625 .625 .625 .625 .625 .625] def + /bbs [0 0 0 0 0 0 0] def + } if + + % Return the arguments + /retval 4 dict def + retval (sbs) sbs put + retval (bhs) bhs put + retval (bbs) bbs put + retval (opt) options put + retval + + end + +} bind def +/symbol load 0 1 dict put +% --END ENCODER symbol-- + +% --BEGIN RENDERER-- +/barcode { + + 0 begin % Confine variables to local scope + + /args exch def % We are given some arguments + + % Default options + /sbs [] def + /bhs [] def + /bbs [] def + /txt [] def + /barcolor (unset) def + /textcolor (unset) def + /bordercolor (unset) def + /backgroundcolor (unset) def + /inkspread 0.15 def + /width 0 def + /barratio 1 def + /spaceratio 1 def + /showborder false def + /borderleft 10 def + /borderright 10 def + /bordertop 1 def + /borderbottom 1 def + /borderwidth 0.5 def + /guardwhitespace false def + /guardleftpos 0 def + /guardleftypos 0 def + /guardrightpos 0 def + /guardrightypos 0 def + /guardwidth 6 def + /guardheight 7 def + + % Apply the renderer options + args {exch cvlit exch def} forall + + % Parse the user options + opt { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /barcolor barcolor cvlit def + /textcolor textcolor cvlit def + /bordercolor bordercolor cvlit def + /backgroundcolor backgroundcolor cvlit def + /inkspread inkspread cvr def + /width width cvr def + /barratio barratio cvr def + /spaceratio spaceratio cvr def + /borderleft borderleft cvr def + /borderright borderright cvr def + /bordertop bordertop cvr def + /borderbottom borderbottom cvr def + /borderwidth borderwidth cvr def + /guardleftpos guardleftpos cvr def + /guardleftypos guardleftypos cvr def + /guardrightpos guardrightpos cvr def + /guardrightypos guardrightypos cvr def + /guardwidth guardwidth cvr def + /guardheight guardheight cvr def + + % Create bar elements and put them into the bars array + /bars sbs length 1 add 2 idiv array def + /x 0.00 def /maxh 0 def + 0 1 sbs length 1 add 2 idiv 2 mul 2 sub { + /i exch def + i 2 mod 0 eq { % i is even + /d sbs i get barratio mul barratio sub 1 add def % d=digit*r-r+1 + /h bhs i 2 idiv get 72 mul def % Height from bhs + /c d 2 div x add def % Centre of the bar = x + d/2 + /y bbs i 2 idiv get 72 mul def % Baseline from bbs + /w d inkspread sub def % bar width = digit - inkspread + bars i 2 idiv [h c y w] put % Add the bar entry + h maxh gt {/maxh h def} if + } { + /d sbs i get spaceratio mul spaceratio sub 1 add def % d=digit*r-r+1 + } ifelse + /x x d add def % x+=d + } for + + gsave + + currentpoint translate + + % Force symbol to given width + width 0 ne { + width 72 mul x div 1 scale + } if + + % Display the border and background + newpath + borderleft neg borderbottom neg moveto + x borderleft add borderright add 0 rlineto + 0 maxh borderbottom add bordertop add rlineto + x borderleft add borderright add neg 0 rlineto + 0 maxh borderbottom add bordertop add neg rlineto + closepath + backgroundcolor (unset) ne { + gsave + (< >) dup 1 backgroundcolor putinterval cvx exec {255 div} forall setrgbcolor + fill + grestore + } if + showborder { + gsave + bordercolor (unset) ne { + (< >) dup 1 bordercolor putinterval cvx exec {255 div} forall setrgbcolor + } if + borderwidth setlinewidth stroke + grestore + } if + + % Display the bars for elements in the bars array + gsave + barcolor (unset) ne { + (< >) dup 1 barcolor putinterval cvx exec {255 div} forall setrgbcolor + } if + bars { + {} forall + newpath setlinewidth moveto 0 exch rlineto stroke + } forall + grestore + + % Display the text for elements in the text array + textcolor (unset) ne { + (< >) dup 1 textcolor putinterval cvx exec {255 div} forall setrgbcolor + } if + /s 0 def /f () def + txt { + {} forall + 2 copy s ne exch f ne or { + 2 copy /s exch def /f exch def + exch findfont exch scalefont setfont + } { + pop pop + } ifelse + moveto show + } forall + + % Display the guard elements + guardwhitespace { + 0.75 setlinewidth + guardleftpos 0 ne { + newpath + guardleftpos neg guardwidth add guardleftypos guardwidth 2 div add moveto + guardwidth neg guardheight -2 div rlineto + guardwidth guardheight -2 div rlineto + stroke + } if + guardrightpos 0 ne { + newpath + guardrightpos x add guardwidth sub guardrightypos guardheight 2 div add moveto + guardwidth guardheight -2 div rlineto + guardwidth neg guardheight -2 div rlineto + stroke + } if + } if + + grestore + + end + +} bind def +/barcode load 0 1 dict put +% --END RENDERER-- + +% --END TEMPLATE-- diff --git a/kbarcode/barcodecombo.cpp b/kbarcode/barcodecombo.cpp new file mode 100644 index 0000000..1aadc7d --- /dev/null +++ b/kbarcode/barcodecombo.cpp @@ -0,0 +1,341 @@ +/*************************************************************************** + barcodecombo.cpp - description + ------------------- + begin : Son Apr 13 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "barcodecombo.h" +#include "barcodedialogs.h" +#include "barkode.h" +#include "tokendialog.h" + +#include + +// Qt includes +#include +#include +#include +#include +#include +#if QT_VERSION >= 0x030100 + #include +#else + #include +#endif + +// KDE includes +#include +#include +#include +#include +#include + +BarcodeValidator::BarcodeValidator( QObject* parent, const char* name ) + : QValidator( parent, name ) +{ + m_valid = NULL; + m_notValid = NULL; +} + +bool BarcodeValidator::pcreValidate( QString* pattern, const QString & input ) const +{ + const char* error; + const int ovector_size = 12; + int erroffset; + pcre* compiled; + int ovector[ovector_size]; + int result; + + if( !pattern || input.isEmpty() ) + return true; + + if( pattern->isEmpty() ) + return true; + + compiled = pcre_compile( pattern->latin1(), 0, &error, &erroffset, NULL ); + if( !compiled ) // ignore all errors + return true; + + result = pcre_exec( compiled, NULL, input.latin1(), input.length(), 0, 0, ovector, ovector_size ); + + return (result >= 1); +} + +QValidator::State BarcodeValidator::validate( QString & input, int & pos ) const +{ + if( (!m_valid && !m_notValid) || input.isEmpty() ) + return Acceptable; + + if( (m_valid && m_valid->isEmpty()) && (m_notValid && m_notValid->isEmpty()) ) + return Acceptable; + + if( pcreValidate( m_valid, input ) && !pcreValidate( m_notValid, input ) ) + return Acceptable; + else + return Intermediate; + + return Acceptable; +} + +BarcodeCombo::BarcodeCombo(QWidget *parent, const char *name ) + : KComboBox( false, parent, name ) + +{ + this->insertStringList( *Barkode::encodingTypes() ); +} + +BarcodeCombo::~BarcodeCombo() +{ +} + +const char* BarcodeCombo::getEncodingType() +{ + return Barkode::typeFromName( currentText() ); +} + +void BarcodeCombo::setEncodingType( const QString & type ) +{ + const QString name = Barkode::nameFromType( type ); + for( unsigned int z = 0; z < (unsigned int)count(); z++ ) + if( text( z ) == name ) + { + setCurrentItem( z ); + break; + } +} + +BarcodeWidget::BarcodeWidget(QWidget *parent, const char *name ) + : QWidget( parent, name ), m_validator( this ) +{ + m_token = NULL; + + QGridLayout* grid = new QGridLayout( this, 6, 6 ); + + labelStandard = new QLabel( i18n( "&Encoding Type:" ), this ); + grid->addWidget( labelStandard, 1, 0 ); + + comboStandard = new BarcodeCombo( this, "comboStandard" ); + connect( comboStandard, SIGNAL( activated(int) ), this, SLOT( encodingChanged() ) ); + connect( comboStandard, SIGNAL( activated(int) ), this, SLOT( changed() ) ); + grid->addMultiCellWidget( comboStandard, 1, 1, 1, 3 ); + labelStandard->setBuddy( comboStandard ); + + labelData = new QLabel( i18n( "&Value:" ), this ); + grid->addWidget( labelData, 2, 0 ); + + data = new KLineEdit( this, "data" ); + + labelData->setBuddy( data ); + connect( data, SIGNAL( textChanged( const QString & ) ), this, SLOT( changed() ) ); + connect( data, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotValidateValue() ) ); + grid->addMultiCellWidget( data, 2, 2, 1, 3 ); + +#if QT_VERSION >= 0x030100 + multi = new KTextEdit( this ); +#else + multi = new QTextEdit( this ); +#endif + multi->setTextFormat( QTextEdit::PlainText ); + multi->setWordWrap( QTextEdit::NoWrap ); + multi->setEnabled( false ); + multi->setVScrollBarMode( QScrollView::AlwaysOn ); + multi->setHScrollBarMode( QScrollView::AlwaysOn ); + multi->hide(); + connect( multi, SIGNAL( textChanged() ), this, SLOT( changed() ) ); + grid->addMultiCellWidget( multi, 3, 3, 1, 3 ); + + checkText = new QCheckBox( this, "checkText" ); + checkText->setText( i18n( "&Display text" ) ); + checkText->setChecked( true ); + connect( checkText, SIGNAL( clicked() ), this, SLOT( changed() ) ); + grid->addWidget( checkText, 4, 1 ); + + buttonAdvanced = new KPushButton( i18n("&Advanced..."), this ); +// buttonAdvanced->setEnabled( false ); + grid->addWidget( buttonAdvanced, 4, 2 ); + + buttonToken = new KPushButton( i18n("&Insert Data Field..."), this ); + buttonToken->setIconSet( QIconSet( SmallIcon("contents") ) ); + grid->addWidget( buttonToken, 4, 3 ); + + spinMargin = new KIntNumInput( this, "spinMargin" ); + spinMargin->setLabel( i18n( "&Margin:" ), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + spinMargin->setRange( 0, 10000, 1, false ); + spinMargin->setValue( 10 ); + connect( spinMargin, SIGNAL( valueChanged(int) ), this, SLOT( changed() ) ); + grid->addMultiCellWidget( spinMargin, 5, 5, 0, 1 ); + + spinRotation = new KIntNumInput( this ); + spinRotation->setLabel( i18n( "&Rotation:" ), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + spinRotation->setRange( 0, 360, 90, false ); + spinRotation->setValue( 0 ); + connect( spinRotation, SIGNAL( valueChanged(int) ), this, SLOT( changed() ) ); + grid->addMultiCellWidget( spinRotation, 5, 5, 2, 3 ); + + spinScale = new KIntNumInput( spinMargin, 1000, this ); + spinScale->setLabel( i18n("&Scale (in permille):"), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + spinScale->setRange( 100, 10000, 100, false ); + spinScale->setValue( 1000 ); + connect( spinScale, SIGNAL( valueChanged(int) ), this, SLOT( changed() ) ); + grid->addMultiCellWidget( spinScale, 6, 6, 0, 1 ); + + spinCut = new KIntNumInput( spinRotation, 100, this ); + spinCut->setLabel( i18n("&Crop:"), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + spinCut->setRange( 1, 100, 1, false ); + connect( spinCut, SIGNAL( valueChanged(int) ), this, SLOT( changed() ) ); + grid->addMultiCellWidget( spinCut, 6, 6, 2, 3 ); + + connect( buttonAdvanced, SIGNAL( clicked() ), this, SLOT( advanced() ) ); + connect( buttonToken, SIGNAL( clicked() ), this, SLOT( tokens() ) ); + + m_enabledata = true; + m_multi = false; + encodingChanged(); +} + +void BarcodeWidget::getData( Barkode & barcode ) +{ + // make sure all changes are applied to the barcode + // even if not all widgets have emitted their changed SIGNAL yet + this->changed(); + + barcode = m_barcode; +} + +void BarcodeWidget::setData( const Barkode & b ) +{ + comboStandard->setEncodingType( b.type() ); + encodingChanged(); + if( !m_multi ) + data->setText( b.value() ); + else + multi->setText( b.value() ); + + checkText->setChecked( b.textVisible() ); + + spinMargin->setValue( b.quietZone() ); + spinRotation->setValue( b.rotation() ); + spinCut->setValue( int(b.cut()*100) ); + spinScale->setValue( int(b.scaling()*1000) ); + + m_barcode = b; +} + +void BarcodeWidget::setStandardEnabled( bool b ) +{ + labelStandard->setEnabled( b ); + comboStandard->setEnabled( b ); +} + +void BarcodeWidget::setDataEnabled( bool b ) +{ + labelData->setEnabled( b ); + m_enabledata = b; + encodingChanged(); +} + +void BarcodeWidget::defaults() +{ + Barkode b; // get's automatically initialized with default values + setData( b ); +} + +void BarcodeWidget::encodingChanged() +{ + QString* validator; + QString* validatorNot; + + spinCut->setEnabled( Barkode::hasFeature( comboStandard->getEncodingType(), NOCUT ) ? false : true ); + if( !spinCut->isEnabled() ) + spinCut->setValue( 100 ); // TODO: Don't hardcode + + spinScale->setEnabled( Barkode::hasFeature( comboStandard->getEncodingType(), NOSCALE ) ? false : true ); + if( !spinScale->isEnabled() ) + spinScale->setValue( 1000 ); // TODO: Don't hardcode + + checkText->setEnabled( Barkode::hasFeature( comboStandard->getEncodingType(), NOTEXT ) ? false : true ); + + if( Barkode::hasFeature( comboStandard->getEncodingType(), MULTILINE ) ) { + buttonToken->setEnabled( m_enabledata ); + multi->setEnabled( m_enabledata ); + multi->show(); + multi->setFocus(); + data->setEnabled( false ); + m_multi = true; + } else { + buttonToken->setEnabled( m_enabledata ); + data->setEnabled( m_enabledata ); + multi->hide(); + data->setFocus(); + multi->setEnabled( false ); + m_multi = false; + } + + validator = Barkode::validatorFromType( comboStandard->getEncodingType() ); + validatorNot = Barkode::validatorNotFromType( comboStandard->getEncodingType() ); + if( validator || validatorNot ) + { + m_validator.setRegExp( validator, validatorNot ); + data->setValidator( &m_validator ); + } + else + data->setValidator( NULL ); + + slotValidateValue(); +} + +void BarcodeWidget::advanced() +{ + AdvancedBarcodeDialog abd( comboStandard->getEncodingType(), this, "abd" ); + abd.setData( &m_barcode ); + if( abd.exec() == QDialog::Accepted ) + abd.getData( &m_barcode ); +} + +void BarcodeWidget::tokens() +{ + TokenDialog tokendlg( m_token, this, "tokendlg" ); + if( tokendlg.exec() == QDialog::Accepted ) + { + if( data->isEnabled() ) + data->insert( tokendlg.token() ); + else + multi->insert( tokendlg.token() ); + } +} + +void BarcodeWidget::slotValidateValue() +{ + QColor c = data->hasAcceptableInput() ? this->foregroundColor() : Qt::red; + + data->setPaletteForegroundColor( c ); +} + +void BarcodeWidget::changed() +{ + if( !m_multi ) + m_barcode.setValue( data->text() ); + else + m_barcode.setValue( multi->text() ); + + m_barcode.setType( comboStandard->getEncodingType() ); + m_barcode.setTextVisible( checkText->isChecked() ); + + m_barcode.setQuietZone( spinMargin->value() ); + m_barcode.setRotation( spinRotation->value() ); + m_barcode.setCut( (double)spinCut->value()/100.0 ); + m_barcode.setScaling( (double)spinScale->value()/1000.0 ); +} + +#include "barcodecombo.moc" diff --git a/kbarcode/barcodecombo.h b/kbarcode/barcodecombo.h new file mode 100644 index 0000000..48e1cde --- /dev/null +++ b/kbarcode/barcodecombo.h @@ -0,0 +1,144 @@ +/*************************************************************************** + barcodecombo.h - description + ------------------- + begin : Son Apr 13 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BARCODECOMBO_H +#define BARCODECOMBO_H + +#include +#include +#include + +#include "barkode.h" + +/** A validator that takes to QRegExp's to check + * wether a barcode is valid or not. + */ +class BarcodeValidator : public QValidator { + public: + BarcodeValidator( QObject* parent = 0, const char* name = 0 ); + + QValidator::State validate( QString & input, int & pos ) const; + + /** validate a given input string agains a pattern using + * Perl Compatible Regular Expressions + * \param pattern may be NULL + * \returns true if the pattern matches + */ + bool pcreValidate( QString* pattern, const QString & input ) const; + + inline void setRegExp( QString* valid, QString* notValid ) { + m_valid = valid; + m_notValid = notValid; + } + + private: + QString* m_valid; + QString* m_notValid; +}; + +/** A combobox that lists all barcode encodign types + * supported by KBarcode. + */ +class BarcodeCombo : public KComboBox { + Q_OBJECT + public: + BarcodeCombo(QWidget *parent=0, const char *name=0); + ~BarcodeCombo(); + + const char* getEncodingType(); + void setEncodingType( const QString & type ); +}; + +class KIntNumInput; +class KLineEdit; +class KPushButton; +#if QT_VERSION >= 0x030100 + class KTextEdit; +#else + class QTextEdit; +#endif +class QCheckBox; +class QLabel; + +/** This widget is used in BarCodeDialog and BarcodeSettingsDlg and + * allows the user to change the data of a barcodeData struct. This powerful + * widget is always used when the user has to change some property of + * a barcode. + * + * @see BarCodeDialog, @see BarcodeSettingsDlg + * @author Dominik Seichter + */ +class BarcodeWidget : public QWidget { + Q_OBJECT + public: + BarcodeWidget(QWidget *parent=0, const char *name=0); + ~BarcodeWidget() { } + + void getData( Barkode & barkode ); + void setData( const Barkode & b ); + + void setStandardEnabled( bool b ); + void setDataEnabled( bool b ); + + void defaults(); + + inline void setTokenProvider( TokenProvider* token ); + + private slots: + void encodingChanged(); + void advanced(); + void changed(); + void tokens(); + void slotValidateValue(); + + private: + TokenProvider* m_token; + + BarcodeCombo* comboStandard; + KLineEdit* data; + BarcodeValidator m_validator; + +#if QT_VERSION >= 0x030100 + KTextEdit* multi; +#else + QTextEdit* multi; +#endif + + KIntNumInput* spinMargin; + KIntNumInput* spinScale; + KIntNumInput* spinRotation; + KIntNumInput* spinCut; + QCheckBox* checkText; + + KPushButton* buttonAdvanced; + KPushButton* buttonToken; + + QLabel* labelStandard; + QLabel* labelData; + + bool m_enabledata; + bool m_multi; + + Barkode m_barcode; +}; + +void BarcodeWidget::setTokenProvider( TokenProvider* token ) +{ + m_token = token; +} + +#endif diff --git a/kbarcode/barcodedialog.cpp b/kbarcode/barcodedialog.cpp new file mode 100644 index 0000000..ce6f64d --- /dev/null +++ b/kbarcode/barcodedialog.cpp @@ -0,0 +1,218 @@ +/*************************************************************************** + barcodedialog.cpp - description + ------------------- + begin : Son Dez 29 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "barcodedialog.h" +#include "barcodeitem.h" +#include "printersettings.h" +#include "barcodecombo.h" +#include "mimesources.h" +#include "tokenprovider.h" + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include + +BarCodeDialog::BarCodeDialog( QWidget* parent, const char* name ) + : QDialog( parent, name, false) +{ + setCaption( i18n( "Barcode Generator" ) ); + + BarCodeDialogLayout = new QHBoxLayout( this, 11, 6, "BarCodeDialogLayout"); + Layout5 = new QVBoxLayout( 0, 0, 6, "Layout5"); + Layout6 = new QVBoxLayout( 0, 0, 6, "Layout2"); + widget = new BarcodeWidget( this, "widget" ); + + m_token = new TokenProvider( KApplication::desktop() ); + widget->setTokenProvider( m_token ); + + buttonGenerate = new KPushButton( this, "buttonGenerate" ); + buttonGenerate->setText( i18n( "&Generate" ) ); + buttonGenerate->setEnabled( Barkode::haveBarcode() ); + buttonGenerate->setIconSet( SmallIconSet("barcode") ); + + buttonSave = new KPushButton( this, "buttonSave" ); + buttonSave->setText( i18n( "&Save" ) ); + buttonSave->setEnabled( false ); + buttonSave->setIconSet( SmallIconSet("filesave") ); + + buttonCopy = new KPushButton( this, "buttonCopy" ); + buttonCopy->setText( i18n("&Copy") ); + buttonCopy->setEnabled( false ); + buttonCopy->setIconSet( SmallIconSet("editcopy") ); + + buttonPrint = new KPushButton( this ); + buttonPrint->setText( i18n("&Print") ); + buttonPrint->setEnabled( false ); + buttonPrint->setIconSet( SmallIconSet("fileprint") ); + + buttonClose = new KPushButton( this ); + buttonClose->setText( i18n("&Close" ) ); + buttonClose->setIconSet( SmallIconSet("fileclose") ); + + + QScrollView* sv = new QScrollView( this ); + + barcode = new QLabel( sv->viewport(), "barcode" ); + sv->addChild( barcode ); + connect( buttonGenerate, SIGNAL( clicked() ), this, SLOT( generate() ) ); + connect( buttonSave, SIGNAL( clicked() ), this, SLOT( save() ) ); + connect( buttonPrint, SIGNAL( clicked() ), this, SLOT( print() ) ); + connect( buttonCopy, SIGNAL( clicked() ), this, SLOT( copy() ) ); + + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + + Layout5->addWidget( buttonGenerate ); + Layout5->addWidget( buttonSave ); + Layout5->addWidget( buttonPrint ); + Layout5->addWidget( buttonCopy ); + Layout5->addItem( spacer ); + Layout5->addWidget( buttonClose ); + + Layout6->addWidget( widget ); + Layout6->addWidget( sv ); + + BarCodeDialogLayout->addLayout( Layout6 ); + BarCodeDialogLayout->addLayout( Layout5 ); + BarCodeDialogLayout->setStretchFactor( Layout6, 2 ); + + connect( buttonClose, SIGNAL( clicked() ), this, SLOT( close() ) ); + + buttonGenerate->setDefault( true ); + + show(); +} + +BarCodeDialog::~BarCodeDialog() +{ + delete m_token; +} + +void BarCodeDialog::generate() +{ + Barkode d; + widget->getData( d ); + d.setTokenProvider( m_token ); + d.update( KApplication::desktop() ); + + barcode->setPixmap( d.pixmap() ); + + buttonSave->setEnabled( !barcode->pixmap()->isNull() ); + buttonPrint->setEnabled( !barcode->pixmap()->isNull() ); + buttonCopy->setEnabled( !barcode->pixmap()->isNull() ); +} + +void BarCodeDialog::save() +{ + Barkode bc; + widget->getData( bc ); + + if(!bc.isValid()) + { + KFileDialog fd( ":save_image", KImageIO::pattern( KImageIO::Writing ), this, "fd", true ); + fd.setMode( KFile::File ); + fd.setOperationMode( KFileDialog::Saving ); + if( fd.exec() == QDialog::Accepted ) + { + QString path = fd.selectedURL().path(); + QString extension = KImageIO::type( path ); + + if( extension.isNull() ) + extension = KImageIO::type( fd.currentFilter() ); + + + bc.setTokenProvider( m_token ); + bc.update( KApplication::desktop() ); + + if(!bc.pixmap().save( path, extension, 0 )) + KMessageBox::error( this, i18n("An error occurred during saving the image") ); + } + } +} + +void BarCodeDialog::print() +{ + Barkode d; + widget->getData( d ); + + if( d.isValid() ) + return; + + KPrinter* printer = PrinterSettings::getInstance()->setupPrinter( "kbarcode", this ); + if( !printer ) + return; + + // unless we can center the barcode + printer->setFullPage( false ); + + QPaintDeviceMetrics metrics( printer ); + + double scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX(); + double scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY(); + + QPicture picture; + QPainter p( printer ); + p.scale( scalex, scaley ); + // TODO: center barcode + + TokenProvider tp( printer ); + + d.setTokenProvider( &tp ); + d.update( printer ); + + picture = d.picture(); + p.drawPicture( QPoint( 0, 0 ), picture ); + p.end(); + + delete printer; +} + +void BarCodeDialog::copy() +{ + if( barcode->pixmap()->isNull() ) + return; + + Barkode bc; + widget->getData( bc ); + + BarcodeItem* item = new BarcodeItem( bc ); + DocumentItemList list; + list.append( item ); + DocumentItemDrag* drag = new DocumentItemDrag(); + drag->setDocumentItem( &list ); + +#if QT_VERSION >= 0x030100 + kapp->clipboard()->setData( drag, QClipboard::Clipboard ); +#else + kapp->clipboard()->setData( drag ); +#endif +} + +#include "barcodedialog.moc" diff --git a/kbarcode/barcodedialog.h b/kbarcode/barcodedialog.h new file mode 100644 index 0000000..9490467 --- /dev/null +++ b/kbarcode/barcodedialog.h @@ -0,0 +1,79 @@ +/*************************************************************************** + barcodedialog.h - description + ------------------- + begin : Son Dez 29 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BARCODEDIALOG_H +#define BARCODEDIALOG_H + +#include + +class BarcodeCombo; +class BarcodeWidget; +class KAction; +class KColorButton; +class KMenuBar; +class KToolBar; +class KIntNumInput; +class KLineEdit; +class KPushButton; +class KPopupMenu; +class QCheckBox; +class QLabel; +class QPixmap; +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class TokenProvider; + +/** This class provides a dialog, where the user can create a single barcode + * and print it, copy it to the clipboard or save it in various image formats. + * This dialog can also be seen as a powerful replacement for e.g. xbarcode. + * + * All barcoding features are available for the user. This dialog allows also + * to just experiment a little bit with barcodes. + */ +class BarCodeDialog : public QDialog +{ + Q_OBJECT + + public: + BarCodeDialog( QWidget* parent = 0, const char* name = 0 ); + ~BarCodeDialog(); + + private: + BarcodeWidget* widget; + TokenProvider* m_token; + + KPushButton* buttonGenerate; + KPushButton* buttonPrint; + KPushButton* buttonSave; + KPushButton* buttonCopy; + KPushButton* buttonClose; + QLabel* barcode; + + private slots: + void generate(); + void save(); + void print(); + void copy(); + + protected: + QHBoxLayout* BarCodeDialogLayout; + QVBoxLayout* Layout6; + QVBoxLayout* Layout5; +}; + +#endif // BARCODEDIALOG_H diff --git a/kbarcode/barcodedialogs.cpp b/kbarcode/barcodedialogs.cpp new file mode 100644 index 0000000..28639a4 --- /dev/null +++ b/kbarcode/barcodedialogs.cpp @@ -0,0 +1,506 @@ +/*************************************************************************** + barcodedialogs.cpp - description + ------------------- + begin : Fre Sep 5 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "barcodedialogs.h" +#include "barkode.h" +#include "purepostscript.h" +#include "tbarcode2.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include + + +AdvancedBarcodeDialog::AdvancedBarcodeDialog( QString type, QWidget* parent, const char* name ) + : KDialogBase( KDialogBase::Tabbed, i18n("Barcode Settings"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent,name) +{ + list.setAutoDelete( false ); + + if( Barkode::hasFeature( type, PDF417BARCODE ) ) { + QVBox* box = addVBoxPage( i18n("PDF417") ); + PDF417BarcodeDlg* dlg = new PDF417BarcodeDlg( box ); + list.append( (BarcodeDlgBase*)dlg ); + } + + if( Barkode::hasFeature( type, DATAMATRIX ) ) { + QVBox* box = addVBoxPage( i18n("DataMatrix") ); + DataMatrixDlg* dlg = new DataMatrixDlg( box ); + list.append( (BarcodeDlgBase*)dlg ); + } + + if( Barkode::hasFeature( type, TBARCODEADV ) ) { + QVBox* box = addVBoxPage( i18n("TBarcode") ); + TBarcodeDlg* dlg = new TBarcodeDlg( box ); + list.append( (BarcodeDlgBase*)dlg ); + } + + if( Barkode::hasFeature( type, PUREADV ) ) { + QVBox* box = addVBoxPage( i18n("Barcode Writer in Pure Postscript") ); + PurePostscriptDlg* dlg = new PurePostscriptDlg( box ); + list.append( (BarcodeDlgBase*)dlg ); + } + + if( Barkode::hasFeature( type, COLORED ) ) { + QVBox* box = addVBoxPage( i18n("Colors") ); + ColorDlg* dlg = new ColorDlg( box ); + list.append( (BarcodeDlgBase*)dlg ); + } + + QVBox* box = addVBoxPage( i18n("Sequence") ); + SequenceDlg* dlg = new SequenceDlg( box ); + list.append( (BarcodeDlgBase*)dlg ); +} + +AdvancedBarcodeDialog::~AdvancedBarcodeDialog() +{ +} + +void AdvancedBarcodeDialog::setData( Barkode* b ) +{ + for( unsigned int i = 0; i < list.count(); i++ ) { + BarcodeDlgBase* bdb = list.at( i ); + bdb->setData( b ); + } +} + +void AdvancedBarcodeDialog::getData( Barkode* b ) +{ + for( unsigned int i = 0; i < list.count(); i++ ) { + BarcodeDlgBase* bdb = list.at( i ); + bdb->getData( b ); + } +} + +TBarcodeDlg::TBarcodeDlg(QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + QVBoxLayout* layout = new QVBoxLayout( this, 6, 6 ); + + QGroupBox* gb = new QGroupBox( i18n("TBarcode"), this ); + gb->setColumnLayout(0, Qt::Vertical ); + gb->layout()->setSpacing( 6 ); + gb->layout()->setMargin( 11 ); + gb->setEnabled( Barkode::haveTBarcode() || Barkode::haveTBarcode2() ); + QVBoxLayout* gbLayout = new QVBoxLayout( gb->layout() ); + + spinModule = new KDoubleNumInput( gb ); + spinModule->setLabel( i18n("Module width (mm):"), AlignLeft | AlignVCenter ); + spinModule->setRange( 0.190, 1.500, 0.001, true ); + + spinHeight = new KIntNumInput( gb ); + spinHeight->setLabel( i18n("Barcode Height (mm):"), AlignLeft | AlignVCenter ); + spinHeight->setRange( 1, 1000, 10, false ); + + checkEscape = new QCheckBox( i18n("&Translate escape sequences"), gb ); + checkAbove = new QCheckBox( i18n("&Text above barcode"), gb ); + checkAutoCorrect = new QCheckBox( i18n("&Auto correction"), gb ); + + comboCheckSum = new KComboBox( false, gb ); + + QLabel* label = new QLabel( i18n("&Checksum calculation method:"), gb ); + label->setBuddy( comboCheckSum ); + + QHBoxLayout * hbox = new QHBoxLayout( 0, 6, 6 ); + hbox->addWidget( label ); + hbox->addWidget( comboCheckSum ); + + gbLayout->addWidget( spinModule ); + gbLayout->addWidget( spinHeight ); + gbLayout->addWidget( checkEscape ); + gbLayout->addWidget( checkAbove ); + gbLayout->addWidget( checkAutoCorrect ); + gbLayout->addLayout( hbox ); + + QToolTip::add( spinModule, i18n("Change the module with used by tbarcode. Take a look into the " + "tbarcode documentation for details. Normaly you do not want to change " + "this value.") ); + + layout->addWidget( gb ); +} + +void TBarcodeDlg::setData( Barkode* b ) +{ + TBarcodeOptions* options = dynamic_cast( b->engine()->options() ); + + if( options ) + { + spinModule->setValue( options->moduleWidth() ); + spinHeight->setValue( options->height() ); + checkEscape->setChecked( options->escape() ); + checkAbove->setChecked( options->above() ); + checkAutoCorrect->setChecked( options->autocorrect() ); + + map.insert( i18n("No Checksum"), 0 ); + map.insert( i18n("Default Checksum Method"), 1 ); + + if( Barkode::hasFeature( b->type(), MODULOALLCHECK ) || + Barkode::hasFeature( b->type(), MODULO10CHECK ) ) + map.insert( i18n("Modulo 10 Checksum"), 2 ); + + if( Barkode::hasFeature( b->type(), MODULOALLCHECK ) || + b->type() == "b13" || // EAN 13 + b->type() == "b14" || // EAN 13 + b->type() == "b15" || // EAN 13 + b->type() == "b18" ) // CodaBar (2 width) + map.insert( i18n("Module 43 (suggested for Code39 and Logmars, 1 digit)"), 3 ); + + if( Barkode::hasFeature( b->type(), MODULOALLCHECK ) ) + map.insert( i18n("Modula 47 (2 digits)"), 4 ); + + if( b->type() == "b21" ) // Deutsche Post Leitcode + map.insert( i18n("Deutsche Post Leitcode"), 5 ); + + if( b->type() == "b22") // Deutsche Post Identcode + map.insert( i18n("Deutsche Post Identcode"), 6 ); + + if( b->type() == "b1" ) { // Code11 + map.insert( i18n("Code 11 (1 digit)"), 7 ); + map.insert( i18n("Code 11 (2 digits)"), 8 ); + } + + if( Barkode::hasFeature( b->type(), POSTNETCHECK ) ) + map.insert( i18n("USPS Postnet"), 9 ); + + if( b->type() == "b47" ) { // MSI + map.insert( i18n("MSI (1 digit)"), 10 ); + map.insert( i18n("MSI (2 digits)"), 11 ); + } + + if( b->type() == "b46" ) // Plessey + map.insert( i18n("Plessey"), 12 ); + + if( Barkode::hasFeature( b->type(), EAN8CHECK ) ) + map.insert( i18n("EAN 8"), 13 ); + + if( Barkode::hasFeature( b->type(), EAN13CHECK ) ) + map.insert( i18n("EAN 13"), 14 ); + + if( Barkode::hasFeature( b->type(), UPCACHECK ) ) + map.insert( i18n("UPC A"), 15 ); + + if( Barkode::hasFeature( b->type(), UPCECHECK ) ) + map.insert( i18n("UPC E"), 16 ); + + if( b->type() == "b16" ) // EAN 128 + map.insert( i18n("EAN 128"), 17 ); + + if( Barkode::hasFeature( b->type(), CODE128CHECK ) ) + map.insert( i18n("Code 128"), 18 ); + + if( b->type() == "b70" ) // Royal Mail 4 State + map.insert( i18n("Royal Mail 4 State"), 19 ); + + comboCheckSum->insertStringList( map.keys() ); + + QMap::Iterator it; + for ( it = map.begin(); it != map.end(); ++it ) { + if( it.data() == options->checksum() ) { + for( int i = 0; i < comboCheckSum->count(); i++ ) + if( comboCheckSum->text( i ) == it.key() ) { + comboCheckSum->setCurrentItem( i ); + break; + } + break; + } + } + } +} + +void TBarcodeDlg::getData( Barkode* b ) const +{ + TBarcodeOptions* options = dynamic_cast( b->engine()->options() ); + + if( options ) + { + options->setModuleWidth( spinModule->value() ); + options->setEscape( checkEscape->isChecked() ); + options->setAbove( checkAbove->isChecked() ); + options->setAutocorrect( checkAutoCorrect->isChecked() ); + options->setCheckSum( map[comboCheckSum->currentText()] ); + options->setHeight( spinHeight->value() ); + } +} + +PDF417BarcodeDlg::PDF417BarcodeDlg(QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + QVBoxLayout* layout = new QVBoxLayout( this, 6, 6 ); + + QGroupBox* gpdf = new QGroupBox( i18n("PDF417"), this ); + gpdf->setColumnLayout(0, Qt::Vertical ); + gpdf->layout()->setSpacing( 6 ); + gpdf->layout()->setMargin( 11 ); + gpdf->setEnabled( Barkode::haveTBarcode() || Barkode::havePDFBarcode() ); + QVBoxLayout* gpdfLayout = new QVBoxLayout( gpdf->layout() ); + + spinRow = new KIntNumInput( gpdf ); + spinRow->setLabel( i18n("Rows:"), AlignLeft | AlignVCenter ); + spinRow->setRange( 0, 90, 1, true ); + + spinCol = new KIntNumInput( spinRow, 0, gpdf ); + spinCol->setLabel( i18n("Columns:"), AlignLeft | AlignVCenter ); + spinCol->setRange( 0, 30, 1, true ); + + spinErr = new KIntNumInput( spinCol, 0, gpdf ); + spinErr->setLabel( i18n("Error correction level:"), AlignLeft | AlignVCenter ); + spinErr->setRange( 1, 8, 1, true ); + + gpdfLayout->addWidget( spinRow ); + gpdfLayout->addWidget( spinCol ); + gpdfLayout->addWidget( spinErr ); + layout->addWidget( gpdf ); +} + +void PDF417BarcodeDlg::setData( Barkode* b ) +{ + PDF417Options* options = dynamic_cast( b->engine()->options() ); + + if( options ) + { + spinRow->setValue( options->row() ); + spinCol->setValue( options->col() ); + spinErr->setValue( options->err() ); + } +} + +void PDF417BarcodeDlg::getData( Barkode* b ) const +{ + PDF417Options* options = dynamic_cast( b->engine()->options() ); + + if( options ) + { + options->setRow( spinRow->value() ); + options->setCol( spinCol->value() ); + options->setErr( spinErr->value() ); + } +} + +DataMatrixDlg::DataMatrixDlg(QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + QHBoxLayout* datamLayout = new QHBoxLayout( this, 6, 6 ); + + comboDataMatrix = new KComboBox( false, this ); + + datamLayout->addWidget( new QLabel( i18n("Data Matrix symbol sizes (rows x cols):"), this ) ); + datamLayout->addWidget( comboDataMatrix ); + datamLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + + comboDataMatrix->insertItem( i18n("Automatic calculation" ) ); + comboDataMatrix->insertItem( "10 x 10" ); + comboDataMatrix->insertItem( "12 x 12" ); + comboDataMatrix->insertItem( "14 x 14" ); + comboDataMatrix->insertItem( "16 x 16" ); + comboDataMatrix->insertItem( "18 x 18" ); + comboDataMatrix->insertItem( "20 x 20" ); + comboDataMatrix->insertItem( "22 x 22" ); + comboDataMatrix->insertItem( "24 x 24" ); + comboDataMatrix->insertItem( "26 x 26" ); + comboDataMatrix->insertItem( "32 x 32" ); + comboDataMatrix->insertItem( "36 x 36" ); + comboDataMatrix->insertItem( "40 x 40" ); + comboDataMatrix->insertItem( "44 x 44" ); + comboDataMatrix->insertItem( "48 x 48" ); + comboDataMatrix->insertItem( "52 x 52" ); + comboDataMatrix->insertItem( "64 x 64" ); + comboDataMatrix->insertItem( "72 x 72" ); + comboDataMatrix->insertItem( "80 x 80" ); + comboDataMatrix->insertItem( "88 x 88" ); + comboDataMatrix->insertItem( "96 x 96" ); + comboDataMatrix->insertItem( "104 x 104" ); + comboDataMatrix->insertItem( "120 x 120" ); + comboDataMatrix->insertItem( "132 x 132" ); + comboDataMatrix->insertItem( "144 x 144" ); + comboDataMatrix->insertItem( "8 x 18" ); + comboDataMatrix->insertItem( "8 x 32" ); + comboDataMatrix->insertItem( "12 x 26" ); + comboDataMatrix->insertItem( "12 x 36" ); + comboDataMatrix->insertItem( "16 x 36" ); + comboDataMatrix->insertItem( "16 x 48" ); +} + +void DataMatrixDlg::setData( Barkode* b ) +{ + comboDataMatrix->setCurrentItem( b->datamatrixSize()); +} + +void DataMatrixDlg::getData( Barkode* b ) const +{ + b->setDatamatrixSize( comboDataMatrix->currentItem() ); +} + +SequenceDlg::SequenceDlg( QWidget *parent, const char *name ) + : QWidget( parent, name ) +{ + QVBoxLayout* main = new QVBoxLayout( this, 6, 6 ); + + QButtonGroup* group = new QButtonGroup( i18n("Sequence"), this ); + group->setColumnLayout(0, Qt::Vertical ); + group->layout()->setSpacing( 6 ); + group->layout()->setMargin( 11 ); + QVBoxLayout* layout = new QVBoxLayout( group->layout() ); + + checkSequence = new QCheckBox( i18n("&Enable sequence"), group ); + + radioNumbers = new QRadioButton( i18n("Iterate over numbers 0-9"), group ); + radioAlpha = new QRadioButton( i18n("Iterate over characters A-Z"), group ); + radioAlphaNum = new QRadioButton( i18n("Iterate over A-Z, 0-9"), group ); + + spinStep = new KIntNumInput( group ); + spinStep->setLabel( i18n("Step:"), AlignLeft | AlignVCenter ); + spinStep->setRange( -100, 100, 1, false ); + + spinStart = new KIntNumInput( spinStep, 1, group ); + spinStart->setLabel( i18n("Start:"), AlignLeft | AlignVCenter ); + spinStart->setRange( -100000, 100000, 1, false ); + + layout->addWidget( checkSequence ); + layout->addWidget( radioNumbers ); + layout->addWidget( radioAlpha ); + layout->addWidget( radioAlphaNum ); + layout->addWidget( spinStep ); + layout->addWidget( spinStart ); + + main->addWidget( group ); + + connect( checkSequence, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioNumbers, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioAlpha, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioAlphaNum, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); +} + +void SequenceDlg::setData( Barkode* b ) +{ + checkSequence->setChecked( b->sequenceEnabled() ); + spinStep->setValue( b->sequenceStep() ); + spinStart->setValue( b->sequenceStart() ); + + if( b->sequenceMode() == NUM ) + radioNumbers->setChecked( true ); + else if( b->sequenceMode() == ALPHA ) + radioAlpha->setChecked( true ); + else if( b->sequenceMode() == ALPHANUM ) + radioAlphaNum->setChecked( true ); + + enableControls(); +} + +void SequenceDlg::getData( Barkode* b ) const +{ + b->setSequenceEnabled( checkSequence->isChecked() ); + + b->setSequenceStep( spinStep->value() ); + b->setSequenceStart( spinStart->value() ); + + if( radioNumbers->isChecked() ) + b->setSequenceMode( NUM ); + else if( radioAlpha->isChecked() ) + b->setSequenceMode( ALPHA ); + else if( radioAlphaNum->isChecked() ) + b->setSequenceMode( ALPHANUM ); +} + +void SequenceDlg::enableControls() +{ + radioNumbers->setEnabled( checkSequence->isChecked() ); + radioAlpha->setEnabled( checkSequence->isChecked() ); + radioAlphaNum->setEnabled( false ); //checkSequence->isChecked() ); + spinStep->setEnabled( checkSequence->isChecked() ); + spinStart->setEnabled( checkSequence->isChecked() && radioNumbers->isChecked() ); +} + +ColorDlg::ColorDlg(QWidget *parent, const char *name) + : QVBox( parent, name ) +{ + QGroupBox* gb = new QGroupBox( i18n("Colors"), this ); + gb->setColumnLayout(0, Qt::Vertical ); + gb->layout()->setSpacing( 6 ); + gb->layout()->setMargin( 11 ); + gb->setEnabled( Barkode::havePurePostscriptBarcode() ); + QGridLayout* gbLayout = new QGridLayout( gb->layout() ); + + buttonBarColor = new KColorButton( gb ); + buttonBackColor = new KColorButton( gb ); + buttonTextColor = new KColorButton( gb ); + + gbLayout->addWidget( new QLabel( i18n("Bar Color:"), gb ), 0, 0 ); + gbLayout->addWidget( new QLabel( i18n("Background Color:"), gb ), 1, 0 ); + gbLayout->addWidget( new QLabel( i18n("Text Color:"), gb ), 2, 0 ); + gbLayout->addWidget( buttonBarColor, 0, 1 ); + gbLayout->addWidget( buttonBackColor, 1, 1 ); + gbLayout->addWidget( buttonTextColor, 2, 1 ); +} + +void ColorDlg::setData( Barkode* b ) +{ + buttonBarColor->setColor( b->foreground() ); + buttonBackColor->setColor( b->background() ); + buttonTextColor->setColor( b->textColor() ); +} + +void ColorDlg::getData( Barkode* b ) const +{ + b->setForeground( buttonBarColor->color() ); + b->setBackground( buttonBackColor->color() ); + b->setTextColor( buttonTextColor->color() ); +} + +PurePostscriptDlg::PurePostscriptDlg(QWidget *parent, const char *name) + : QVBox( parent, name ) +{ + QVGroupBox* gb = new QVGroupBox( i18n("Barcode Writer in Pure Postscript"), this ); + gb->setEnabled( Barkode::havePurePostscriptBarcode() ); + + checkChecksum = new QCheckBox( i18n("Enable &Checksum"), gb ); +} + +void PurePostscriptDlg::setData( Barkode* b ) +{ + PurePostscriptOptions* options = dynamic_cast( b->engine()->options() ); + + if( options ) + { + checkChecksum->setChecked( options->checksum() ); + checkChecksum->setEnabled( Barkode::hasFeature( b->type(), MODULOALLCHECK ) ); + } +} + +void PurePostscriptDlg::getData( Barkode* b ) const +{ + PurePostscriptOptions* options = dynamic_cast( b->engine()->options() ); + + if( options ) + options->setChecksum( checkChecksum->isChecked() ); +} + + +#include "barcodedialogs.moc" diff --git a/kbarcode/barcodedialogs.h b/kbarcode/barcodedialogs.h new file mode 100644 index 0000000..56e3a58 --- /dev/null +++ b/kbarcode/barcodedialogs.h @@ -0,0 +1,180 @@ +/*************************************************************************** + barcodedialogs.h - description + ------------------- + begin : Fre Sep 5 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BARCODEDIALOGS_H +#define BARCODEDIALOGS_H + +#include +#include +#include +#include +#include + +class Barkode; +class KColorButton; +class KComboBox; +class KDoubleNumInput; +class KIntNumInput; +class QCheckBox; +class QRadioButton; + +/** A base class for all widgets, that will be used in AdvancedBarcodeDialog + * to modify the settings of a barcode. The API is simple. You can only set the + * current barcode settings and retrieve them after the user modified them. + * + * @author Dominik Seichter + */ +class BarcodeDlgBase { + public: + virtual void setData( Barkode* b ) = 0; + virtual void getData( Barkode* b ) const = 0; +}; + +/** + * A configuration dialog for advanced barcode settings. + * Used in BarcodeWidget. It loads the wigets below into tabs. + * @see TBarcodeDlg + * @see PDF417BarcodeDlg + * @see DataMatrixDlg + * @seeSequenceDlg + * + * @author Dominik Seichter + */ +class AdvancedBarcodeDialog : public KDialogBase { + Q_OBJECT + public: + AdvancedBarcodeDialog( QString type, QWidget* parent = 0, const char* name = 0 ); + ~AdvancedBarcodeDialog(); + + void setData( Barkode* b ); + void getData( Barkode* b ); + + private: + QPtrList list; +}; + +/** A configuration widget for TBarcode settings. + * @author Dominik Seichter + */ +class TBarcodeDlg : public QWidget, public BarcodeDlgBase { + Q_OBJECT + public: + TBarcodeDlg(QWidget *parent=0, const char *name=0); + + void setData( Barkode* b ); + void getData( Barkode* b ) const; + + private: + KDoubleNumInput* spinModule; + KIntNumInput* spinHeight; + QCheckBox* checkEscape; + QCheckBox* checkAbove; + QCheckBox* checkAutoCorrect; + KComboBox* comboCheckSum; + + QMap map; +}; + +/** A configuration Dialog for PDF417 settings. + * @author Dominik Seichter + */ +class PDF417BarcodeDlg : public QWidget, public BarcodeDlgBase { + Q_OBJECT + public: + PDF417BarcodeDlg(QWidget *parent=0, const char *name=0); + + void setData( Barkode* b ); + void getData( Barkode* b ) const; + + private: + KIntNumInput* spinRow; + KIntNumInput* spinCol; + KIntNumInput* spinErr; +}; + +/** A configuration widget for DataMatrix settings. + * @author Dominik Seichter + */ +class DataMatrixDlg : public QWidget, public BarcodeDlgBase { + Q_OBJECT + public: + DataMatrixDlg(QWidget *parent=0, const char *name=0); + + void setData( Barkode* b ); + void getData( Barkode* b ) const; + + private: + KComboBox* comboDataMatrix; +}; + +/** A configuration widget for barcode sequences. + * @author Dominik Seichter + */ +class SequenceDlg : public QWidget, public BarcodeDlgBase { + Q_OBJECT + public: + SequenceDlg(QWidget *parent=0, const char *name=0); + + void setData( Barkode* b ); + void getData( Barkode* b ) const; + + private slots: + void enableControls(); + + private: + QCheckBox* checkSequence; + QRadioButton* radioNumbers; + QRadioButton* radioAlpha; + QRadioButton* radioAlphaNum; + + KIntNumInput* spinStep; + KIntNumInput* spinStart; +}; + +/** A configuration widget for colors in pure postscript barcodes + * @author Dominik Seichter + */ +class ColorDlg : public QVBox, public BarcodeDlgBase { + Q_OBJECT + public: + ColorDlg(QWidget *parent=0, const char *name=0); + + void setData( Barkode* b ); + void getData( Barkode* b ) const; + + private: + KColorButton* buttonBarColor; + KColorButton* buttonBackColor; + KColorButton* buttonTextColor; +}; + +/** A configuration widget for colors in pure postscript barcodes + * @author Dominik Seichter + */ +class PurePostscriptDlg : public QVBox, public BarcodeDlgBase { + Q_OBJECT + public: + PurePostscriptDlg(QWidget *parent=0, const char *name=0); + + void setData( Barkode* b ); + void getData( Barkode* b ) const; + + private: + QCheckBox* checkChecksum; +}; + +#endif diff --git a/kbarcode/barcodeitem.cpp b/kbarcode/barcodeitem.cpp new file mode 100644 index 0000000..f2fbe4c --- /dev/null +++ b/kbarcode/barcodeitem.cpp @@ -0,0 +1,253 @@ +/*************************************************************************** + barcodeitem.cpp - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "barcodeitem.h" +#include "tcanvasitem.h" + +#include +#include +#include + +BarcodeItem::BarcodeItem() + : Barkode(), DocumentItem() +{ + init(); +} + +BarcodeItem::BarcodeItem( const Barkode & bcode ) + : Barkode( bcode ), DocumentItem() +{ + init(); +} + +QMap BarcodeItem::legacy; + +void BarcodeItem::init() +{ + // read barcodes saved by kbarcode < 1.3.0 + /* + // disable legacy code as it is really old + // and conflicts with tbarcode2 support + + if( !legacy.count() ) { + legacy.insert( "0", "any" ); + legacy.insert( "1", "ean" ); + legacy.insert( "2", "upc" ); + legacy.insert( "3", "isbn" ); + legacy.insert( "4", "code39" ); + legacy.insert( "5", "code128" ); + legacy.insert( "6", "code128c" ); + legacy.insert( "7", "code128b" ); + legacy.insert( "8", "i25" ); + legacy.insert( "9", "i28raw" ); + legacy.insert( "10", "cbr" ); + legacy.insert( "11", "msi" ); + legacy.insert( "12", "pls" ); + legacy.insert( "13", "code93" ); + legacy.insert( "14", "msi" ); + legacy.insert( "15", "code39 -c" ); + legacy.insert( "16", "i25 -c" ); + } + */ + setBorder( false ); + setRect( QRect( 0, 0, 100, 100 ) ); + + updateBarcode(); +} + +void BarcodeItem::loadXML (QDomElement* element) +{ + // TODO: default() should be called first and the current values should be used + // instead of the now hardcoded values + // i.e: setQuietZone( element->attribute("margin", QString::number( quietZone() ) ).toInt() ); + + setQuietZone( element->attribute("margin", "10" ).toInt() ); + setRotation( element->attribute("rotation", "0" ).toInt() ); + setScaling( element->attribute("scale", "1000" ).toDouble() / 1000 ); + setCut( element->attribute("cut", "1.0" ).toDouble() ); + setType( element->attribute("type", "code39" ) ); + + /* + * check for encoding types saved by kbarcode <= 1.2.0 + */ + if( legacy.contains( type() ) ) + setType( legacy[type()] ); + + setTextVisible( element->attribute("text", "0" ).toInt() ); + setDatabaseMode( element->attribute("caption", "Static" ) ); + + if( engine()->options() ) + engine()->options()->load( element ); + + setDatamatrixSize( element->attribute( "datamatrix.size", "0" ).toInt() ); + + setSequenceEnabled( element->attribute( "sequenceenabled", "0" ).toInt() ); + if( sequenceEnabled() ) + { + setSequenceMode( (ESequence)element->attribute( "sequencemode", "0" ).toInt() ); + setSequenceStep( element->attribute( "sequencestep", "1" ).toInt() ); + setSequenceStart( element->attribute( "sequencestart", "0" ).toInt() ); + } + + QDomNode n = element->firstChild(); + while( !n.isNull() ) { + QDomElement e = n.toElement(); // try to convert the node to an element. + if( !e.isNull() ) + if( e.tagName() == "value" ) + setValue( e.text() ); + + n = n.nextSibling(); + } + + DocumentItem::loadXML( element ); + + updateBarcode(); +} + +void BarcodeItem::saveXML (QDomElement* element) +{ + element->setAttribute( "margin", quietZone() ); + element->setAttribute( "rotation", rotation() ); + element->setAttribute( "cut", cut() ); + element->setAttribute( "caption", databaseMode() ); + + /* + * This values are only needed for !cache and for sequences + */ + element->setAttribute( "sequenceenabled", sequenceEnabled() ); + if( sequenceEnabled() ) + { + element->setAttribute( "sequencemode", (int)sequenceMode() ); + element->setAttribute( "sequencestep", sequenceStep() ); + element->setAttribute( "sequencestart", sequenceStart() ); + } + + element->setAttribute( "type", type() ); + element->setAttribute( "text", textVisible() ); + element->setAttribute( "scale", scaling()*1000 ); + + if( engine()->options() ) + engine()->options()->save( element ); + + element->setAttribute( "datamatrix.size", datamatrixSize() ); + + QDomElement texttag = element->ownerDocument().createElement( "value" ); + texttag.appendChild( element->ownerDocument().createTextNode( value() ) ); + + element->appendChild( texttag ); + + DocumentItem::saveXML( element ); +} + +void BarcodeItem::draw (QPainter* painter) +{ + if( DocumentItem::paintDevice() && DocumentItem::paintDevice()->isExtDev() ) + { + painter->save(); + + /* + QPaintDeviceMetrics metrics( DocumentItem::paintDevice() ); + double scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX(); + double scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY(); + painter->scale( 1.0 / scalex, 1.0 / scaley ); + */ + + //painter->drawPixmap( rect().x(), rect().y(), m_pixmap ); + drawBarcode( *painter, rect().x(), rect().y() ); + painter->restore(); + } + else + { + painter->save(); + drawBarcode( *painter, rect().x(), rect().y() ); + painter->restore(); + + TCanvasItem* citem = canvasItem(); + if( citem ) + { + citem->setSize( Barkode::size().width(), Barkode::size().height() ); + } + // TODO: do a bitBlt when device is screen + //painter->drawPixmap( rect().x(), rect().y(), m_pixmap ); + //bitBlt( painter->device(), rect().x(), rect().y(), &m_pixmap, 0, 0, rect().width(), rect().height(), Qt::CopyROP ); + } + DocumentItem::drawBorder( painter ); +} + +void BarcodeItem::drawZpl( QTextStream* stream ) +{ + QString encoding = ZPLUtils::encoding( type() ); + if( encoding.isNull() ) + { + qDebug( "ERROR: No ZPL barcode found"); + return; + } + + *stream << ZPLUtils::fieldOrigin( rect().x(), rect().y() ); + *stream << "^B" << encoding; + *stream << ZPLUtils::fieldData( value() ); +} + +void BarcodeItem::drawIpl( QTextStream* stream, IPLUtils* utils ) +{ + QString encoding = utils->encoding( type() ); + + if( encoding.isEmpty() ) + { + qDebug( "ERROR: No IPL barcode found"); + return; + } + + int counter = utils->counter(); + QString s = QString("B%1;").arg( counter ); // field number + + s += utils->fieldOrigin( rect().x(), rect().y() ); + s += QString("c%1;").arg( encoding ); // encoding type + s += QString("h%1;").arg( rect().height() ); // height of barcode + s += QString("w%1;").arg( 3 ); // width of barcode (per line) + s += QString("d0,%1;").arg( value().length() ); // max length of data + + *stream << utils->field( s ); + utils->addValue( value() ); +} + +void BarcodeItem::drawEPcl( QTextStream* stream ) +{ + QString encoding = EPCLUtils::encoding( type() ); + if( encoding.isEmpty() ) + { + qDebug( "ERROR: No EPCL barcode found"); + return; + } + + // Coordinates cannot start at zero + QString s = QString("B %1").arg( rect().x()+1 ); + s += QString(" %1 0").arg( rect().y() + rect().height() ); + s += QString(" %1 1 4").arg( encoding ); + s += QString(" %1 1").arg( rect().height() ); + s += QString(" %1").arg( value() ); + + *stream << EPCLUtils::field( s ); +} + +void BarcodeItem::updateBarcode() +{ + Barkode::setTokenProvider( tokenProvider() ); + Barkode::update( DocumentItem::paintDevice() ); + setSize( Barkode::size().width(), Barkode::size().height() ); +} + diff --git a/kbarcode/barcodeitem.h b/kbarcode/barcodeitem.h new file mode 100644 index 0000000..0faafc2 --- /dev/null +++ b/kbarcode/barcodeitem.h @@ -0,0 +1,57 @@ +/*************************************************************************** + barcodeitem.h - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef BARCODEITEM_H +#define BARCODEITEM_H + +#include +#include + +#include "barkode.h" +#include "gnubarcode.h" +#include "documentitem.h" + +/** + * Class BarcodeItem + * A barcode on the screen or printer. + */ +class BarcodeItem : public Barkode, public DocumentItem { +public: + BarcodeItem(); + BarcodeItem( const Barkode & bcode ); + + void updateBarcode(); + + int rtti() const { return eRtti_Barcode;} + + void loadXML (QDomElement* element); + void saveXML (QDomElement* element); + void draw (QPainter* painter); + void drawZpl( QTextStream* stream ); + void drawIpl( QTextStream* stream, IPLUtils* utils ); + void drawEPcl( QTextStream* stream ); + +private: + void init(); + +private: + static QMap legacy; + + QPixmap m_pixmap; +}; +#endif //BARCODEITEM_H + diff --git a/kbarcode/barcodeprinterdlg.cpp b/kbarcode/barcodeprinterdlg.cpp new file mode 100644 index 0000000..3488a97 --- /dev/null +++ b/kbarcode/barcodeprinterdlg.cpp @@ -0,0 +1,125 @@ +/*************************************************************************** + barcodeprinterdlg.cpp - description + ------------------- + begin : Fri Oct 01 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "barcodeprinterdlg.h" +#include "printersettings.h" + +#include +#include +#include + +#include +#include +#include +#include + +BarcodePrinterDlg::BarcodePrinterDlg(QWidget *parent, const char *name) + : KDialogBase( KDialogBase::Plain, i18n("Barcode Printer"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent,name) +{ + QGridLayout* layout = new QGridLayout( plainPage(), 6, 6 ); + + QLabel* label = new QLabel( i18n("&Output Format:"), plainPage() ); + comboFormat = new KComboBox( false, plainPage() ); + label->setBuddy( comboFormat ); + + checkFile = new QCheckBox( i18n("&Print to File"), plainPage() ); + + label2 = new QLabel( i18n("&Filename:"), plainPage() ); + requester = new KURLRequester( plainPage() ); + label2->setBuddy( requester ); + + label3 = new QLabel( i18n("&Device:"), plainPage() ); + comboDevice = new KComboBox( true, plainPage() ); + label3->setBuddy( comboDevice ); + + layout->addWidget( label, 0, 0 ); + layout->addMultiCellWidget( comboFormat, 0, 0, 1, 2 ); + layout->addMultiCellWidget( checkFile, 1, 1, 1, 2 ); + layout->addWidget( label2, 2, 0 ); + layout->addWidget( requester, 2, 1 ); + layout->addWidget( label3, 3, 0 ); + layout->addMultiCellWidget( comboDevice, 3, 3, 1, 2 ); + + comboFormat->insertItem( i18n("TEC Printer (TEC)") ); + comboFormat->insertItem( i18n("Zebra Printer (ZPL)") ); + comboFormat->insertItem( i18n("Intermec Printer (IPL)") ); + comboFormat->insertItem( i18n("EPCL Printer (EPCL)") ); + + // do not translate unix devicenames... + comboDevice->insertItem( "/dev/lp0" ); + comboDevice->insertItem( "/dev/lp1" ); + comboDevice->insertItem( "/dev/lp2" ); + comboDevice->insertItem( "/dev/usb/lp0" ); + comboDevice->insertItem( "/dev/usb/lp1" ); + comboDevice->insertItem( "/dev/usb/lp2" ); + + connect( checkFile, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + +// KFileDialog fd( QString::null, "*.zpl|Zebra Printer Language (*.zpl)\n*.ipl|Intermec Printer Language (*.ipl)", this, "fd", true ); + + enableControls(); +} + + +BarcodePrinterDlg::~BarcodePrinterDlg() +{ +} + +void BarcodePrinterDlg::enableControls() +{ + bool b = checkFile->isChecked(); + label2->setEnabled( b ); + requester->setEnabled( b ); + + label3->setEnabled( !b ); + comboDevice->setEnabled( !b ); +} + +int BarcodePrinterDlg::outputFormat() const +{ + switch( comboFormat->currentItem() ) + { + case 0: + return PrinterSettings::TEC; + case 1: + return PrinterSettings::ZEBRA; + case 2: + return PrinterSettings::INTERMEC; + case 3: + return PrinterSettings::EPCL; + default: + return -1; + } +} + +bool BarcodePrinterDlg::printToFile() const +{ + return checkFile->isChecked(); +} + +const QString BarcodePrinterDlg::deviceName() const +{ + return comboDevice->currentText(); +} + +const QString BarcodePrinterDlg::fileName() const +{ + return requester->url(); +} + +#include "barcodeprinterdlg.moc" diff --git a/kbarcode/barcodeprinterdlg.h b/kbarcode/barcodeprinterdlg.h new file mode 100644 index 0000000..fe0e6e3 --- /dev/null +++ b/kbarcode/barcodeprinterdlg.h @@ -0,0 +1,55 @@ +/*************************************************************************** + barcodeprinterdlg.h - description + ------------------- + begin : Fri Oct 01 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#ifndef BARCODEPRINTERDLG_H +#define BARCODEPRINTERDLG_H + +#include + +class KComboBox; +class KURLRequester; +class QCheckBox; +class QLabel; + +/** +@author Dominik Seichter +*/ +class BarcodePrinterDlg : public KDialogBase +{ + Q_OBJECT + public: + BarcodePrinterDlg(QWidget *parent = 0, const char *name = 0); + ~BarcodePrinterDlg(); + + int outputFormat() const; + bool printToFile() const; + const QString deviceName() const; + const QString fileName() const; + + private slots: + void enableControls(); + + private: + KComboBox* comboFormat; + KComboBox* comboDevice; + KURLRequester* requester; + + QCheckBox* checkFile; + QLabel* label2; + QLabel* label3; +}; + +#endif diff --git a/kbarcode/barcodes.html b/kbarcode/barcodes.html new file mode 100644 index 0000000..3e64951 --- /dev/null +++ b/kbarcode/barcodes.html @@ -0,0 +1,868 @@ + + + +kbarcode + + + + + +

+ kbarcode - The Barcode Solution for KDE +

+ +

kbarcode has right now support following barcodes. Please check + the requirements and limitations:

+ + +

EAN 8:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingean
valid character setnumbers (0....9)
lenght7 + 1 Checkum Digit = 8
Checksum
    +
  • when the number is 7 digits long, kbarcode will create a checksum + (the 8. digits)
  • +
  • when the number is 8 digits long, kbarcode will check the checksum + and deny printing if wrong
  • +
Size

fixed, but scalable
+ Standard: 26.73mm x 21.64mm

Remark

possible scaling:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Size
Factor

width
+

[mm]

height

+

[mm]

SC0
0.818
21.87
17.70
SC1
0.90
24.06
19.48
SC2
1.00
26.73
21.64
SC3
1.10
29.40
23.80
SC4
1.20
32.08
25.97
SC5
1.35
36.09
29.21
SC6
1.50
40.10
32.46
SC7
1.65
44.10
35.71
SC8
1.85
49.45
40.03
SC9
2.00
53.46
43.28

 

+ + +

+ TOP +

+ + +

EAN 13:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingean
valid character setnumbers (0.....9)
lenght12 + 1 checksum digitt = 13
Checksum
    +
  • when the number is 12 digits long, kbarcode will create a checksum + (the 13. digits)
  • +
  • when the number is 13 digits long, kbarcode will check the checksum + and deny printing if wrong
  • +
Size

fixed, but scalable
+ Standard: 37.29 x 26.26mm

Remark

possible scaling:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Size
Factor

width
+

[mm]

height

+

[mm]

SC0
0.818
30.50
21.48
SC1
0.90
33.56
23.63
SC2
1.00
37.29
26.26
SC3
1.10
41.02
28.89
SC4
1.20
44.75
31.51
SC5
1.35
50.34
35.45
SC6
1.50
55.94
39.39
SC7
1.65
61.35
43.33
SC8
1.85
68.99
48.58
SC9
2.00
74.58
52.52

 

+ + +

+ TOP +

+ + + +

UPC-A

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode SettingUPC
valid character setnumbers (0....9)
lenght11 + 1 checksum digit = 12
Checksum
    +
  • when the number is 11 digits long, kbarcode will create a checksum + (the 12. digits)
  • +
  • when the number is 12 digits long, kbarcode will check the checksum + and deny printing if wrong
  • +
Size

fixed, but scalable
+ Standard: 37.29 x 26.26mm

Remark

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Size
Factor

width
+

[mm]

height

+

[mm]

SC0
0.818
30.50
21.48
SC1
0.90
33.56
23.63
SC2
1.00
37.29
26.26
SC3
1.10
41.02
28.89
SC4
1.20
44.75
31.51
SC5
1.35
50.34
35.45
SC6
1.50
55.94
39.39
SC7
1.65
61.35
43.33
SC8
1.85
68.99
48.58
SC9
2.00
74.58
52.52
+

 

+ +

+ TOP +

+ + +

UPC-E

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingupc
valid character setnumbers (0....9)
lenghtSystemcode 0 + 6 + 1 Checkum Digit = 8
Checksum
    +
  • when the number is 7 digits long, kbarcode will create a checksum + (the 8. digits)
  • +
  • when the number is 8 digits long, kbarcode will check the checksum + and deny printing if wrong
  • +
Size 
Remark +

 

+ + + +

+ TOP +

+ + + +

ISBN

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode SettingISBN
valid character set 
lenght 
Checksum 
Size 
Remark ISBN numbers are encoded as EAN-13 symbols, with an optional add-5 + trailer. The ISBN frontend of the library accepts real ISBN + numbers and deals with any hyphen and, if present, the ISBN checksum character + before encoding data. Valid representations for ISBN strings are for example: + "1-56592-292-1", "3-89721-122-X" and "3-89721-122-X + 06900".

+ + +

+ TOP +

+ + + +

code 128-B

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingcode 128-B
valid character set 
lenght 
Checksum 
Size 
Remark This encoding can represent all of the printing ASCII characters, from + the space (32) to DEL (127). The checksum digit is mandatory i + n this encoding.
+ + +

+ TOP +

+ + +

code 128-C

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingcode 128-C
valid character set 
lenght 
Checksum 
Size 
Remark + The "C" variation of Code-128 uses Code-128 symbols to represent + two digits at a time (Code-128 is made up of 104 symbols whose
+ interpretation is controlled by the start symbol being used). Code 128-C + is thus the most compact way to represent any even number of digits. The + encoder refuses to deal with an odd number of digits because the caller + is expected to provide proper padding to an even number of digits. (Since + Code-128 includes control symbols to switch charset, it is theoretically + possible to represent the odd digit as a Code 128-A or 128-B symbol, but + this tool doesn't currently implement this option).

+ + +

+ TOP +

+ + +

code 128 raw

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingcode 128 raw
valid character set 
lenght 
Checksum 
Size 
Remark Code-128 output represented symbol-by-symbol in the input string. + To override part of the problems outlined below in specifying
+ code128 symbols, this pseudo-encoding allows the used to specify a list + of code128 symbols separated by spaces. Each symbol is represented by + a number in the range 0-105. The list should include the leading character.The + checksum and the stop character are automatically added by the library. + Most likely this pseudo-encoding will be used with BARCODE_NO_ASCII and + some external program to supply the printed text.

+ + +

+ TOP +

+ + +

code 39

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingcode 39
valid character set 
lenght 
Checksum 
Size 
Remark The code-39 standard can encode uppercase letters, digits, the blank + space, plus, minus, dot, star, dollar, slash, percent. Any
+ string that is only composed of such characters is accepted by the code-39 + encoder. To avoid loosing information, the encoder refuses to encode mixed-case + strings (a lowercase string is nonetheless accepted as a shortcut, but is + encoded as uppercase).
+ + +

+ TOP +

+ + +

interleaved 2 of 5

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settinginterleaved 2 of 5
valid character set 
lenght 
Checksum 
Size 
Remark + This encoding can only represent an even number of digits (odd digits + are represented by bars, and even digits by the interleaving
+ spaces). The name stresses the fact that two of the five items (bars or + spaces) allocated to each symbol are wide, while the rest are narrow. + The checksum digit is optional (can be disabled via BARCODE_NO_CHECKSUM). + Since the number of digits, including the checksum, must be even, a leading + zero is inserted in the string being encoded if needed (this is specifically + stated in the specs I have access to).

+ + +

+ TOP +

+ + +

code 128

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingcode 128
valid character set 
lenght 
Checksum 
Size 
Remark Automatic selection between alphabet A, B and C of the Code-128 standard. + This encoding can represent all ASCII symbols, from 0
+ (NUL) to 127 (DEL), as well as four special symbols, named F1, F2, F3, + F4. The set of symbols available in this encoding is not easily represented + as input to the barcode library, so the following convention is used. + In the input string, which is a C-language null- terminated string, the + NUL char is represented by the value 128 (0x80, 0200) and the F1-F4 characters + are represented by the values 193-196 (0xc1-0xc4, 0301-0304). The values + have been chosen to ease their representation as escape sequences.

+

Since the shell doesn't seem to interpret escape sequences on the command + line, the "-b" option cannot be easily used to designate the + strings to be encoded. As a workaround you can resort to the command echo, + either within back-ticks or used separately to create a file that is then + fed to the standard-input of barcode - assuming your echo command processes + escape sequences. The newline character is especially though to encode + (but not impossible unless you use a csh variant.

+

These problems only apply to the command-line tool; the use of library + functions doesn't give any problem. In needed, you can use the "code + 128 raw" pseudo-encoding to represent code128 symbols by their numerical + value. This encoding is used late in the auto- selection mechanism because + (almost) any input string can be represented using code128.

+
+ + +

+ TOP +

+ + +

Codabar

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode SettingCodabar
valid character set 
lenght 
Checksum 
Size 
Remark + Codabar can encode the ten digits and a few special symbols (minus, plus, + dollar, colon, bar, dot). The characters "A", "B", + "C" and
+ "D" are used to represent four different start/stop characters. + The input string to the barcode library can include the start and stop + characters or not include them (in which case "A" is used as + start and "B" as stop). Start and stop characters in the input + string can be either all lowercase or all uppercase and are always printed + as uppercase.

+ + +

+ TOP +

+ + +

Plessey

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode SettingPlessey
valid character set 
lenght 
Checksum 
Size 
Remark Plessey barcodes can encode all the hexadecimal digits. Alphabetic + digits in the input string must either be all lowercase or all
+ uppercase. The output text is always uppercase.

+ + +

+ TOP +

+ + +

MSI

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode SettingMSI
valid character set 
lenght 
Checksum 
Size 
Remark + MSI can only encode the decimal digits. While the standard specifies either + one or two check digits, the current implementation in
+ this library only generates one check digit.

+ +

+ TOP +

+ + +

code 93

+ + + + + + + + + + + + + + + + + + + + + + + + + +
kbarcode Settingcode 93
valid character set 
lenght 
Checksum 
Size 
RemarkThe code-93 standard can natively encode 48 different characters, including + uppercase letters, digits, the blank space, plus, minus,
+ dot, star, dollar, slash, percent, as well as five special characters: + a start/stop delimiter and four "shift characters" used for + extended encoding. Using this "extended encoding" method, any + standard 7-bit ASCII character can be encoded, but it takes up two symbol + lengths in barcode if the character is not natively supported (one of + the 48). The encoder here fully implements the code 93 encoding standard. + Any characters natively supported (A-Z, 0-9, ".+-/$&%") + will be encoded as such - for any other characters (such as lower case + letters, brackets, parentheses, etc.), the encoder will revert to extended + encoding. As a note, the option to exclude the checksum will eliminate + the two modulo-47 checksums (called C and K) from the barcode, but this + probably will make it unreadable by 99% of all scanning systems. These + checksums are specified to be used at the firmware level, and their absence + will be interpreted as an invalid barcode.

+ + +

+ TOP +

+ + diff --git a/kbarcode/barkode.cpp b/kbarcode/barkode.cpp new file mode 100644 index 0000000..7ec5c84 --- /dev/null +++ b/kbarcode/barkode.cpp @@ -0,0 +1,968 @@ +/* Copyright (C) 2004 Dominik Seichter + + This library 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 library 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 library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "barkode.h" +#include "barkodeengine.h" +#include "gnubarcode.h" +#include "pixmapbarcode.h" +#include "purepostscript.h" +#include "tbarcode2.h" +#include "tokenprovider.h" + +#ifdef _ENABLE_NATIVE_GNU_BARCODE +# include +#else +#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 */ + +// include our own defines from barcode.h +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) */ +}; +#endif // _ENABLE_NATIVE_GNU_BARCODE + +#include +#include +#include +#include +#include +#include + +#include +#include + +QValueList Barkode::s_info; +QStringList* Barkode::s_encoding = NULL; +bool Barkode::s_haveGnuBarcode = false; +bool Barkode::s_havePdfEncode = false; +bool Barkode::s_haveTBarcode = false; +bool Barkode::s_haveTBarcode2 = false; +bool Barkode::s_havePurePostscript = false; + +Barkode::Barkode() +{ + initInfo(); + m_engine = NULL; + m_token = NULL; + + defaults(); +} + +Barkode::Barkode( const Barkode & barkode ) +{ + initInfo(); + m_engine = NULL; + m_token = NULL; + + *this = barkode; +} + +Barkode::~Barkode() +{ + if( m_engine ) + delete m_engine; +} + +void Barkode::setTokenProvider( TokenProvider* token ) +{ + m_token = token; +} + +void Barkode::defaults() +{ + m_valid = false; + m_text_visible = true; + + m_background = Qt::white; + m_foreground = Qt::black; + m_textcolor = Qt::black; + + m_quietzone = 0; + m_bar_height = 80; + m_fontsize = 12; + + m_rotation = 0; + m_scaling = 1.0; + m_cut = 1.0; + m_datamatrix_size = 0; + + m_type = "code39"; + m_value = "KBARCODE"; + m_database_mode = "static"; + + m_index = 0; + m_sequence = false; + m_esequence = NUM; + m_sequence_start = 1; + m_sequence_step = 1; + + updateEngine(); + + BarkodeEngineOptions* options = m_engine ? m_engine->options() : NULL; + if( options ) + options->defaults(); +} + +void Barkode::setData( const Barkode & barkode ) +{ + this->m_valid = barkode.m_valid; + this->m_text_visible = barkode.m_text_visible; + + this->m_background = barkode.m_background; + this->m_foreground = barkode.m_foreground; + this->m_textcolor = barkode.m_textcolor; + + this->m_quietzone = barkode.m_quietzone; + this->m_bar_height = barkode.m_bar_height; + this->m_fontsize = barkode.m_fontsize; + this->m_rotation = barkode.m_rotation; + this->m_scaling = barkode.m_scaling; + this->m_cut = barkode.m_cut; + + this->m_type = barkode.m_type; + this->m_value = barkode.m_value; + this->m_database_mode = barkode.m_database_mode; + + this->m_index = barkode.m_index; + this->m_sequence = barkode.m_sequence; + this->m_esequence = barkode.m_esequence; + this->m_sequence_start = barkode.m_sequence_start; + this->m_sequence_step = barkode.m_sequence_step; + + updateEngine(); + + *m_engine = *(barkode.engine()); + + this->m_datamatrix_size = barkode.m_datamatrix_size; +} + +void Barkode::operator=( const Barkode & barkode ) +{ + setData( barkode ); +} + +bool Barkode::operator==( const Barkode & barkode ) const +{ + bool b = true; +#warning "operator== is incomplete" + + // colors + b = ( this->m_background == barkode.m_background && this->m_foreground == barkode.m_foreground ) && b; + + // sizes + b = ( this->m_quietzone == barkode.m_quietzone && this->m_bar_height == barkode.m_bar_height && this->m_fontsize == barkode.m_fontsize ) && b; + + // values + b = ( this->m_type == barkode.m_type && this->m_value == barkode.m_value ) && b; + + return b; +} + +const QPicture Barkode::picture() +{ + QPicture pic; + QPainter painter( &pic ); + + painter.fillRect( 0, 0, size().width(), size().height(), m_background ); + + // sub classes do the real drawing + drawBarcode( painter ); + + return pic; +} + +void Barkode::drawInvalid( QPainter & painter, int x, int y ) +{ + QRect rect( x, y, size().width(), size().height() ); + painter.save(); + painter.fillRect( rect, Qt::white ); + painter.setPen( QPen( Qt::red, 2 ) ); + painter.drawRect( rect ); + painter.drawLine( x, y, x + size().width(), y + size().height() ); + painter.drawLine( x, y + size().height(), x + size().width(), y ); + painter.restore(); +} + +const QSize Barkode::size() const +{ + return m_engine ? m_engine->size() : QSize( 0, 0 ); +} + +const QPixmap Barkode::pixmap( double scalex, double scaley ) +{ + QPixmap pixmap( (int)(size().width() * scalex), (int)(size().height() * scaley) ); + if( !pixmap.isNull() ) + { + QPainter painter( &pixmap ); + painter.scale( scalex, scaley ); + painter.fillRect( 0, 0, size().width(), size().height(), m_background ); + drawBarcode( painter ); + } + + return pixmap; +} + +const QString Barkode::parsedValue() +{ + QString text = m_token ? m_token->parse( m_value ) : m_value; + + if( !sequenceEnabled() ) + return text; + + if( m_value.contains( '#' ) <= 0 ) + return text; + + int pos = 0, counter = 1; + + pos = text.find("#", pos); + pos++; + while( text[pos] == '#' ) { + text.remove(pos, 1); + counter++; + } + + pos = text.find("#", 0); + QString temp; + + if( sequenceMode() == NUM ) { + int v = sequenceStart() + m_index*sequenceStep(); + temp.sprintf("%0*i", counter, v ); + } else { + for( int i = 0; i < counter; i++ ) + temp.append( "A" ); + + unsigned int z = 0; + for( int p = temp.length(); p >= 0; p--, z++ ) { + if( sequenceMode() == ALPHA ) { + int v = 'A' + m_index*sequenceStep(); + v -= z*('Z'-'A'); + + if( v <= 'Z' ) { + temp[p] = QChar(v); + break; + } else if( v > 'Z' ) + v = 'Z'; + temp[p] = QChar(v); + } else if( sequenceMode() == ALPHANUM ) { + qDebug("NOT IMPLEMENTED"); +/* char array[36]; + for( unsigned int i = 'A'; i <= 'Z'; i++ ) + array[i-'A'] = i; + for( unsigned int i = '0'; i <= '9'; i++ ) + array['Z'-'A'+i-'0'] = i; + + int z = m_index*barcode.sequence.step; + if( z < sizeof(array) ) + temp[] + int v = array[ ]*/ + } + } + } + + text.replace( pos, 1, temp); + return text; +} + +EEngine Barkode::engineForType( const QString & type ) +{ + EEngine engine = NONE; + + for( unsigned int i=0;iengine() ) + { + // switch to another engine + delete m_engine; + m_engine = NULL; + } + + if( !m_engine ) + { + if( engine == GNU_BARCODE ) +#ifdef _ENABLE_NATIVE_GNU_BARCODE + m_engine = new GnuBarcode(); +#else + m_engine = new PixmapBarcode(); +#endif // _ENABLE_NATIVE_GNU_BARCODE + else if( engine == TBARCODE ) + m_engine = new PixmapBarcode(); + else if( engine == TBARCODE2 ) + m_engine = new TBarcode2(); + else if( engine == PDF417 ) + m_engine = new PixmapBarcode(); + else if( engine == PURE_POSTSCRIPT ) + m_engine = new PurePostscriptBarcode(); + else + m_engine = new EmptyEngine(); + + m_engine->setBarkode( this ); + } +} + +void Barkode::drawBarcode( QPainter & painter, int x, int y ) +{ + if( m_engine ) + m_engine->drawBarcode( painter, x, y ); +} + +void Barkode::update( const QPaintDevice* device ) +{ + if( m_engine ) + m_engine->update( device ); +} + +//////////////////////////////////////////////////////////// +// Get attributes // +//////////////////////////////////////////////////////////// + +bool Barkode::isValid() const +{ + return m_valid; +} + +const QColor & Barkode::background() const +{ + return m_background; +} + +const QColor & Barkode::foreground() const +{ + return m_foreground; +} + +const QColor & Barkode::textColor() const +{ + return m_textcolor; +} + +const unsigned int Barkode::fontsize() const +{ + return m_fontsize; +} + +const unsigned int Barkode::quietZone() const +{ + return m_quietzone; +} + +const unsigned int Barkode::barHeight() const +{ + return m_bar_height; +} + +const QString & Barkode::type() const +{ + return m_type; +} + +const QString & Barkode::value() const +{ + return m_value; +} + +const unsigned int Barkode::index() const +{ + return m_index; +} + +const bool Barkode::sequenceEnabled() const +{ + return m_sequence; +} + +const ESequence Barkode::sequenceMode() const +{ + return m_esequence; +} + +const int Barkode::sequenceStart() const +{ + return m_sequence_start; +} + +const int Barkode::sequenceStep() const +{ + return m_sequence_step; +} + +const QString & Barkode::databaseMode() const +{ + return m_database_mode; +} + +const bool Barkode::textVisible() const +{ + return m_text_visible; +} + +const int Barkode::rotation() const +{ + return m_rotation; +} + +const double Barkode::scaling() const +{ + return m_scaling; +} + +const double Barkode::cut() const +{ + return m_cut; +} + +const int Barkode::datamatrixSize() const +{ + return m_datamatrix_size; +} + +//////////////////////////////////////////////////////////// +// Set attributes // +//////////////////////////////////////////////////////////// + +void Barkode::setBackground( const QColor & c ) +{ + m_background = c; +} + +void Barkode::setForeground( const QColor & c ) +{ + m_foreground = c; +} + +void Barkode::setTextColor( const QColor & c ) +{ + m_textcolor = c; +} + +void Barkode::setFontsize( unsigned int f ) +{ + m_fontsize = f; +} + +void Barkode::setQuietZone( const unsigned int q ) +{ + m_quietzone = q; +} + +void Barkode::setBarHeight( unsigned int h ) +{ + m_bar_height = h; +} + +void Barkode::setType( const QString & type ) +{ + m_type = type.lower(); + updateEngine(); +} + +void Barkode::setValue( const QString & value ) +{ + m_value = value; +} + +void Barkode::setIndex( const unsigned int i ) +{ + m_index = i; +} + +void Barkode::setSequenceEnabled( bool b ) +{ + m_sequence = b; +} + +void Barkode::setSequenceMode( ESequence e ) +{ + m_esequence = e; +} + +void Barkode::setSequenceStart( int s ) +{ + m_sequence_start = s; +} + +void Barkode::setSequenceStep( int s ) +{ + m_sequence_step = s; +} + +void Barkode::setDatabaseMode( const QString & mode ) +{ + m_database_mode = mode; +} + +void Barkode::setTextVisible( const bool b ) +{ + m_text_visible = b; +} + +void Barkode::setRotation( const int r ) +{ + m_rotation = r; +} + +void Barkode::setScaling( const double d ) +{ + m_scaling = d; +} + +void Barkode::setCut( const double c ) +{ + m_cut = c; +} + +void Barkode::setDatamatrixSize( int s ) +{ + m_datamatrix_size = s; +} + +//////////////////////////////////////////////////////////// +// Fill the s_info structure +//////////////////////////////////////////////////////////// + +bool Barkode::hasFeature( const QString & type, unsigned int feature ) +{ + for( unsigned int i = 0; i < s_info.count(); i++ ) + if( s_info[i].xml == type ) + return (s_info[i].features & feature) == feature; + + return false; +} + +int Barkode::internalType( const QString & type ) +{ + for( unsigned int i = 0; i < s_info.count(); i++ ) + if( s_info[i].xml == type ) + return s_info[i].internal; + + return false; +} + +const QStringList* Barkode::encodingTypes() +{ + if( !s_encoding ) + { + s_encoding = new QStringList; + for( unsigned int i = 0; i < s_info.count(); i++ ) + s_encoding->append( s_info[i].name ); + //s_encoding->sort(); + } + + return s_encoding; +} + +const char* Barkode::typeFromName( const QString & name ) +{ + for( unsigned int i = 0; i < s_info.count(); i++ ) + if( s_info[i].name == name ) + return s_info[i].xml; + + return NULL; +} + +const char* Barkode::nameFromType( const QString & type ) +{ + for( unsigned int i = 0; i < s_info.count(); i++ ) + if( s_info[i].xml == type ) + return s_info[i].name; + + return NULL; +} + +QString* Barkode::validatorFromType( const QString & type ) +{ + for( unsigned int i = 0; i < s_info.count(); i++ ) + if( s_info[i].xml == type ) + return &(s_info[i].validator); + + return NULL; +} + +QString* Barkode::validatorNotFromType( const QString & type ) +{ + for( unsigned int i = 0; i < s_info.count(); i++ ) + if( s_info[i].xml == type ) + return &(s_info[i].validatorNot); + + return NULL; +} + +tBarcodeInfo Barkode::createInfo( const char* xml, const QString & name, const EEngine engine, + const unsigned int features, const int internal ) +{ + tBarcodeInfo info; + QString strengine; + + switch( engine ) + { + case GNU_BARCODE: + strengine = i18n(" [GNU Barcode]"); + break; + case PDF417: + strengine = i18n(" [PDF 417]"); + break; + case TBARCODE: + strengine = i18n(" [TBarcode]"); + break; + case TBARCODE2: + strengine = i18n(" [TBarcode2]"); + break; + case PURE_POSTSCRIPT: + strengine = i18n(" [Barcode Writer in Pure Postscript]"); + break; + case NONE: + default: + // does not need to be translated as it should not visible anytime ever + strengine = " [NONE]"; + break; + } + + info.xml = xml; + info.name = name + strengine; + info.engine = engine; + info.features = features; + info.internal = internal; + + return info; +} + +void Barkode::initInfo() +{ + if( s_info.count() ) + return; + + PurePostscriptBarcode::init(); + + s_haveGnuBarcode = !KStandardDirs::findExe( "barcode" ).isNull(); + s_havePdfEncode = !KStandardDirs::findExe( "pdf417_enc" ).isNull(); + s_haveTBarcode = false; //!KStandardDirs::findExe( "tbarcodeclient" ).isNull(); +// TODO: do not yet enable TBarcode2 support + s_haveTBarcode2 = !KStandardDirs::findExe( "tbarcode" ).isNull(); + s_havePurePostscript = !KStandardDirs::findExe( "gs" ).isNull() + && PurePostscriptBarcode::hasPurePostscriptBarcode(); + + if( s_haveGnuBarcode ) + { + s_info.append( createInfo( "128raw", i18n("Raw code 128"), GNU_BARCODE, 0, BARCODE_128RAW ) ); + s_info.append( createInfo( "cbr", i18n("Codabar"), GNU_BARCODE, 0, BARCODE_CBR ) ); + s_info.append( createInfo( "cbr -c", i18n("Codabar (no checksum)"), GNU_BARCODE, 0, BARCODE_CBR ) ); + s_info.append( createInfo( "code128", i18n("Code 128 (a,b,c: autoselection)"), GNU_BARCODE, 0, BARCODE_128 ) ); + s_info.append( createInfo( "code128b", i18n("Code 128B, full printable ascii"), GNU_BARCODE, 0, BARCODE_128B ) ); + s_info.append( createInfo( "code128c", i18n("Code 128C (compact form digits)"), GNU_BARCODE, 0, BARCODE_128C ) ); + s_info.append( createInfo( "code39 -c", i18n("Code 39 (no checksum)"), GNU_BARCODE, 0, BARCODE_39 | BARCODE_NO_CHECKSUM ) ); + s_info.append( createInfo( "code39", i18n("Code 39"), GNU_BARCODE, 0, BARCODE_39 ) ); + s_info.append( createInfo( "code93", i18n("Code 93"), GNU_BARCODE, 0, BARCODE_93 ) ); + s_info.append( createInfo( "ean", i18n("EAN (EAN 8 or EAN 13)"), GNU_BARCODE, 0, BARCODE_EAN ) ); + s_info.append( createInfo( "i25 -c", i18n("interleaved 2 of 5 (only digits, no checksum)"), GNU_BARCODE, 0, BARCODE_I25 | BARCODE_NO_CHECKSUM ) ); + s_info.append( createInfo( "i25", i18n("interleaved 2 of 5 (only digits)"), GNU_BARCODE, 0, BARCODE_I25 ) ); + s_info.append( createInfo( "isbn", i18n("ISBN (still EAN13)"), GNU_BARCODE, NOCUT, BARCODE_ISBN ) ); + s_info.append( createInfo( "msi", i18n("MSI"), GNU_BARCODE, 0, BARCODE_MSI ) ); + s_info.append( createInfo( "pls", i18n("Plessey"), GNU_BARCODE, 0, BARCODE_PLS ) ); + s_info.append( createInfo( "upc", i18n("UPC (12-digit EAN; UPCA and UPCB)"), GNU_BARCODE, 0, BARCODE_UPC ) ); + } + + if( s_havePdfEncode ) + { + s_info.append( createInfo( "pdf417", i18n("pdf 417 2D Barcode"), PDF417, BARCODE2D | PDF417BARCODE ) ); + } + + if( s_havePurePostscript ) + { + // add a leading "ps_" so that they do not conflict with GNU Barcode types + PurePostscriptBarcode::initInfo( &s_info ); + + /* + s_info.append( createInfo( "ps_auspost", i18n("Australian Post"), PURE_POSTSCRIPT, PUREADV | COLORED | NOCUT ) ); + s_info.append( createInfo( "ps_code11", i18n("Code 11"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_code128", i18n("Code 128"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_code2of5", i18n("Code 2 of 5"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_code39", i18n("Code 39"), PURE_POSTSCRIPT, PUREADV | COLORED | MODULOALLCHECK ) ); + s_info.append( createInfo( "ps_code93", i18n("Code 93"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_ean13", i18n("EAN 13"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_ean2", i18n("EAN 2"), PURE_POSTSCRIPT, PUREADV | COLORED | NOCUT ) ); + s_info.append( createInfo( "ps_ean5", i18n("EAN 5"), PURE_POSTSCRIPT, PUREADV | COLORED | NOCUT ) ); + s_info.append( createInfo( "ps_ean8", i18n("EAN 8"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_interleaved2of5", i18n("Interleaved 2 of 5"), PURE_POSTSCRIPT, PUREADV | COLORED | MODULOALLCHECK ) ); + s_info.append( createInfo( "ps_isbn", i18n("ISBN"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_kix", i18n("Kix (Dutch Postal)"), PURE_POSTSCRIPT, PUREADV | COLORED | NOCUT ) ); + s_info.append( createInfo( "ps_msi", i18n("MSI"), PURE_POSTSCRIPT, PUREADV | COLORED | MODULOALLCHECK ) ); + s_info.append( createInfo( "ps_plessey", i18n("Plessey"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_postnet", i18n("Postnet"), PURE_POSTSCRIPT, PUREADV | COLORED | NOCUT ) ); + s_info.append( createInfo( "ps_rationalizedCodabar", i18n("Rationalized Codabar"), PURE_POSTSCRIPT, PUREADV | COLORED | MODULOALLCHECK ) ); + s_info.append( createInfo( "ps_royalmail", i18n("Royal Mail"), PURE_POSTSCRIPT, PUREADV | COLORED | NOCUT ) ); + s_info.append( createInfo( "ps_symbol", i18n("Symbol"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_upca", i18n("UPCA"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + s_info.append( createInfo( "ps_upce", i18n("UPCE"), PURE_POSTSCRIPT, PUREADV | COLORED ) ); + */ + } + + if( s_haveTBarcode ) + { + s_info.append( createInfo( "b1", "Code 11", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b2", "Code 2 of 5 (Standard)", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b3", "Interleaved 2 of 5 Standard", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b4", "Code 2 of 5 IATA", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b5", "Code 2 of 5 Matrix", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b6", "Code 2 of 5 Data Logic", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b7", "Code 2 of 5 Industrial", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b8", "Code 3 of 9 (Code 39)", TBARCODE, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "b9", "Code 3 of 9 (Code 39) ASCII", TBARCODE, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "b10", "EAN8", TBARCODE, TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "b11", "EAN8 - 2 digits add on", TBARCODE, NOCUT | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "b12", "EAN8 - 5 digits add on", TBARCODE, NOCUT | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "b13", "EAN13", TBARCODE, TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "b14", "EAN13 - 2 digits add on", TBARCODE, NOCUT | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "b15", "EAN13 - 5 digits add on", TBARCODE, NOCUT | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "b16", "EAN128 (supports AIS)", TBARCODE, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "b17", "UPC 12 Digits", TBARCODE, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "b18", "CodaBar (2 width)", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b19", "CodaBar (18 widths)", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b20", "Code128", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b21", "Deutsche Post Leitcode", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b22", "Deutsche Post Identcode", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b25", "Code 93", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b26", "Identical to eBC_UPCA", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b33", "UCC128 (= EAN128)", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b34", "UPC A", TBARCODE, TBARCODEADV | TBARCODEADV | UPCACHECK ) ); + s_info.append( createInfo( "b35", "UPC A - 2 digit add on", TBARCODE, TBARCODEADV | UPCACHECK ) ); + s_info.append( createInfo( "b36", "UPC A - 5 digit add on", TBARCODE, TBARCODEADV | UPCACHECK ) ); + s_info.append( createInfo( "b37", "UPC E", TBARCODE, TBARCODEADV | UPCECHECK ) ); + s_info.append( createInfo( "b38", "UPC E - 2 digit add on", TBARCODE, TBARCODEADV | UPCECHECK ) ); + s_info.append( createInfo( "b39", "UPC E - 5 digit add on", TBARCODE, TBARCODEADV | UPCECHECK ) ); + s_info.append( createInfo( "b40", "PostNet ZIP (5d.)", TBARCODE, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "b41", "PostNet ZIP (5d.+CD)", TBARCODE, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "b42", "PostNet ZIP (8d.)", TBARCODE, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "b43", "PostNet ZIP+4 (5d.+4d.+CD)", TBARCODE, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "b44", "PostNet DPBC (5d.+4d.+2d.)", TBARCODE, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "b45", "PostNet DPBC (5d.+4d.+2d.+CD)", TBARCODE, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "b46", "Plessey Code", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b47", "MSI Code", TBARCODE, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "b50", "LOGMARS", TBARCODE, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "b55", "PDF417 - 2D bar code", TBARCODE, BARCODE2D | PDF417BARCODE ) ); + s_info.append( createInfo( "b56", "PDF417 Truncated - 2D bar code", TBARCODE, BARCODE2D | PDF417BARCODE ) ); + s_info.append( createInfo( "b57", "MaxiCode - 2D-bar code (Postscript only)", TBARCODE, BARCODE2D ) ); + s_info.append( createInfo( "b58", "QR-Code", TBARCODE, BARCODE2D ) ); + s_info.append( createInfo( "b59", "Code128 (CharSet A)", TBARCODE, TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + s_info.append( createInfo( "b60", "Code128 (CharSet B)", TBARCODE, TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + s_info.append( createInfo( "b61", "Code128 (CharSet C)", TBARCODE, TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + s_info.append( createInfo( "b62", "Code 93 Ascii", TBARCODE, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "b63", "Australian Post Standard Customer", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b64", "Australian Post Customer 2", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b65", "Australian Post Customer 3", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b66", "Australian Post Reply Paid", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b67", "Australian Post Routing", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b68", "Australian Post Redirection", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b69", "ISBN Code (=EAN13P5)", TBARCODE, TBARCODEADV ) ); + s_info.append( createInfo( "b70", "Royal Mail 4 State (RM4SCC)", TBARCODE, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "b71", "Data Matrix", TBARCODE, DATAMATRIX | BARCODE2D | NOSCALE ) ); + } + + if( s_haveTBarcode2 ) + { + s_info.append( createInfo( "1", "Code 11", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "2", "Code 2 of 5 (Standard)", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "3", "Interleaved 2 of 5 Standard", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "4", "Code 2 of 5 IATA", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "5", "Code 2 of 5 Matrix", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "6", "Code 2 of 5 Data Logic", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "7", "Code 2 of 5 Industrial", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "8", "Code 3 of 9 (Code 39)", TBARCODE2, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "9", "Code 3 of 9 (Code 39) ASCII", TBARCODE2, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "10", "EAN8", TBARCODE2, TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "11", "EAN8 - 2 digits add on", TBARCODE2, NOCUT | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "12", "EAN8 - 5 digits add on", TBARCODE2, NOCUT | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "13", "EAN13", TBARCODE2, TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "14", "EAN13 - 2 digits add on", TBARCODE2, NOCUT | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "15", "EAN13 - 5 digits add on", TBARCODE2, NOCUT | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + s_info.append( createInfo( "16", "EAN128", TBARCODE2, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "17", "UPC 12 Digits", TBARCODE2, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "18", "CodaBar (2 width)", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + //s_info.append( createInfo( "19", "CodaBar (18 widths)", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "20", "Code128", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "21", "Deutsche Post Leitcode", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "22", "Deutsche Post Identcode", TBARCODE2, TBARCODEADV ) ); + //s_info.append( createInfo( "23", "Code 16K", TBARCODE2, TBARCODEADV ) ); + //s_info.append( createInfo( "24", "Code 49", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "25", "Code 93", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "26", "UPC 25 (Identical to UPCA)", TBARCODE2, TBARCODEADV ) ); + //s_info.append( createInfo( "27", "UPCD1", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "28", "Flattermarken", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "29", "RSS-14", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "30", "RSS Limited", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "31", "RSS Expanded", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "32", "Telepen Alpha", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "33", "UCC128 (= EAN128)", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "34", "UPC A", TBARCODE2, TBARCODEADV | TBARCODEADV | UPCACHECK ) ); + s_info.append( createInfo( "35", "UPC A - 2 digit add on", TBARCODE2, TBARCODEADV | UPCACHECK ) ); + s_info.append( createInfo( "36", "UPC A - 5 digit add on", TBARCODE2, TBARCODEADV | UPCACHECK ) ); + s_info.append( createInfo( "37", "UPC E", TBARCODE2, TBARCODEADV | UPCECHECK ) ); + s_info.append( createInfo( "38", "UPC E - 2 digit add on", TBARCODE2, TBARCODEADV | UPCECHECK ) ); + s_info.append( createInfo( "39", "UPC E - 5 digit add on", TBARCODE2, TBARCODEADV | UPCECHECK ) ); + s_info.append( createInfo( "40", "PostNet5", TBARCODE2, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "41", "PostNet6 (5+CD)", TBARCODE2, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "42", "PostNet9 (5+4)", TBARCODE2, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "43", "PostNet10 (5+4+CD)", TBARCODE2, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "44", "PostNet11 (5+4+2)", TBARCODE2, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "45", "PostNet12 (5+4+2+CD)", TBARCODE2, NOCUT | TBARCODEADV | POSTNETCHECK ) ); + s_info.append( createInfo( "46", "Plessey Code", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "47", "MSI Code", TBARCODE2, TBARCODEADV | MODULO10CHECK ) ); + s_info.append( createInfo( "48", "SSCC18", TBARCODE2, TBARCODEADV ) ); + //s_info.append( createInfo( "49", "FIM", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "50", "LOGMARS", TBARCODE2, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "51", "Pharmacode One-Track", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "52", "Pharmacentralnumber", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "53", "Pharmacode Two-Track", TBARCODE2, TBARCODEADV ) ); + //s_info.append( createInfo( "54", "General Parcel", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "55", "PDF417 - 2D bar code", TBARCODE2, BARCODE2D | PDF417BARCODE ) ); + s_info.append( createInfo( "56", "PDF417 Truncated - 2D bar code", TBARCODE2, BARCODE2D | PDF417BARCODE ) ); + s_info.append( createInfo( "57", "MaxiCode - 2D-bar code (Postscript only)", TBARCODE2, BARCODE2D ) ); + s_info.append( createInfo( "58", "QR-Code", TBARCODE2, BARCODE2D ) ); + s_info.append( createInfo( "59", "Code128 (CharSet A)", TBARCODE2, TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + s_info.append( createInfo( "60", "Code128 (CharSet B)", TBARCODE2, TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + s_info.append( createInfo( "61", "Code128 (CharSet C)", TBARCODE2, TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + s_info.append( createInfo( "62", "Code 93 Ascii", TBARCODE2, TBARCODEADV | MODULOALLCHECK ) ); + s_info.append( createInfo( "63", "Australian Post Standard Customer", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "64", "Australian Post Customer 2", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "65", "Australian Post Customer 3", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "66", "Australian Post Reply Paid", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "67", "Australian Post Routing", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "68", "Australian Post Redirection", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "69", "ISBN Code (=EAN13P5)", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "70", "Royal Mail 4 State (RM4SCC)", TBARCODE2, NOCUT | TBARCODEADV ) ); + s_info.append( createInfo( "71", "Data Matrix", TBARCODE2, DATAMATRIX | BARCODE2D | NOSCALE ) ); + s_info.append( createInfo( "72", "EAN-14", TBARCODE2, TBARCODEADV ) ); + //s_info.append( createInfo( "73", "Codablock-E", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "74", "Codablock-F", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "75", "NVE-18", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "76", "Japanese Postal Code", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "77", "Korean Postal", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "78", "RSS-14 Truncated", TBARCODE2, BARCODE2D ) ); + s_info.append( createInfo( "79", "RSS-14 Stacked", TBARCODE2, BARCODE2D ) ); + s_info.append( createInfo( "80", "RSS-14 Stacked Omnidirektional", TBARCODE2, BARCODE2D ) ); + s_info.append( createInfo( "81", "RSS Expanded Stacked", TBARCODE2, BARCODE2D ) ); + s_info.append( createInfo( "82", "Planet 12 digits", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "83", "Planet 14 digits", TBARCODE2, TBARCODEADV ) ); + s_info.append( createInfo( "84", "MicroPDF417", TBARCODE2, BARCODE2D ) ); + } + + Barkode::initValidators(); +} + +void Barkode::initValidators() +{ + QString path; + const char* rules = "/usr/share/libpostscriptbarcode/rules.xml"; + if( QFile::exists( rules ) ) + path = rules; + else + path = locate( "data", "kbarcode/rules.xml" ); + + QFile xml( path ); + QDomDocument doc; + QDomElement root; + QDomNode n; + QString id; + QString* regular; + QString* regularNot; + + if( !xml.open( IO_ReadOnly ) ) + { + qDebug( "Cannot read validation rules from %s\n", path.latin1() ); + return; + } + + doc.setContent( &xml ); + root = doc.documentElement(); + n = root.firstChild(); + + while( !n.isNull() ) + { + QDomElement e = n.toElement(); + if( !e.isNull() && e.tagName() == "encoder" ) + { + id = e.attribute( "id" ); + id.prepend( "ps_" ); + regular = Barkode::validatorFromType( id ); + regularNot = Barkode::validatorNotFromType( id ); + + QDomNode child = e.firstChild(); + while( !child.isNull() ) + { + QDomElement e = child.toElement(); + QString pattern = QString::null; + + if( child.firstChild().isCDATASection() ) + { + pattern = child.firstChild().toCDATASection().data().stripWhiteSpace(); + } + + + if( !e.isNull() && e.tagName() == "pattern" ) + { + QString sense = e.attribute( "sense", "true" ); + if( sense == "true" ) + *regular = pattern; + else + *regularNot = pattern; + } + + child = child.nextSibling(); + } + } + + n = n.nextSibling(); + } + + xml.close(); +} + diff --git a/kbarcode/barkode.h b/kbarcode/barkode.h new file mode 100644 index 0000000..4d7004b --- /dev/null +++ b/kbarcode/barkode.h @@ -0,0 +1,297 @@ +/* This file is part of the KDE project + Copyright (C) 1998, 1999, 2000 Torben Weis + + This library 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 library 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 library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef BARKODE_H +#define BARKODE_H + + +#include +#include + +#include "barkodeengine.h" + +/** + * Enumeration values for sequence modes + */ +typedef enum { NUM, ALPHA, ALPHANUM } ESequence; + +/** This values are used to indicate the feature supported by a + * certain barcode typedef + */ +enum { NOCUT = 0x00001, MULTILINE = 0x00002, NOTEXT = 0x00004, NOSCALE = 0x00008, + /** + * Different advanced option modes. + */ + PDF417BARCODE = 0x00100, TBARCODEADV = 0x00200, PUREADV = 0x00400, DATAMATRIX = 0x00800, + COLORED = 0x00010, + + /** + * Checksum ID's + */ + POSTNETCHECK = 0x01000, CODE128CHECK = 0x02000, EAN8CHECK = 0x04000, EAN13CHECK = 0x08000, + UPCACHECK = 0x10000, UPCECHECK = 0x20000, MODULOALLCHECK = 0x40000, MODULO10CHECK = 0x80000, + + /** + * Short cut's + */ + BARCODE2D = NOCUT | MULTILINE | NOTEXT }; + +/** This structure holds information about a supported barcode encoding typedef + */ +typedef struct tBarcodeInfo +{ + /** the name which is stored for identification in the xml file + * and used as commandline parameter for external tools + */ + QString xml; + /** the user visible name of this typedef + */ + QString name; + /** the barcode engine to use + */ + EEngine engine; + /** features supported by this type orred together + */ + unsigned int features; + + /** internal value (e.g. identifier of GNU Barcode) + */ + int internal; + + /** A regular expression that validates + * a value for this barcode. + */ + QString validator; + QString validatorNot; +}; + +typedef QValueList TBarcodeInfoList; + +class BarkodeEngine; +class QPainter; +class QPicture; +class QSize; +class QPaintDevice; +class TokenProvider; + +class Barkode { + public: + Barkode(); + Barkode( const Barkode & barkode ); + virtual ~Barkode(); + + /** set a TokenProvider for data field parsing + */ + void setTokenProvider( TokenProvider* token ); + + /** restore default values + */ + void defaults(); + + /** call this method after you changed a property + * to update the internal structures + */ + void update( const QPaintDevice* device ); + + /** get the barcode value after all sequences and datafields have + * been parsed + */ + const QString parsedValue(); + + const QPixmap pixmap( double scalex = 1.0, double scaley = 1.0 ); + const QPicture picture(); + const QSize size() const; + bool isValid() const; + + const QColor & background() const; + const QColor & foreground() const; + const QColor & textColor() const; + const unsigned int fontsize() const; + const unsigned int quietZone() const; + const unsigned int barHeight() const; + const QString & type() const; + const QString & value() const; + const bool sequenceEnabled() const; + const ESequence sequenceMode() const; + const int sequenceStart() const; + const int sequenceStep() const; + const QString & databaseMode() const; + const bool textVisible() const; + const int rotation() const; + const double scaling() const; + const unsigned int index() const; + const double cut() const; + const int datamatrixSize() const; + + void setBackground( const QColor & c ); + void setForeground( const QColor & c ); + void setTextColor( const QColor & c ); + void setFontsize ( unsigned int f ); + void setQuietZone( unsigned int q ); + void setBarHeight( unsigned int h ); + void setType( const QString & type ); + void setValue( const QString & value ); + void setTextVisible( const bool b ); + /** Set the index of the barcodes for barcode sequences. + */ + void setIndex( unsigned int i ); + void setSequenceEnabled( bool b ); + void setSequenceMode( ESequence e ); + void setSequenceStart( int s ); + void setSequenceStep( int s ); + void setDatabaseMode( const QString & mode ); + void setRotation( const int r ); + void setScaling( const double d ); + void setCut( const double c ); + void setDatamatrixSize( int s ); + + /** Sets the barcodes data structures + * the same as operator= + */ + void setData( const Barkode & barkode ); + void operator=( const Barkode & barkode ); + bool operator==( const Barkode & barkode ) const; + + inline BarkodeEngine* engine(); + inline const BarkodeEngine* engine() const; + + /** Test if the encodingType @p type has a certain + * @p feature, as defined in the codes QValueList. + */ + static bool hasFeature( const QString & type, unsigned int feature ); + /** Returns the internal value for the encoding type @p typedef + */ + static int internalType( const QString & type ); + /** Returns all supported encoding types + * ready for displaying them to the user + */ + static const QStringList* encodingTypes(); + /** Convert the uservisible encoding type @p name + * to the internal identifier + */ + static const char* typeFromName( const QString & name ); + /** Convert the internal identifier @p type + * to the user visible encoding name + */ + static const char* nameFromType( const QString & type ); + + static QString* validatorFromType( const QString & type ); + static QString* validatorNotFromType( const QString & type ); + + /** return the barcode generation engine for type @p typedef + */ + + static EEngine engineForType( const QString & type ); + /** Draw an invalid barcode sign to QPainter @p painter + */ + void drawInvalid( QPainter & painter, int x = 0, int y = 0 ); + + /** returns wether barcode functionallity + * is available + */ + static bool haveBarcode() { + Barkode::initInfo(); + return ( s_haveGnuBarcode || s_havePdfEncode || s_haveTBarcode || s_havePurePostscript ); + } + static bool haveGNUBarcode() { + Barkode::initInfo(); + return s_haveGnuBarcode; + } + static bool haveTBarcode() { + Barkode::initInfo(); + return s_haveTBarcode; + } + static bool haveTBarcode2() { + Barkode::initInfo(); + return s_haveTBarcode2; + } + static bool havePDFBarcode() { + Barkode::initInfo(); + return s_havePdfEncode; + } + static bool havePurePostscriptBarcode() { + Barkode::initInfo(); + return s_havePurePostscript; + } + + static tBarcodeInfo createInfo( const char* xml, const QString & name, const EEngine engine, + const unsigned int features = 0, const int internal = 0 ); + + protected: + void drawBarcode( QPainter & painter, int x = 0, int y = 0 ); + + private: + static void initInfo(); + static void initValidators(); + + void updateEngine(); + + protected: + BarkodeEngine* m_engine; + TokenProvider* m_token; + + bool m_valid; + bool m_sequence; + ESequence m_esequence; + int m_sequence_start; + int m_sequence_step; + bool m_text_visible; + + QColor m_background; + QColor m_foreground; + QColor m_textcolor; + + unsigned int m_quietzone; + unsigned int m_bar_height; + unsigned int m_fontsize; + unsigned int m_index; + int m_datamatrix_size; + int m_rotation; + + double m_scaling; + double m_cut; // temporarly used for the pixmap engines + // won't be needed for the Barkode engine + + QString m_type; + QString m_value; + QString m_database_mode; + + static TBarcodeInfoList s_info; + static QStringList* s_encoding; + + static bool s_haveGnuBarcode; + static bool s_haveTBarcode; + static bool s_haveTBarcode2; + static bool s_havePdfEncode; + static bool s_havePurePostscript; +}; + +BarkodeEngine* Barkode::engine() +{ + return m_engine; +} + +const BarkodeEngine* Barkode::engine() const +{ + return m_engine; +} + +#endif // BARKODE_H + + diff --git a/kbarcode/barkodeengine.cpp b/kbarcode/barkodeengine.cpp new file mode 100644 index 0000000..f05440e --- /dev/null +++ b/kbarcode/barkodeengine.cpp @@ -0,0 +1,55 @@ +/*************************************************************************** + barkodeengine.cpp - description + ------------------- + begin : Fri Nov 05 2004 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "barkodeengine.h" +#include "barkode.h" + +BarkodeEngine::BarkodeEngine() +{ + m_valid = false; + barkode = NULL; +} + +BarkodeEngine::~BarkodeEngine() +{ +} + +BarkodeEngineOptions* BarkodeEngine::options() +{ + return NULL; +} + +EmptyEngine::EmptyEngine() + : BarkodeEngine() +{ +} + +void EmptyEngine::update( const QPaintDevice* ) +{ + // Do nothing +} + +const QSize EmptyEngine::size() const +{ + return QSize( 150, 80 ); +} + +void EmptyEngine::drawBarcode( QPainter & painter, int x, int y ) +{ + barkode->drawInvalid( painter, x, y ); +} + diff --git a/kbarcode/barkodeengine.h b/kbarcode/barkodeengine.h new file mode 100644 index 0000000..037667c --- /dev/null +++ b/kbarcode/barkodeengine.h @@ -0,0 +1,103 @@ +/*************************************************************************** + barkodeengine.h - description + ------------------- + begin : Fri Nov 05 2004 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BARKODEENGINE_H +#define BARKODEENGINE_H + +/** + * The different generator backends / engines + */ +typedef enum { GNU_BARCODE, PDF417, TBARCODE, TBARCODE2, PIXMAP, PURE_POSTSCRIPT, NONE } EEngine; + +class Barkode; +class QDomElement; +class QPainter; + +/** An interface for additional special options + * supported by a BarkodeEngine + */ +class BarkodeEngineOptions { + public: + BarkodeEngineOptions() {}; + virtual ~BarkodeEngineOptions() {}; + + virtual void defaults() = 0; + + virtual void load( const QDomElement* tag ) = 0; + virtual void save( QDomElement* tag ) = 0; +}; + +#include + +/** + * Inherit from this class if you want to create a + * (barkode engine) for use with KBarcode. + * @author Dominik Seichter + */ +class BarkodeEngine{ + public: + BarkodeEngine(); + virtual ~BarkodeEngine(); + + virtual const BarkodeEngine & operator=( const BarkodeEngine & rhs ) = 0; + + virtual EEngine engine() const = 0; + virtual void update( const QPaintDevice* device ) = 0; + virtual const QSize size() const = 0; + + void setBarkode( Barkode* b ) { barkode = b; } + virtual void drawBarcode( QPainter & painter, int x, int y ) = 0; + + /** @returns a pointer to a BarkodeEngineOptions object + * if this BarkodeEngine has one. Otherwise null is returned. + * The returned object has to be casted down to the concrete object + * you want to use, before setting any of the options. + */ + virtual BarkodeEngineOptions* options(); + + protected: + Barkode* barkode; + QSize m_size; + + bool m_valid; +}; + +/** A barcode engine with implemented empty and does + * nothing + */ +class EmptyEngine : public BarkodeEngine { + public: + EmptyEngine(); + + virtual inline const BarkodeEngine & operator=( const BarkodeEngine & rhs ); + virtual inline EEngine engine() const; + virtual void update( const QPaintDevice* device ); + virtual const QSize size() const; + virtual void drawBarcode( QPainter & painter, int x, int y ); +}; + +const BarkodeEngine & EmptyEngine::operator=( const BarkodeEngine & ) +{ + return *this; +} + +EEngine EmptyEngine::engine() const +{ + return NONE; +} + +#endif diff --git a/kbarcode/batchiface.h b/kbarcode/batchiface.h new file mode 100644 index 0000000..6eb6586 --- /dev/null +++ b/kbarcode/batchiface.h @@ -0,0 +1,46 @@ +/*************************************************************************** + batchiface.h - description + ------------------- + begin : Sat Dec 27 23:54:28 CET 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BATCHIFACE_H +#define BATCHIFACE_H + +#include +#include +#include "batchprinter.h" + +class BatchIface : virtual public DCOPObject +{ + K_DCOP + + public: + k_dcop: + virtual void setFilename( const QString & url ) = 0; + virtual void setImportCsvFile( const QString & filename ) = 0; + virtual void setImportSqlQuery( const QString & query ) = 0; + virtual void setNumLabels( const int n ) = 0; + virtual void setOutputFormat( const int e ) = 0; + virtual void setSerialNumber( const QString & val, int inc ) = 0; + + virtual bool addItem( const QString & article, const QString & group, int count = 1, bool msg = true ) = 0; + virtual bool existsArticle( const QString & article ) = 0; + virtual void loadFromFile( const QString & url ) = 0; + virtual void loadFromClipboard() = 0; + virtual void printNow( const QString & printer, bool bUserInteraction = true ) = 0; +}; + +#endif /* BATCHIFACE_H */ + diff --git a/kbarcode/batchprinter.cpp b/kbarcode/batchprinter.cpp new file mode 100644 index 0000000..9ca66c3 --- /dev/null +++ b/kbarcode/batchprinter.cpp @@ -0,0 +1,542 @@ +/*************************************************************************** + batchprinter.cpp - description + ------------------- + begin : Sat Jan 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include "batchprinter.h" + +#include "definition.h" +#include "kbarcode.h" +#include "label.h" +#include "printersettings.h" +#include "zplutils.h" +#include "tec.h" + +// Qt includes +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Other includes +#include +#include +#include +#include +#define MAXDATASIZE 32550 + +BatchPrinter::BatchPrinter( KPrinter* p, QWidget* _parent ) + : printer( p ), parent( _parent ) +{ + m_events = true; + m_data = NULL; + m_vardata = NULL; + m_addrdata = NULL; + + m_cur_data_count = 0; + + m_paintDevice = p; +} + +BatchPrinter::BatchPrinter( const QString & path, QWidget* p ) + : m_path( path ), parent( p ) +{ + m_data = NULL; + m_vardata = NULL; + m_addrdata = NULL; + m_move = 0; + m_image_filename = E_BARCODE; + + m_cur_data_count = 0; + + m_paintDevice = p; +} + +BatchPrinter::BatchPrinter( const QString & path, int format, QWidget* _parent ) + : m_path( path ), m_bcp_format( format ), parent( _parent ) +{ + m_data = NULL; + m_vardata = NULL; + m_addrdata = NULL; + m_move = 0; + m_image_filename = E_BARCODE; + + m_cur_data_count = 0; + + m_paintDevice = _parent; +} + +BatchPrinter::~BatchPrinter() +{ + delete m_data; + delete m_vardata; + delete m_addrdata; +} + +void BatchPrinter::start() +{ + painter = new QPainter( printer ); + m_cur_data_count = 0; + + QPaintDeviceMetrics pdm( painter->device() ); + + pageh = pdm.height(); // in pixel + + curw = 0; + curh = 0; + c_h = 0; + c_w = 0; + + QProgressDialog* progress = createProgressDialog( i18n("Printing...") ); + + m_measure = def->getMeasurements(); + + moveLabels(); + if( m_data ) + startPrintData( progress ); + else if( m_vardata || m_addrdata ) + startPrintVarData( progress ); + + painter->end(); + delete progress; + delete painter; +} + +void BatchPrinter::startPrintData( QProgressDialog* progress ) +{ + labelprinterdata* lpdata = PrinterSettings::getInstance()->getData(); + + unsigned int index = 0; // counter gets increased for every label, but not for + // labels like article_no etc. (those who are created + // by events. + + for( unsigned int i = 0; i < m_data->count(); i++ ) + { + Label l( def, buffer, m_name, printer, m_customer, + (*m_data)[i].article_no, (*m_data)[i].group ); + l.setSerial( m_serial, m_increment ); + + bool newgroup = false; + if( i == 0 ) + newgroup = true; + else { + if( (*m_data)[i].group != (*m_data)[i-1].group ) + newgroup = true; + } + + if( !curw ) + curw = m_measure.gapLeft( printer ); + + if( !curh ) + curh = m_measure.gapTop( printer ); + + if( m_events ) { + if( newgroup ) { + proccessEvents( lpdata->groupEvent1, i18n("Group : ") + (*m_data)[i].group, &l ); + proccessEvents( lpdata->groupEvent2, i18n("Group : ") + (*m_data)[i].group, &l ); + proccessEvents( lpdata->groupEvent3, i18n("Group : ") + (*m_data)[i].group, &l ); + proccessEvents( lpdata->groupEvent4, i18n("Group : ") + (*m_data)[i].group, &l ); + } + proccessEvents( lpdata->articleEvent1, i18n("Article No. : ") + (*m_data)[i].article_no, &l ); + proccessEvents( lpdata->articleEvent2, i18n("Article No. : ") + (*m_data)[i].article_no, &l ); + proccessEvents( lpdata->articleEvent3, i18n("Article No. : ") + (*m_data)[i].article_no, &l ); + proccessEvents( lpdata->articleEvent4, i18n("Article No. : ") + (*m_data)[i].article_no, &l ); + } + + for( int z = 0; z < (*m_data)[i].number; z++ ) { + changeLine(); + checkForNewPage( &l ); + + painter->setClipRect((int)curw, (int)curh, (int)m_measure.width( printer ), (int)m_measure.height( printer )); + l.setIndex( index ); + l.setRow( c_w ); + l.setCol( c_h ); + painter->save(); + l.draw( painter, (int)curw, (int)curh ); + painter->restore(); + + //painter->drawPicture( (int)curw, (int)curh, *l.picture() ); + index++; + painter->setClipping( false ); + + drawBorders(); + + curw += m_measure.gapH( printer ); + c_h++; + + if( !checkProgressDialog( progress) ) { + printer->abort(); + painter->end(); + return; + } + } + } +} + +void BatchPrinter::startPrintVarData( QProgressDialog* progress ) +{ + Label* l; + while( ( l = initLabel() ) != NULL ) + { + if( !curw ) + curw = m_measure.gapLeft( printer ); + + if( !curh ) + curh = m_measure.gapTop( printer ); + + changeLine(); + checkForNewPage( l ); + + painter->setClipRect((int)curw, (int)curh, (int)m_measure.width( printer ), (int)m_measure.height( printer )); + + painter->save(); + l->draw( painter, (int)curw, (int)curh ); + delete l; + painter->restore(); + + painter->setClipping( false ); + + drawBorders(); + + curw += m_measure.gapH( printer ); + c_h++; + + if( !checkProgressDialog( progress) ) + { + printer->abort(); + painter->end(); + return; + } + } +} + +Label* BatchPrinter::initLabel( int* number ) +{ + Label* l = NULL; + + if( (m_vardata && m_cur_data_count >= m_vardata->count() ) || + (m_data && m_cur_data_count >= m_data->count() ) || + (m_addrdata && m_cur_data_count >= m_addrdata->count() ) ) + return NULL; + + if( number ) + *number = 1; + + if( m_vardata ) + { + l = new Label( def, buffer, m_name, m_paintDevice ); + l->setUserVars( (*m_vardata)[m_cur_data_count] ); + } + else if( m_data ) + { + l = new Label( def, buffer, m_name, m_paintDevice, m_customer, + (*m_data)[m_cur_data_count].article_no, (*m_data)[m_cur_data_count].group ); + if( number ) + *number = (*m_data)[m_cur_data_count].number; + } + else if( m_addrdata ) + { + l = new Label( def, buffer, m_name, m_paintDevice ); + l->setAddressee( &((*m_addrdata)[m_cur_data_count]) ); + } + + l->setSerial( m_serial, m_increment ); + l->setIndex( m_cur_data_count ); + m_cur_data_count++; + + return l; +} + +void BatchPrinter::startImages() +{ + QProgressDialog* progress = createProgressDialog( i18n("Creating Images...") ); + + int number = 0; + m_cur_data_count = 0; + + Measurements measure = def->getMeasurements(); + Label* l = NULL; + painter = new QPainter(); + QPixmap pixmap( (int)measure.width( parent ), (int)measure.height( parent ) ); + while( (l = initLabel( &number ) ) != NULL ) + { + for( int i = 0; i < number; i++ ) + { + pixmap.fill( Qt::white ); + painter->begin( &pixmap ); + l->setIndex( i ); + l->setRow( 0 ); + l->setCol( 0 ); + l->draw( painter, 0, 0 ); + + painter->end(); + + QString name = m_path + "/"; + if( m_image_filename == E_ARTICLE ) + name += m_data ? (*m_data)[m_cur_data_count].article_no : QString::number( m_cur_data_count ); + else if( m_image_filename == E_BARCODE ) + name += l->barcodeNo(); + else + name += m_image_custom_filename; + + QString filename = name + QString("_%1.").arg( i ) + KImageIO::suffix( m_image_format ); + + unsigned int c = 0; + while( QFile::exists( filename ) ) { + filename += "." + QString::number( c ); + c++; + } + + pixmap.save( filename, m_image_format ); + + if( !checkProgressDialog( progress ) ) + { + delete l; + delete progress; + delete painter; + return; + } + } + + delete l; + } + + delete progress; + delete painter; + + new KRun( m_path ); +} + +void BatchPrinter::startBCP() +{ + int number = 0; + QFile file( m_path ); + if( !file.open( IO_WriteOnly ) ) // | IO_Raw ) ) + { + KMessageBox::error( parent, QString( i18n("Can't open the file or device %1.") ).arg( m_path ) ); + return; + } + + QProgressDialog* progress = createProgressDialog( i18n("Printing...") ); + + if( m_bcp_format == PrinterSettings::ZEBRA ) + // Zebra printers are printed at 304dpi, this should + // be user defined, though + m_paintDevice = new BarcodePrinterDevice( 304.0, 304.0 ); + else if( m_bcp_format == PrinterSettings::INTERMEC ) + m_paintDevice = new BarcodePrinterDevice( 300.0, 300.0 ); + else if( m_bcp_format == PrinterSettings::TEC ) + // don't know which resolution is used for tec printers + // so we use a factor to convert everything to mm + // this is not accurate as QPaintDevice supports only integers + m_paintDevice = new BarcodePrinterDevice( 25.4000508001016, 25.4000508001016 ); + else if( m_bcp_format == PrinterSettings::EPCL ) + m_paintDevice = new BarcodePrinterDevice( 304.0, 304.0 ); + + + QTextStream stream( &file ); + Label* l; + while( ( l = initLabel( &number ) ) != NULL ) + { + for( int i = 0; i < number; i++ ) + { + switch( m_bcp_format ) + { + case PrinterSettings::TEC: + // TODO: normally you should not care about the number or counter + // KBarcode will ensure that the label is printed often enough + if( m_data ) + stream << tec452(m_name, (*m_data)[m_cur_data_count].number, (*m_data)[m_cur_data_count].article_no, (*m_data)[m_cur_data_count].group, m_customer); + else + /* TODO */; + #warning "TEC requires Old KBarcode SQL tables for printing" + qDebug( "TEC requires Old KBarcode SQL tables for printing" ); + break; + case PrinterSettings::ZEBRA: + l->zpl( &stream ); + break; + case PrinterSettings::INTERMEC: + l->ipl( &stream ); + break; + case PrinterSettings::EPCL: + l->epcl( &stream ); + break; + default: + break; + } + + if( !checkProgressDialog( progress ) ) + { + delete l; + delete progress; + delete m_paintDevice; + m_paintDevice = NULL; + + file.close(); + + return; + } + } + delete l; + } + + delete progress; + delete m_paintDevice; + m_paintDevice = NULL; + + file.close(); +} + +void BatchPrinter::checkForNewPage( Label* label ) +{ + if( curh + m_measure.height( printer ) > pageh || c_w == m_measure.numV() ) { + printer->newPage(); + label->setPage( label->page() + 1 ); + curh = m_measure.gapTop( printer ); + curw = m_measure.gapLeft( printer ); + c_w = 0; + } +} + +void BatchPrinter::drawBorders() +{ + if( PrinterSettings::getInstance()->getData()->border ) { + painter->setPen( QPen( Qt::black, 1 ) ); + painter->drawRect( (int)curw, (int)curh, + (int)m_measure.width( painter->device() ), + (int)m_measure.height( painter->device() ) ); + } +} + +void BatchPrinter::changeLine() +{ + if( c_h >= m_measure.numH() ) { + c_h = 0; + curw = m_measure.gapLeft( printer ); + curh += m_measure.gapV( printer ); + c_w++; + } +} + +void BatchPrinter::proccessEvents( int lb, QString value, Label* label ) +{ + if( lb == NEW_PAGE ) { + if( curh > m_measure.gapTop( printer ) || curw > m_measure.gapLeft( printer ) ) { + printer->newPage(); + label->setPage( label->page() + 1 ); + curh = m_measure.gapTop( printer ); + curw = m_measure.gapLeft( printer ); + c_h = 0; + c_w = 0; + } + } + + if( lb == LINE_BREAK ) + changeLine(); + + if( lb == ARTICLE_GROUP_NO ) + printXLabel( lb, label, value ); + + + if( lb == LABEL_X ) + printXLabel( lb, label, QString::null ); +} + +void BatchPrinter::printXLabel( int lb, Label* label, const QString & value ) +{ + changeLine(); + checkForNewPage( label ); + + Label::getXLabel( curw, curh, m_measure.width( printer ), m_measure.height( printer ), painter, lb, value ); + + drawBorders(); + + curw += + m_measure.gapH( printer ); + c_h++; +} + +void BatchPrinter::moveLabels() +{ + for( unsigned int i = 0; i < m_move; i++ ) + { + if( !curw ) + curw = m_measure.gapLeft( printer ); + + if( !curh ) + curh = m_measure.gapTop( printer ); + + changeLine(); + + if( curh + m_measure.height( printer ) > pageh || c_w == m_measure.numV() ) + { + c_w = 0; + curh = m_measure.gapTop( printer ); + curw = m_measure.gapLeft( printer ); + } + + curw += m_measure.gapH( printer ); + c_h++; + } +} + +QProgressDialog* BatchPrinter::createProgressDialog( const QString & caption ) +{ + QProgressDialog* progress = new QProgressDialog( caption, i18n("&Cancel"), m_labels+1, parent ); + progress->setProgress( 0 ); + progress->show(); + return progress; +} + +bool BatchPrinter::checkProgressDialog( QProgressDialog* progress ) +{ + kapp->processEvents( 0 ); + progress->setProgress( progress->progress() + 1 ); + if( progress->wasCancelled() ) { + delete progress; + return false; + } + return true; +} + +void BatchPrinter::setData( QValueList* list ) +{ + if( m_data ) + delete m_data; + m_data = list; +} + +void BatchPrinter::setData( TVariableList* list ) +{ + if( m_vardata ) + delete m_vardata; + m_vardata = list; +} + +void BatchPrinter::setData( KABC::AddresseeList* list ) +{ + if( m_addrdata ) + delete m_addrdata; + m_addrdata = list; +} + diff --git a/kbarcode/batchprinter.h b/kbarcode/batchprinter.h new file mode 100644 index 0000000..c189183 --- /dev/null +++ b/kbarcode/batchprinter.h @@ -0,0 +1,212 @@ +/*************************************************************************** + batchprinter.h - description + ------------------- + begin : Sat Jan 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BATCHPRINTER_H +#define BATCHPRINTER_H + +#include "measurements.h" + +#include +#include + +namespace KABC { + class AddresseeList; +} + +class Definition; +class Label; +class KPrinter; +class Measurements; +class QBuffer; +class QPainter; +class QProgressDialog; +class QWidget; +class QPaintDevice; + +typedef QValueList< QMap > TVariableList; +/** + This class is responsible for batch printing of articles. + It is also responsible for creating images of all articles. + @author Dominik Seichter +*/ +class BatchPrinter +{ + public: + typedef enum EOutputFormat { POSTSCRIPT = 0, IMAGE, BCP }; + enum EImageFileName { E_ARTICLE, E_BARCODE, E_CUSTOM }; + + struct data { + int number; + QString article_no; + QString group; + }; + + /** Use this constructor if you want to print to + * a printer. + */ + BatchPrinter( KPrinter* p, QWidget* _parent ); + /** This constructor is used in image gernaration mode. + * @p path is the path to an existing directory where + * the images are saved. + */ + BatchPrinter( const QString & path, QWidget* p ); + + /** Use this constructor to print to a barcode printer @p path + * with format @p format + */ + BatchPrinter( const QString & path, int format, QWidget* _parent ); + + ~BatchPrinter(); + + inline void setBuffer( QBuffer* b ) { buffer = b; } + void setCustomer( const QString & s ) { m_customer = s; } + + /** Specify the label on which is printed first on the page. + * The first label on the page (top/left) has the index 1, + * the second label is index 2 ... + */ + inline void setMove( int m ) { + m_move = m > 0 ? --m : 0; + } + + /** set the sql data for the batchprinter + * @p list will be deleted by the batchprinter + */ + void setData( QValueList* list ); + + /** set the variable data for the batchprinter + * @p list will be deleted by the batchprinter + */ + void setData( TVariableList* list ); + + /** set the address data for the batchprinter + * @p list will be deleted by the batchprinter + */ + void setData( KABC::AddresseeList* list ); + + inline void setImageFilename( const EImageFileName e ) { m_image_filename = e; } + inline void setImageCustomFilename( const QString & name ) { m_image_custom_filename = name; }; + inline void setImageFormat( const QString & f ) { m_image_format = f; } + inline void setSerial( const QString & s, unsigned int inc ) { m_serial = s; m_increment = inc; } + inline void setName( const QString & s ) { m_name = s; } + inline void setDefinition( Definition* d ) { def = d; } + inline void setLabels( int l ) { m_labels = l; } + inline void setEvents( bool b ) { m_events = b; } + + /** start the batch printing on a printer + */ + void start(); + /** start image generation + */ + void startImages(); + /** start printing to a barcode printer + */ + void startBCP(); + private: + /** create a label which gets intialized either with m_vardata or m_data + * @p number is set to the number of times this label should be printed. + */ + Label* initLabel( int* number = NULL ); + + /** starts a new page on the printer, if the + * current label does not fit anymore on the current pageh + */ + void checkForNewPage( Label* label ); + /** draw a border around the current label using QPainter @p painter + */ + void drawBorders(); + /** start a "new line" on the printer, + * i.e. beginn the second row of labels + * on the page. + */ + void changeLine(); + void proccessEvents( int lb, QString value = QString::null, Label* label = 0 ); + void printXLabel( int lb, Label* label, const QString & value ); + void moveLabels(); + + /** print the labels using data from the m_data structure + */ + void startPrintData( QProgressDialog* progress ); + /** print the labels using data from the m_vardata or m_addrdata structure + */ + void startPrintVarData( QProgressDialog* progress ); + + /** Create and return a progressdialog + */ + QProgressDialog* createProgressDialog( const QString & caption ); + bool checkProgressDialog( QProgressDialog* progress ); + + Definition* def; + Measurements m_measure; + QValueList* m_data; + TVariableList* m_vardata; + KABC::AddresseeList* m_addrdata; + + QString m_serial; + QString m_name; + QString m_customer; + /** Path for image output + * or device for bcp output + */ + QString m_path; + /** defines the image format to be used + */ + QString m_image_format; + + unsigned int m_cur_data_count; + + /** format for bcp output + */ + int m_bcp_format; + + /** defines the format of the filename for images + */ + EImageFileName m_image_filename; + + /** prefix for custom filenames if m_image_filename = E_CUSTOM + */ + QString m_image_custom_filename; + + /** enable/disable events + */ + bool m_events; + + unsigned int m_increment; + unsigned int m_move; + /** number of labels to print for the progress dialog + */ + unsigned int m_labels; + + /** height of the current page in pixel. + */ + double pageh; + double curw; + double curh; + int c_h; + int c_w; + + QPaintDevice* m_paintDevice; + + QBuffer* buffer; + KPrinter* printer; + QPainter* painter; + /** parent for dialogs + */ + QWidget* parent; +}; + +#endif diff --git a/kbarcode/batchwizard.cpp b/kbarcode/batchwizard.cpp new file mode 100644 index 0000000..defcca8 --- /dev/null +++ b/kbarcode/batchwizard.cpp @@ -0,0 +1,1263 @@ +/*************************************************************************** + batchwizard.cpp - description + ------------------- + begin : Sun Mar 20 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "batchwizard.h" +#include "batchwizard.moc" +#include "barcodeprinterdlg.h" +#include "batchprinter.h" +#include "csvfile.h" +#include "definition.h" +#include "encodingcombo.h" +#include "printersettings.h" +#include "printlabeldlg.h" +#include "smalldialogs.h" +#include "sqltables.h" +#include "tokenprovider.h" +#include "xmlutils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PNG_FORMAT "PNG" + +class AddressListViewItem : public KListViewItem { +public: + AddressListViewItem(QListView *parent, KABC::Addressee & addr ) + : KListViewItem( parent ), m_address( addr ) + { + this->setText( 0, m_address.givenName() ); + this->setText( 1, m_address.familyName() ); + this->setText( 2, m_address.preferredEmail() ); + } + + const KABC::Addressee & address() const { + return m_address; + } + +private: + KABC::Addressee m_address; + +}; + +BatchWizard::BatchWizard( QWidget* parent, const char* name ) + : DCOPObject("BatchPrinting"), + KWizard( parent, name ) +{ + setupPage1(); + setupPage2(); + setupPage3(); + setupPage4(); + setupPage5(); + setupPage10(); + + compGroup = new KCompletion(); + + enableControls(); + setupSql(); + + show(); +} + +BatchWizard::~BatchWizard() +{ + delete compGroup; +} + +void BatchWizard::setupPage1() +{ + page1 = new QWidget( this, "page1" ); + QVBoxLayout* pageLayout = new QVBoxLayout( page1, 11, 6, "pageLayout"); + + QLabel* label = new QLabel( i18n("This wizard will guide you through the process " + "of printing many labels with KBarcode.
The first step " + "is to select the KBarcode label file you want to print.
"), page1 ); + pageLayout->addWidget( label ); + + m_url = new KURLRequester( page1 ); + m_url->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + m_url->setFilter( "*.kbarcode" ); + + label = new QLabel( i18n("&Filename:"), page1 ); + label->setBuddy( m_url ); + + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + + pageLayout->addWidget( label ); + pageLayout->addWidget( m_url ); + pageLayout->addItem( spacer ); + + addPage( page1, i18n("File Selection") ); + + connect( m_url, SIGNAL( textChanged( const QString & ) ), this, SLOT( enableControls() ) ); +} + +void BatchWizard::setupPage2() +{ + page2 = new QWidget( this, "page2" ); + QVBoxLayout* pageLayout = new QVBoxLayout( page2, 11, 6, "pageLayout"); + + QVButtonGroup* group = new QVButtonGroup( page2 ); + + radioSimple = new QRadioButton( i18n("Print &labels without data"), group ); + radioSqlArticles = new QRadioButton( i18n("Print &articles from KBarcodes SQL database"), group ); + radioVarImport = new QRadioButton( i18n("Import &variables and print"), group ); + radioAddressBook = new QRadioButton( i18n("Print &contacts from your addressbook"), group ); + radioSimple->setChecked( true ); + + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + pageLayout->addWidget( group ); + pageLayout->addItem( spacer ); + + connect( radioSimple, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioSqlArticles, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioVarImport, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioAddressBook, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + + addPage( page2, i18n("Data Source") ); +} + +void BatchWizard::setupPage3() +{ + page3 = new QWidgetStack( this, "page3" ); + + setupStackPage1(); + setupStackPage2(); + setupStackPage3(); + setupStackPage4(); + + addPage( page3, i18n("Print Data") ); +} + +void BatchWizard::setupPage4() +{ + page4 = new QVBox( this, "page4" ); + page4->setSpacing( 5 ); + + QHBox* hbox = new QHBox( page4 ); + hbox->setSpacing( 5 ); + + buttonTableInsert = new KPushButton( i18n("Insert Row"), hbox ); + buttonTableInsert->setIconSet( BarIconSet( "edit" ) ); + buttonTableRemove = new KPushButton( i18n("Delete Row"), hbox ); + buttonTableRemove->setIconSet( BarIconSet( "editdelete") ); + + m_varTable = new QTable( page4 ); + m_varTable->setReadOnly( false ); + m_varTable->setSelectionMode( QTable::SingleRow ); + + addPage( page4, i18n("Import Variables") ); + + connect( buttonTableInsert, SIGNAL( clicked() ), this, SLOT( slotTableInsert() ) ); + connect( buttonTableRemove, SIGNAL( clicked() ), this, SLOT( slotTableRemove() ) ); +} + +void BatchWizard::setupPage5() +{ + TokenProvider serial( this ); + + page5 = new QVBox( this, "page5" ); + + new QLabel( i18n( "KBarcode has support for placing serial numbers on labels. " + "If you did not use the [serial] token on your label in " + "a text field or a barcode, you can skip this page.
" + "Serial start is a free form start value containing at least one " + "number. This number is increased for every printed label on the " + "print out.
"), page5 ); + + QHBox* hbox = new QHBox( page5 ); + hbox->setSpacing( 5 ); + + new QLabel( i18n( "Serial start:" ), hbox ); + serialStart = new KLineEdit( serial.serial(), hbox ); + + serialInc = new KIntNumInput( 1, hbox ); + serialInc->setLabel( i18n( "Serial increment:" ), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + serialInc->setRange( 1, 10000, 1, false ); + + addPage( page5, i18n("Serial Number") ); +} + +void BatchWizard::setupPage10() +{ + page10 = new QWidget( this, "page10" ); + QVBoxLayout* pageLayout = new QVBoxLayout( page10, 11, 6, "pageLayout"); + + QVButtonGroup* group = new QVButtonGroup( page10 ); + + radioPrinter = new QRadioButton( i18n("&Print to a system printer or to a file"), group ); + radioImage = new QRadioButton( i18n("&Create images"), group ); + + imageBox = new QVBox( group ); + imageBox->setMargin( 10 ); + + radioBarcode = new QRadioButton( i18n("Print to a special &barcode printer"), group ); + + QHBox* directoryBox = new QHBox( imageBox ); + directoryBox->setSpacing( 5 ); + QLabel* label = new QLabel( i18n("Output &Directory:"), directoryBox ); + imageDirPath = new KURLRequester( directoryBox ); + imageDirPath->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + label->setBuddy( directoryBox ); + + QHBox* formatBox = new QHBox( imageBox ); + label = new QLabel( i18n("Output File &Format:"), formatBox ); + + QStringList formats = KImageIO::types( KImageIO::Writing ); + comboFormat = new KComboBox( false, formatBox ); + comboFormat->insertStringList( formats ); + if( formats.contains( PNG_FORMAT ) ) + comboFormat->setCurrentItem( formats.findIndex( PNG_FORMAT ) ); + label->setBuddy( comboFormat ); + + QVButtonGroup* imageNameGroup = new QVButtonGroup( i18n("&Filename:"), imageBox ); + radioImageFilenameArticle = new QRadioButton( i18n("Use &article number for filename"), imageNameGroup ); + radioImageFilenameBarcode = new QRadioButton( i18n("Use &barcode number for filename"), imageNameGroup ); + radioImageFilenameCustom = new QRadioButton( i18n("Use &custom filename:"), imageNameGroup ); + editImageFilename = new KLineEdit( imageNameGroup ); + radioImageFilenameBarcode->setChecked( true ); + + labelInfo = new QLabel( page10 ); + + radioPrinter->setChecked( true ); + + checkKeepOpen = new QCheckBox( i18n("&Keep window open after printing."), page10 ); + + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + pageLayout->addWidget( group ); + pageLayout->addItem( spacer ); + pageLayout->addWidget( labelInfo ); + pageLayout->addWidget( checkKeepOpen ); + + connect( radioPrinter, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioImage, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioBarcode, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + + connect( radioImageFilenameArticle, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioImageFilenameBarcode, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioImageFilenameCustom, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + + connect( imageDirPath, SIGNAL( textChanged( const QString & ) ), this, SLOT( enableControls() ) ); + + addPage( page10, i18n("Output Device") ); +} + +void BatchWizard::setupStackPage1() +{ + stack1 = new QVBox( page3, "stack1" ); + stack1->setSpacing( 5 ); + + QHBox* hbox = new QHBox( stack1 ); + hbox->setSpacing( 5 ); + + new QLabel( i18n( "Customer name and no.:" ), hbox ); + customerName = new KComboBox( false, hbox ); + customerId = new KComboBox( false, hbox ); + + QHBox* hButtonBox = new QHBox( stack1 ); + hButtonBox->setSpacing( 5 ); + + buttonAdd = new KPushButton( i18n( "&Add..." ), hButtonBox ); + buttonImport = new KPushButton( i18n("&Import..."), hButtonBox ); + buttonEdit = new KPushButton( i18n( "&Edit..." ), hButtonBox ); + buttonRemove = new KPushButton( i18n("&Remove" ), hButtonBox ); + buttonRemoveAll = new KPushButton( i18n("R&emove All"), hButtonBox ); + + KPopupMenu* mnuImport = new KPopupMenu( this ); + mnuImport->insertItem( i18n("Import from File ..."), this, SLOT( loadFromFile() ) ); + mnuImport->insertItem( i18n("Import from Clipboard ..."), this, SLOT( loadFromClipboard() ) ); + mnuImport->insertItem( i18n("Import barcode_basic"), this, SLOT( addAllItems() ) ); + buttonImport->setPopup( mnuImport ); + + sqlList = new KListView( stack1 ); + sqlList->addColumn( i18n("Index") ); + sqlList->addColumn( i18n("Number of Labels") ); + sqlList->addColumn( i18n("Article Number") ); + sqlList->addColumn( i18n("Group") ); + sqlList->setAllColumnsShowFocus( true ); + connect( sqlList, SIGNAL(doubleClicked(QListViewItem*,const QPoint &,int)), + this, SLOT(changeItem(QListViewItem*,const QPoint &,int))); + + connect( customerName, SIGNAL( activated(int) ), this, SLOT( customerNameChanged(int) ) ); + connect( customerId, SIGNAL( activated(int) ), this, SLOT( customerIdChanged(int) ) ); + connect( buttonAdd, SIGNAL( clicked() ), this, SLOT( addItem() ) ); + connect( buttonEdit, SIGNAL( clicked() ), this, SLOT( editItem() ) ); + connect( buttonRemove, SIGNAL( clicked() ), this, SLOT( removeItem() ) ); + connect( buttonRemoveAll, SIGNAL( clicked() ), sqlList, SLOT( clear() ) ); + connect( buttonRemoveAll, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + + page3->addWidget( stack1 ); +} + +void BatchWizard::setupStackPage2() +{ + stack2 = new QHBox( page3, "stack2" ); + stack2->setSpacing( 5 ); + + QVButtonGroup* group = new QVButtonGroup( stack2 ); + radioImportManual = new QRadioButton( i18n("Enter &data manually"), group ); + radioImportSql = new QRadioButton( i18n("Import variables from a &SQL table"), group ); + labelSqlQuery = new QLabel( i18n("Please enter a sql &query:"), group ); + importSqlQuery = new KLineEdit( group ); + labelSqlQuery->setBuddy( importSqlQuery ); + + radioImportCSV = new QRadioButton( i18n("Import from a &CSV file"), group ); + labelCsvFile= new QLabel( i18n("Please select a csv &file:"), group ); + importCsvFile = new KURLRequester( group ); + labelCsvFile->setBuddy( importCsvFile ); + labelEncoding = new QLabel( i18n("&Encoding:"), group ); + comboEncoding = new EncodingCombo( group ); + labelEncoding->setBuddy( comboEncoding ); + + radioImportManual->setChecked( true ); + + QVBox* box = new QVBox( stack2 ); + box->setSpacing( 5 ); + + new QLabel( i18n("Available Variables:"), box ); + m_varList = new KListBox( box ); + + connect( radioImportManual, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioImportSql, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioImportCSV, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( importSqlQuery, SIGNAL( textChanged( const QString & ) ), this, SLOT( enableControls() ) ); + connect( importCsvFile, SIGNAL( textChanged( const QString & ) ), this, SLOT( enableControls() ) ); + + page3->addWidget( stack2 ); +} + +void BatchWizard::setupStackPage3() +{ + stack3 = new QVBox( page3, "stack3" ); + + numLabels = new KIntNumInput( 1, stack3 ); + numLabels->setRange( 1, 100000, 1, true ); + numLabels->setLabel( i18n("&Number of labels to print:"), AlignLeft | AlignVCenter ); + + page3->addWidget( stack3 ); +} + +void BatchWizard::setupStackPage4() +{ + stack4 = new QWidget( page3, "stack4" ); + + QHBoxLayout* mainLayout = new QHBoxLayout( stack4 ); + + QVBox* list1 = new QVBox( stack4 ); + QVBox* list2 = new QVBox( stack4 ); + + QFrame* buttons = new QFrame( stack4 ); + buttons->setMargin( 10 ); + + QVBoxLayout* layout = new QVBoxLayout( buttons ); + QSpacerItem* spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + QSpacerItem* spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + + buttonAddAllAddress = new KPushButton( buttons ); + buttonAddAddress = new KPushButton( buttons ); + buttonRemoveAddress = new KPushButton( buttons );; + buttonRemoveAllAddress = new KPushButton( buttons ); + + buttonAddAllAddress->setIconSet( BarIconSet( "2rightarrow" ) ); + buttonAddAddress->setIconSet( BarIconSet( "1rightarrow" ) ); + buttonRemoveAddress->setIconSet( BarIconSet( "1leftarrow" ) ); + buttonRemoveAllAddress->setIconSet( BarIconSet( "2leftarrow" ) ); + + QToolTip::add( buttonAddAllAddress, i18n("Add all contacts to the list of contacts which will be printed.") ); + QToolTip::add( buttonAddAddress, i18n("Add selected contacts to the list of contacts which will be printed.") ); + QToolTip::add( buttonRemoveAddress, i18n("Remove selected contacts from the list of contacts which will be printed.") ); + QToolTip::add( buttonRemoveAllAddress, i18n("Remove all contacts from the list of contacts which will be printed.") ); + + layout->addItem( spacer1 ); + layout->addWidget( buttonAddAllAddress ); + layout->addWidget( buttonAddAddress ); + layout->addWidget( buttonRemoveAddress ); + layout->addWidget( buttonRemoveAllAddress ); + layout->addItem( spacer2 ); + + mainLayout->addWidget( list1 ); + mainLayout->addWidget( buttons ); + mainLayout->addWidget( list2 ); + + mainLayout->setStretchFactor( list1, 2 ); + mainLayout->setStretchFactor( list2, 2 ); + + new QLabel( i18n("All Addresses"), list1 ); + new QLabel( i18n("Selected Addresses"), list2 ); + + listAddress = new KListView( list1 ); + listAddress->addColumn( i18n("Given Name"), 0 ); + listAddress->addColumn( i18n("Family Name"), 1 ); + listAddress->addColumn( i18n("Email Address"), 2 ); + listAddress->setMultiSelection( true ); + listAddress->setAllColumnsShowFocus( true ); + + listAddress->setColumnWidthMode( 0, QListView::Maximum ); + listAddress->setColumnWidthMode( 1, QListView::Maximum ); + listAddress->setColumnWidthMode( 2, QListView::Maximum ); + + listSelectedAddress = new KListView( list2 ); + listSelectedAddress->addColumn( i18n("Given Name"), 0 ); + listSelectedAddress->addColumn( i18n("Family Name"), 1 ); + listSelectedAddress->addColumn( i18n("Email Address"), 2 ); + listSelectedAddress->setMultiSelection( true ); + listSelectedAddress->setAllColumnsShowFocus( true ); + + listSelectedAddress->setColumnWidthMode( 0, QListView::Maximum ); + listSelectedAddress->setColumnWidthMode( 1, QListView::Maximum ); + listSelectedAddress->setColumnWidthMode( 2, QListView::Maximum ); + + connect( buttonAddAddress, SIGNAL( clicked() ), this, SLOT( slotAddAddress() ) ); + connect( buttonRemoveAddress, SIGNAL( clicked() ), this, SLOT( slotRemoveAddress() ) ); + connect( buttonAddAllAddress, SIGNAL( clicked() ), this, SLOT( slotAddAllAddress() ) ); + connect( buttonRemoveAllAddress, SIGNAL( clicked() ), this, SLOT( slotRemoveAllAddress() ) ); + + page3->addWidget( stack4 ); +} + +void BatchWizard::setupSql() +{ + SqlTables* tables = SqlTables::getInstance(); + if( !tables->isConnected() ) + return; + + QSqlCursor cur( TABLE_CUSTOMER ); + cur.select(); + customerId->clear(); + customerName->clear(); + while ( cur.next() ) { + customerId->insertItem( cur.value("customer_no" ).toString() ); + customerName->insertItem( cur.value("customer_name" ).toString() ); + } +} + +void BatchWizard::enableControls() +{ + setAppropriate( page4, radioVarImport->isChecked() ); + + radioSqlArticles->setEnabled( SqlTables::getInstance()->isConnected() ); + radioImportSql->setEnabled( SqlTables::getInstance()->isConnected() ); + + importCsvFile->setEnabled( radioImportCSV->isChecked() ); + labelCsvFile->setEnabled( radioImportCSV->isChecked() ); + importSqlQuery->setEnabled( radioImportSql->isChecked() ); + labelSqlQuery->setEnabled( radioImportSql->isChecked() ); + labelEncoding->setEnabled( radioImportCSV->isChecked() ); + comboEncoding->setEnabled( radioImportCSV->isChecked() ); + + buttonRemove->setEnabled( sqlList->childCount() ); + buttonRemoveAll->setEnabled(sqlList->childCount() ); + buttonEdit->setEnabled( sqlList->childCount() ); + + imageBox->setEnabled( radioImage->isChecked() ); + + if( radioImportSql->isChecked() ) + setNextEnabled( page3, !importSqlQuery->text().isEmpty() ); + else if( radioImportCSV->isChecked() ) + setNextEnabled( page3, !importCsvFile->url().isEmpty() ); + else if( radioImportManual->isChecked() ) + setNextEnabled( page3, true ); + + editImageFilename->setEnabled( radioImageFilenameCustom->isChecked() ); + radioImageFilenameArticle->setEnabled( radioSqlArticles->isChecked() ); + + setNextEnabled( page1, !m_url->url().isEmpty() ); + + if( radioAddressBook->isChecked() ) + setNextEnabled( page3, listSelectedAddress->childCount() ); + + if( radioImage->isChecked() ) + setFinishEnabled( page10, !imageDirPath->url().isEmpty() ); + else + setFinishEnabled( page10, true ); +} + +void BatchWizard::showPage( QWidget* p ) +{ + if( p == page3 ) + { + if( radioSqlArticles->isChecked() ) + page3->raiseWidget( stack1 ); + else if( radioVarImport->isChecked() ) + { + page3->raiseWidget( stack2 ); + fillVarList(); + } + else if( radioSimple->isChecked() ) + page3->raiseWidget( stack3 ); + else if( radioAddressBook->isChecked() ) + { + page3->raiseWidget( stack4 ); + fillAddressList(); + } + } + else if( p == page4 ) + if( !fillVarTable() ) + return; + + + KWizard::showPage( p ); +} + +void BatchWizard::accept() +{ + printNow( QString::null ); +} + +void BatchWizard::printNow( const QString & printer, bool bUserInteraction ) +{ + BatchPrinter* batch = NULL; + KPrinter* prn = NULL; + int batchType = 0; + + // let's check if the label file does even exist! + if( !QFile::exists( m_url->url() ) ) + { + KMessageBox::error( this, QString( i18n("The label file %1 was not found") ).arg( m_url->url()) ); + return; + } + + if( radioPrinter->isChecked() ) + { + int move = 0; + if( bUserInteraction ) + { + PrintLabelDlg pld( this, "pld" ); + pld.setLabelsEnabled( false ); + if( pld.exec() != QDialog::Accepted ) + return; + + move = pld.position(); + PrinterSettings::getInstance()->getData()->border = pld.border(); + } + + prn = PrinterSettings::getInstance()->setupPrinter( m_url->url(), this, !printer.isEmpty(), printer ); + if( !prn ) + return; + + batch = new BatchPrinter( prn, this ); + batch->setMove( move ); + + batchType = BatchPrinter::POSTSCRIPT; + } + else if( radioBarcode->isChecked() ) + { + BarcodePrinterDlg dlg(this); + if( dlg.exec() != QDialog::Accepted ) + return; + + batch = new BatchPrinter( dlg.printToFile() ? dlg.fileName() : dlg.deviceName(), + dlg.outputFormat(), this ); + batchType = BatchPrinter::BCP; + } + else if( radioImage->isChecked() ) + { + batch = new BatchPrinter( imageDirPath->url(), this ); + if( radioImageFilenameArticle->isChecked() ) + batch->setImageFilename( BatchPrinter::E_ARTICLE ); + else if( radioImageFilenameBarcode->isChecked() ) + batch->setImageFilename( BatchPrinter::E_BARCODE ); + else if( radioImageFilenameCustom->isChecked() ) + { + batch->setImageFilename( BatchPrinter::E_CUSTOM ); + batch->setImageCustomFilename( editImageFilename->text() ); + } + + batchType = BatchPrinter::IMAGE; + } + + if( !checkKeepOpen->isChecked() ) + KWizard::accept(); + + KApplication::setOverrideCursor( QCursor( Qt::ArrowCursor ), true ); + setupBatchPrinter( batch, batchType ); + KApplication::restoreOverrideCursor(); + + delete prn; + delete batch; +} + +void BatchWizard::setupBatchPrinter( BatchPrinter* batch, int m ) +{ + Definition* def = NULL; + QString description; + bool kbarcode18; + + fillByteArray(); + QDomDocument doc( "KBarcodeLabel" ); + if ( !doc.setContent( m_bytearray ) ) + return; + + XMLUtils util; + util.readXMLHeader( &doc, description, kbarcode18, &def ); + + QBuffer buffer( m_bytearray ); + if( !buffer.open( IO_ReadOnly ) ) + return; + + batch->setBuffer( &buffer ); + batch->setSerial( serialStart->text(), serialInc->value() ); + batch->setName( m_url->url() ); + batch->setDefinition( def ); + batch->setImageFormat( comboFormat->currentText() ); + + if( radioSqlArticles->isChecked() ) + { + int labels = 0; + batch->setCustomer( customerId->currentText() ); + + // sort by group + sqlList->setSorting( 3, true ); + sqlList->sort(); + + QValueList* dlist = new QValueList; + QListViewItem* item = sqlList->firstChild(); + while( item ) + { + BatchPrinter::data m_data; + m_data.number = item->text( 1 ).toInt(); + labels += m_data.number; + m_data.article_no = item->text( 2 ); + m_data.group = item->text( 3 ); + + dlist->append( m_data ); + item = item->nextSibling(); + }; + + batch->setData( dlist ); + batch->setLabels( labels ); + } + else if( radioSimple->isChecked() ) + { + batch->setLabels( numLabels->value() ); + + // do a dirty drick, TODO: refactor BatchPrinter in the future + QValueList* dlist = new QValueList; + BatchPrinter::data m_data; + m_data.number = numLabels->value(); + dlist->append( m_data ); + + batch->setData( dlist ); + } + else if( radioVarImport->isChecked() ) + { + TVariableList* tVariableList = new TVariableList; + for( int i=0; inumRows(); i++ ) + { + QMap map; + for( int z=0; znumCols(); z++ ) + map[ m_varTable->horizontalHeader()->label( z ) ] = m_varTable->text( i, z ); + tVariableList->append( map ); + } + + batch->setData( tVariableList ); + } + else if( radioAddressBook->isChecked() ) + { + KABC::AddresseeList* list = new KABC::AddresseeList; + QListViewItem* item = listSelectedAddress->firstChild(); + while( item ) + { + list->append( static_cast(item)->address() ); + item = item->nextSibling(); + } + + batch->setData( list ); + } + + if( m == BatchPrinter::POSTSCRIPT ) + batch->start(); + else if( m == BatchPrinter::IMAGE ) + batch->startImages(); + else if( m == BatchPrinter::BCP ) + batch->startBCP(); + + delete def; +} + + +void BatchWizard::addItem() +{ + DSSmallDialogs::AddItemsDialog aid( this, "aid" ); + aid.setGroupCompletion( compGroup ); + connect( &aid, SIGNAL( add( const QString &, const QString &, int) ), + this, SLOT( slotAddItem( const QString &, const QString &, int) ) ); + + aid.exec(); +} + +bool BatchWizard::slotAddItem( const QString & article, const QString & group, int count ) +{ + return this->addItem( article, group, count, true ); +} + +bool BatchWizard::addItem( const QString & article, const QString & group, int count, bool msg ) +{ + if( !article.isEmpty() && !existsArticle( article ) ) { + if( msg ) + KMessageBox::error( this, i18n("Please enter a valid article ID") ); + return false; + } + + QString temp; + temp.sprintf("%0*i", 5, sqlList->childCount() + 1 ); + + KListViewItem* item = new KListViewItem( sqlList, temp, QString( "%1" ).arg( count ), + article, group ); + sqlList->insertItem( item ); + + addGroupCompletion( group ); + enableControls(); + + return true; +} + +void BatchWizard::addGroupCompletion( const QString & group ) +{ + if( !group.isEmpty() ) + { + QStringList slist = compGroup->items(); + if(!slist.contains( group ) ) + compGroup->addItem( group ); + } +} + +bool BatchWizard::existsArticle( const QString & article ) +{ + if( article.isEmpty() ) + return false; + + QSqlQuery query( "select uid from barcode_basic where article_no='" + article + "'" ); + while ( query.next() ) + return true; + + return false; +} + +void BatchWizard::editItem() +{ + QListViewItem* item = sqlList->selectedItem(); + if( item ) + changeItem( item, QPoint(0,0), 0 ); +} + +void BatchWizard::changeItem( QListViewItem* item, const QPoint &, int ) +{ + if(!item) + return; + + DSSmallDialogs::AddItemsDialog aid( item->text( 2 ), item->text( 3 ), + item->text( 1 ).toInt(), this, "aid" ); + aid.setGroupCompletion( compGroup ); + + if( aid.exec() == QDialog::Accepted ) + { + item->setText( 1, QString::number( aid.count() ) ); + item->setText( 2, aid.articleNo() ); + item->setText( 3, aid.groupName() ); + addGroupCompletion( aid.groupName() ); + enableControls(); + } +} + +void BatchWizard::removeItem() +{ + QListViewItem* item = sqlList->firstChild(); + while( item ) + { + if( item->isSelected() ) + { + QListViewItem* it = item->nextSibling(); + delete item; + + while( it ) + { + int a = it->text( 0 ).toInt(); + QString temp; + temp.sprintf("%0*i", 5, a - 1 ); + it->setText( 0, temp ); + it = it->nextSibling(); + } + + break; + } else + item = item->nextSibling(); + } + + enableControls(); +} + +void BatchWizard::customerIdChanged( int index ) +{ + customerName->setCurrentItem( index ); + enableControls(); +} + +void BatchWizard::customerNameChanged( int index ) +{ + customerId->setCurrentItem( index ); + enableControls(); +} + +void BatchWizard::addAllItems() +{ + DSSmallDialogs::AddAllDialog* dlg = new DSSmallDialogs::AddAllDialog( this, "dlg" ); + if( dlg->exec() == QDialog::Accepted ) + { + QString temp; + QString group = dlg->groupName(); + const QString num = QString::number( dlg->numberLabels() ); + + QSqlQuery query("SELECT article_no FROM " TABLE_BASIC ); + while( query.next() ) + { + temp.sprintf("%0*i", 5, sqlList->childCount() + 1 ); + new KListViewItem( sqlList, temp, num, query.value( 0 ).toString(), group ); + } + + enableControls(); + } +} + +void BatchWizard::loadFromFile() +{ + QString f = KFileDialog::getOpenFileName( 0, 0, this ); + if( !f.isEmpty() ) + loadFromFile( f ); +} + +void BatchWizard::loadFromClipboard() +{ + QClipboard *cb = KApplication::clipboard(); + loadData( cb->text() ); +} + +void BatchWizard::loadFromFile( const QString & url ) +{ + QByteArray data; + QFile file( url ); + + if( !file.open( IO_ReadOnly ) ) + { + qDebug("Unable to open file: %s", url.latin1() ); + return; + } + + data = file.readAll(); + + loadData( QString( data ) ); +} + +void BatchWizard::loadData( const QString & data ) +{ + labelprinterdata* lpdata = PrinterSettings::getInstance()->getData(); + if( lpdata->separator.isEmpty() ) + { + KMessageBox::sorry( this, i18n("Separator is empty. Please set it to a value.") ); + return; + } + + // new config entry!!! + KConfig* config = kapp->config(); + config->setGroup("FileFormat"); + int pos[3] = { config->readNumEntry("Data0", 0 ), + config->readNumEntry("Data1", 1 ), + config->readNumEntry("Data2", 2 ) }; + + bool custom_article_no = lpdata->useCustomNo; + QBuffer buf( data.utf8() ); + CSVFile file( buf ); + + QStringList list, dropped; + QString article, quantity, group; + + while( file.isValid() && !file.isEof() ) + { + list = file.readNextLine(); + while( list.count() < 3 ) + list.append( QString::null ); + + if( pos[0] == 0 ) + quantity = list[0]; + else if( pos[0] == 1 ) + article = list[0]; + else + group = list[0]; + + if( pos[1] == 0 ) + quantity = list[1]; + else if( pos[1] == 1 ) + article = list[1]; + else + group = list[1]; + + if( pos[2] == 0 ) + quantity = list[2]; + else if( pos[2] == 1 ) + article = list[2]; + else + group = list[2]; + + // data[0] == quantity + // data[1] == article_no + // data[2] == group + + bool qint = false; + (void)quantity.toInt( &qint ); + + if( qint && custom_article_no ) { + qint = false; + QSqlQuery query("SELECT article_no FROM customer_text WHERE article_no_customer='" + article + "'" ); + while( query.next() ) { + article = query.value( 0 ).toString(); + qint = true; + break; + } + } + + if( qint ) // && existsArticle( article ) + { + if( !addItem( QString( article ), QString( group ), quantity.toInt(), false ) ) + dropped.append( quantity + lpdata->separator + article + lpdata->separator + group ); + } + } + + if( !dropped.isEmpty() ) +#if QT_VERSION >= 0x030100 + KMessageBox::informationList( this, i18n("The following items can not be added:" )+ "", dropped ); +#else + KMessageBox::questionYesNoList( this, i18n("The following items can not be added:" )+ "", dropped ); +#endif + + enableControls(); +} + +void BatchWizard::fillByteArray() +{ + if( m_bytearray_filename != m_url->url() ) + { + QFile f( m_url->url() ); + if ( !f.open( IO_ReadOnly ) ) + { + m_bytearray_filename = QString::null; + m_bytearray.resize( 0 ); + return ; + } + + m_bytearray = f.readAll(); + f.close(); + } +} + +void BatchWizard::fillVarList() +{ + fillByteArray(); + QDomDocument doc( "KBarcodeLabel" ); + if ( !doc.setContent( m_bytearray ) ) + return; + + XMLUtils util; + DocumentItemList list; + list.setAutoDelete( true ); + + TokenProvider token( this ); + Definition* def = NULL; + + QString description; + bool kbarcode18; + util.readXMLHeader( &doc, description, kbarcode18, &def ); + util.readDocumentItems( &list, &doc, &token, kbarcode18 ); + + token.setCurrentDocumentItems( list ); + + QStringList vars = token.listUserVars(); + m_varList->clear(); + m_varList->insertStringList( vars ); + m_varTable->setNumCols( vars.count() ); + for( unsigned int i = 0; i < vars.count(); i++ ) + { + vars[i] = vars[i].right( vars[i].length() - 1 ); + m_varTable->horizontalHeader()->setLabel( i, vars[i] ); + } + + delete def; +} + +void BatchWizard::fillAddressList() +{ + KABC::AddressBook* ab = KABC::StdAddressBook::self(); + listAddress->clear(); + + KABC::AddressBook::Iterator it; + listAddress->setUpdatesEnabled( false ); + for ( it = ab->begin(); it != ab->end(); ++it ) + new AddressListViewItem( listAddress, *it ); + listAddress->setUpdatesEnabled( true ); +} + +bool BatchWizard::fillVarTable() +{ + // Clear the table + m_varTable->setNumRows( 0 ); + + if( radioImportSql->isChecked() ) + { + int y = 0; + int x; + QSqlSelectCursor query( importSqlQuery->text(), SqlTables::getInstance()->database() ); + query.select(); + if( query.lastError().type() != QSqlError::None ) + { + KMessageBox::error( this, i18n("Can't execute SQL query:
") + query.lastError().text() + "
" ); + return false; + } + + if( m_varTable->numRows() < query.size() ) + m_varTable->setNumRows( query.size() ); + + while( query.next() ) + { + for( x=0;xnumRows();x++ ) + m_varTable->setText( y, x, query.value( m_varTable->horizontalHeader()->label( x ) ).toString() ); + + y++; + } + } + else if( radioImportCSV->isChecked() ) + { + CSVFile file( importCsvFile->url() ); + file.setEncoding( comboEncoding->currentText() ); + + QStringList heading; + QStringList data; + int i = 0; + + file.setCSVFile(true); + if( !file.isValid() ) + { + KMessageBox::error( this, QString( i18n("Can't open file: %1") ).arg( importCsvFile->url() ) ); + return false; + } + + while( !file.isEof() ) + { + if( heading.isEmpty() ) + heading = file.readNextLine(); + else + { + data = file.readNextLine(); + + // add 100 rows to get a reasonable speed + if( m_varTable->numRows() <= i ) + m_varTable->setNumRows( i + 100 ); + + printf("datacount=%i\n", data.count() ); + for( unsigned int z = 0; z < data.count(); z++ ) + { + printf("numRows=%i\n", m_varTable->numCols() ); + for( int x = 0; x < m_varTable->numCols(); x++ ) + { + printf("horizontal header=%s\n", m_varTable->horizontalHeader()->label( x ).lower().latin1() ); + printf("heading=%s\n", heading[z].lower().latin1() ); + if( m_varTable->horizontalHeader()->label( x ).lower() == heading[z].lower() ) + { + printf("Reading: (%s)\n", data[z].latin1()); + m_varTable->setText( i, x, data[z] ); + break; + } + } + } + + if( data.count() ) + i++; + } + } + + m_varTable->setNumRows( i ); + } + + return true; +} + +void BatchWizard::slotTableInsert() +{ + m_varTable->insertRows( m_varTable->numRows(), 1 ); +} + +void BatchWizard::slotTableRemove() +{ + QTableSelection sel = m_varTable->selection( m_varTable->currentSelection() ); + m_varTable->removeRow( sel.topRow() ); +} + +void BatchWizard::setFilename( const QString & url ) +{ + m_url->setURL( url ); + enableControls(); +} + +void BatchWizard::setImportSqlQuery( const QString & query ) +{ + radioImportCSV->setChecked( false ); + radioImportManual->setChecked( false ); + radioImportSql->setChecked( true ); + + radioVarImport->setChecked( true ); + radioSqlArticles->setChecked( false ); + radioSimple->setChecked( false ); + + importSqlQuery->setText( query ); + + enableControls(); + + showPage( page3 ); + showPage( page4 ); +} + +void BatchWizard::setImportCsvFile( const QString & filename ) +{ + radioImportCSV->setChecked( true ); + radioImportManual->setChecked( false ); + radioImportSql->setChecked( false ); + + radioVarImport->setChecked( true ); + radioSqlArticles->setChecked( false ); + radioSimple->setChecked( false ); + + importCsvFile->setURL( filename ); + + enableControls(); + + showPage( page3 ); + showPage( page4 ); +} + +void BatchWizard::setNumLabels( const int n ) +{ + numLabels->setValue( n ); + radioSimple->setChecked( true ); + radioSqlArticles->setChecked( false ); + radioVarImport->setChecked( false ); + enableControls(); +} + +void BatchWizard::setOutputFormat( const int e ) +{ + radioBarcode->setChecked( false ); + radioImage->setChecked( false ); + radioPrinter->setChecked( false ); + + switch( e ) + { + case BatchPrinter::BCP: + radioBarcode->setChecked( true ); + break; + case BatchPrinter::IMAGE: + radioImage->setChecked( true ); + break; + default: + case BatchPrinter::POSTSCRIPT: + radioPrinter->setChecked( true ); + break; + } + + enableControls(); +} + +void BatchWizard::setSerialNumber( const QString & val, int inc ) +{ + serialInc->setValue( inc ); + serialStart->setText( val ); + + // Not needed here: enableControls(); +} + +void BatchWizard::slotAddAddress() +{ + moveAddress( listAddress, listSelectedAddress ); + enableControls(); +} + +void BatchWizard::slotAddAllAddress() +{ + moveAddress( listAddress, listSelectedAddress, true ); + enableControls(); +} + +void BatchWizard::slotRemoveAddress() +{ + moveAddress( listSelectedAddress, listAddress ); + enableControls(); +} + +void BatchWizard::slotRemoveAllAddress() +{ + moveAddress( listSelectedAddress, listAddress, true ); + enableControls(); +} + +void BatchWizard::moveAddress( QListView* src, QListView* dst, bool bAll ) +{ + QListViewItem* item = src->firstChild(); + QListViewItem* cur; + + while( item ) + { + if( bAll || item->isSelected() ) + { + cur = item; + item = item->nextSibling(); + + src->takeItem( cur ); + dst->insertItem( cur ); + cur->setSelected( false ); + } + else + item = item->nextSibling(); + } +} diff --git a/kbarcode/batchwizard.h b/kbarcode/batchwizard.h new file mode 100644 index 0000000..e736a6f --- /dev/null +++ b/kbarcode/batchwizard.h @@ -0,0 +1,266 @@ +/*************************************************************************** + batchwizard.h - description + ------------------- + begin : Sun Mar 20 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef BATCHWIZARD_H +#define BATCHWIZARD_H + +#include +#include "batchiface.h" + +class BatchPrinter; +class EncodingCombo; +class KComboBox; +class KCompletion; +class KIntNumInput; +class KLineEdit; +class KListBox; +class KListView; +class KPushButton; +class KURLRequester; +class QCheckBox; +class QHBox; +class QLabel; +class QListView; +class QListViewItem; +class QRadioButton; +class QTable; +class QVBox; +class QWidgetStack; + +class BatchWizard : public KWizard, public BatchIface { + Q_OBJECT + public: + BatchWizard( QWidget* parent = NULL, const char* name = NULL ); + ~BatchWizard(); + + /** reimplemented DCOP method from BatchIface + * Allow the user to add an article to print to KBarcode + * @p article article number to add + * @p group use group as group name for this article + * @p count number of labels to print for this article + * @p msgbox show a messagebox if adding the item fails + */ + bool addItem( const QString & article, const QString & group, int count, bool msgbox = true ); + + /** reimplemented DCOP method from BatchIface + * tests wether the arctile is existing in KBarcodes database + * @p article article number to test for + */ + virtual bool existsArticle( const QString & article ); + + /** reimplemented DCOP method from BatchIface + * import articles from a file. The user is asked for the filename + */ + virtual void loadFromFile( const QString & url ); + + /** reimplemented DCOP method from BatchIface + * print immediately with current settings + * @p printer print to this printer (must be known to the system) + * @p bUserInteraction if false no dialog will pop up besides the printer dialog + */ + virtual void printNow( const QString & printer, bool bUserInteraction = true ); + + /** reimplemented DCOP method from BatchIface + * to allow the user to set the label to be used + * @p url path of the label which shall get printed + */ + virtual void setFilename( const QString & url ); + + /** reimplemented DCOP method from BatchIface + * Set the batchwizards mode to print from imported data + * and import the data from the csv file @p filname + * @p filename csv file to import + */ + virtual void setImportCsvFile( const QString & filename ); + + /** reimplemented DCOP method from BatchIface + * Set the batchwizards mode to print from imported data + * and import the data from the sql query @p query + * @p query sql query to execute to get on user defined variables + */ + virtual void setImportSqlQuery( const QString & query ); + + /** reimplemented DCOP method from BatchIface + * set the numbers of labels to print. + * the option to print without data import is activated too using + * this option + * @p n number of labels to print + */ + virtual void setNumLabels( const int n ); + + /** reimplemented DCOP method from BatchIface + * sets wether the user wants to print to a postscript printer, + * a barcode printer or to image files. + * @p e is of datatype BatchPrinter::EOutputFormat + */ + virtual void setOutputFormat( const int e ); + + /** reimplemented DCOP method from BatchIface + * allow the user to set the value and start value for + * the serial number that can be used on labels using the [serial] token + * @p val value of the serial number (e.g. TEST0002) + * @p inc the serial number is increased that much for every label + */ + virtual void setSerialNumber( const QString & val, int inc ); + + public slots: + /** reimplemented DCOP method from BatchIface + * import articles from the clipboard + */ + virtual void loadFromClipboard(); + + + private slots: + void addAllItems(); + void enableControls(); + void customerIdChanged( int index ); + void customerNameChanged( int index ); + void addItem(); + bool slotAddItem( const QString & article, const QString & group, int count ); + void changeItem( QListViewItem* item, const QPoint &, int ); + void editItem(); + void removeItem(); + + void slotTableInsert(); + void slotTableRemove(); + void loadFromFile(); + + void slotAddAddress(); + void slotAddAllAddress(); + void slotRemoveAddress(); + void slotRemoveAllAddress(); + + private: + void moveAddress( QListView* src, QListView* dst, bool bAll = false ); + + void fillByteArray(); + void fillVarList(); + bool fillVarTable(); + void fillAddressList(); + + void setupPage1(); + void setupPage2(); + void setupPage3(); + void setupPage4(); + void setupPage5(); + void setupPage10(); + + void setupStackPage1(); + void setupStackPage2(); + void setupStackPage3(); + void setupStackPage4(); + + void setupSql(); + void setupBatchPrinter( BatchPrinter* batch, int m ); + + void addGroupCompletion( const QString & group ); + void loadData( const QString & data ); + + protected: + void accept(); + void showPage( QWidget* w ); + + private: + /** m_bytearray_filename is set whenever + * the kbarcide label file has been read into + * the buffer m_bytearray. Therefore we have only + * to re-read the bytearray when the filename was + * changed by the user. + */ + QString m_bytearray_filename; + QByteArray m_bytearray; + + QWidget* page1; + QWidget* page2; + QWidgetStack* page3; + QVBox* page4; + QVBox* page5; + QWidget* page10; + + QVBox* stack1; + QHBox* stack2; + QVBox* stack3; + QWidget* stack4; + + QVBox* imageBox; + + QLabel* labelInfo; + QLabel* labelSqlQuery; + QLabel* labelCsvFile; + QLabel* labelEncoding; + + QRadioButton* radioSqlArticles; + QRadioButton* radioVarImport; + QRadioButton* radioSimple; + QRadioButton* radioAddressBook; + + QRadioButton* radioPrinter; + QRadioButton* radioImage; + QRadioButton* radioBarcode; + + QRadioButton* radioImportSql; + QRadioButton* radioImportCSV; + QRadioButton* radioImportManual; + + QRadioButton* radioImageFilenameArticle; + QRadioButton* radioImageFilenameBarcode; + QRadioButton* radioImageFilenameCustom; + KLineEdit* editImageFilename; + KURLRequester* imageDirPath; + + KLineEdit* importSqlQuery; + KURLRequester* importCsvFile; + + KComboBox* customerName; + KComboBox* customerId; + KComboBox* comboFormat; + EncodingCombo* comboEncoding; + + KCompletion* compGroup; + + KIntNumInput* serialInc; + KIntNumInput* numLabels; + + QTable* m_varTable; + KListBox* m_varList; + + KListView* listAddress; + KListView* listSelectedAddress; + + KListView* sqlList; + KLineEdit* serialStart; + + QCheckBox* checkKeepOpen; + + KPushButton* buttonAddAddress; + KPushButton* buttonRemoveAddress; + KPushButton* buttonAddAllAddress; + KPushButton* buttonRemoveAllAddress; + + KPushButton* buttonAdd; + KPushButton* buttonImport; + KPushButton* buttonEdit; + KPushButton* buttonRemove; + KPushButton* buttonRemoveAll; + + KPushButton* buttonTableInsert; + KPushButton* buttonTableRemove; + + KURLRequester* m_url; +}; + +#endif // BATCHWIZARD_H diff --git a/kbarcode/commands.cpp b/kbarcode/commands.cpp new file mode 100644 index 0000000..a11c01b --- /dev/null +++ b/kbarcode/commands.cpp @@ -0,0 +1,604 @@ +/*************************************************************************** + commands.cpp - description + ------------------- + begin : Don Dez 19 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "commands.h" +#include "mycanvasview.h" + +#include "barkode.h" +#include "tcanvasitem.h" +#include "rectitem.h" +#include "textitem.h" +#include "imageitem.h" +#include "barcodeitem.h" +#include "lineitem.h" +//NY26 +#include "textlineitem.h" +//NY26 + + +// KDE includes +#include + +QPoint getFreePos( QCanvas* c ) +{ + MyCanvas* canvas = (MyCanvas*)c; + + if( !c->width() && !c->height() ) + return QPoint( canvas->rect().x(), canvas->rect().y() ); + + // TODO: fix for positions on label + int x = KApplication::random() % canvas->rect().width() - 20; + int y = KApplication::random() % canvas->rect().height() - 20; + + if( x > 0 && y > 0 ) + return QPoint( canvas->rect().x() + x, canvas->rect().y() + y ); + else + return QPoint( canvas->rect().x(), canvas->rect().y() ); +} + +CommandUtils::CommandUtils(TCanvasItem* item) + : QObject() +{ + m_canvas_item = item; + m_canvas_item->addRef(); + + c = m_canvas_item->canvas(); + /* NOT NEEDED: + if( m_canvas_item && m_canvas_item->item() ) + connect( m_canvas_item->item(), SIGNAL( destroyed() ), this, SLOT( documentItemDeleted() ) ); + */ +} + +CommandUtils::~CommandUtils() +{ + m_canvas_item->remRef(); +} + +bool CommandUtils::canvasHasItem() +{ + if( m_canvas_item && c ) + { + QCanvasItemList list = c->allItems(); + for( unsigned int i=0;icanvas() ); + m_item = NULL; + m_object = NULL; +} + +NewItemCommand::~NewItemCommand() +{ + m_item->remRef(); +} + +void NewItemCommand::execute() +{ + if( !m_item ) + { + create(); + + if( m_object ) + { + m_item = new TCanvasItem( cv ); + m_item->setItem( m_object ); + m_item->move( m_point.x(), m_point.y() ); + m_item->addRef(); + + /* NOT NEEDED: + connect( m_object, SIGNAL( destroyed() ), this, SLOT( documentItemDeleted() ) ); + */ + } + } + + if( m_item ) + { + m_item->setCanvas( cv->canvas() ); + m_item->show(); + m_item->update(); + cv->setCurrent( m_item ); + } +} + +void NewItemCommand::unexecute() +{ + if( m_item ) { + m_item->setCanvas( NULL ); + m_item->hide(); + } +} + +void NewItemCommand::documentItemDeleted() +{ + /** the document item got deleted, so that we can assume the TCanvasItem + * was deleted to (as it usually deltes the document item) + */ + + /* NOT NEEDED: + m_item = NULL; + m_object = NULL; + + qDebug("NewItemCommand: Document item removed from list!"); + delete this; + */ +} + + +void ResizeCommand::setRect( int cx, int cy, int cw, int ch ) +{ + // make sure that the item cannot + // be resized to a negative value + if( cw <= 0 ) + cw = orect.width(); + + if( ch <= 0 ) + ch = orect.height(); + + rect = QRect( cx, cy, cw, ch ); +} + +void ResizeCommand::execute() +{ + if( canvasHasItem() ) { + if( m_shift && rect.width() ) { + double r = (double)orect.height() / (double)orect.width(); + rect.setWidth( int(rect.height() / r) ); + } + + m_canvas_item->moveMM( rect.x(), rect.y() ); + m_canvas_item->setSizeMM( rect.width(), rect.height() ); + m_canvas_item->update(); + + if( m_canvas_item->item()->rtti() == eRtti_Image ) + { + ImageItem* item = static_cast(m_canvas_item->item()); + item->updateImage(); + } + } +} + +void ResizeCommand::unexecute() +{ + if( canvasHasItem() ) { + m_canvas_item->moveMM( orect.x(), orect.y() ); + m_canvas_item->setSizeMM( orect.width(), orect.height() ); + m_canvas_item->update(); + + if( m_canvas_item->item()->rtti() == eRtti_Image ) + { + ImageItem* item = static_cast(m_canvas_item->item()); + item->updateImage(); + } + } +} + +void MoveCommand::execute() +{ + if( canvasHasItem() ) + { + m_canvas_item->moveByMM( x, y ); + m_canvas_item->update(); + } +} + +void MoveCommand::unexecute() +{ + if( canvasHasItem() ) + { + m_canvas_item->moveByMM( -x, -y ); + m_canvas_item->update(); + } +} + +ChangeZCommand::ChangeZCommand( int z, TCanvasItem* it ) + : CommandUtils( it ) +{ + m_z = z; + m_oldz = (int)m_canvas_item->z(); +} + +void ChangeZCommand::execute() +{ + if( canvasHasItem() ) + { + m_canvas_item->setZ( m_z ); + m_canvas_item->update(); + } +} + +void ChangeZCommand::unexecute() +{ + if( canvasHasItem() ) + { + m_canvas_item->setZ( m_oldz ); + m_canvas_item->update(); + } +} + +void LockCommand::execute() +{ + if( canvasHasItem() ) + { + m_canvas_item->item()->setLocked( m_locked ); + m_canvas_item->update(); + } +} + +void LockCommand::unexecute() +{ + if( canvasHasItem() ) + { + m_canvas_item->item()->setLocked( !m_locked ); + m_canvas_item->update(); + } +} + +PictureCommand::PictureCommand( double r, bool mh, bool mv, EImageScaling s, ImageItem* it ) + : CommandUtils( it->canvasItem() ) +{ + rotate = r; + mirrorv = mv; + mirrorh = mh; + scaling = s; + + orotate = it->rotation(); + omirrorv = it->mirrorVertical(); + omirrorh = it->mirrorHorizontal(); + oscaling = it->scaling(); + + oexpression = it->expression(); + opixmap = it->pixmap(); + opixserial = opixmap.serialNumber(); + + oldsize.setWidth( it->rect().width() ); + oldsize.setHeight( it->rect().height() ); + + m_item = it; +} + +void PictureCommand::setExpression( const QString & expr ) +{ + expression = expr; +} + +void PictureCommand::setPixmap( const QPixmap & pix ) +{ + pixmap = pix; + pixserial = pixmap.serialNumber(); +} + +void PictureCommand::execute() +{ + if( canvasHasItem() ) { + m_item->setRotation( rotate ); + m_item->setMirrorVertical( mirrorv ); + m_item->setMirrorHorizontal( mirrorh ); + m_item->setScaling( scaling ); + m_item->setExpression( expression ); + m_item->setPixmap( pixmap ); + + if( !pixmap.isNull() && pixserial != opixserial ) + m_item->canvasItem()->setSize( pixmap.width(), pixmap.height() ); + } +} + +void PictureCommand::unexecute() +{ + if( canvasHasItem() ) { + m_item->setRotation( orotate ); + m_item->setMirrorVertical( omirrorv ); + m_item->setMirrorHorizontal( omirrorh ); + m_item->setScaling( oscaling ); + m_item->setExpression( oexpression ); + m_item->setPixmap( opixmap ); + m_item->canvasItem()->setSize( oldsize.width(), oldsize.height() ); + } +} + +TextChangeCommand::TextChangeCommand( TextItem* it, QString t ) + : CommandUtils( it->canvasItem() ) +{ + m_item = it; + text = t; + oldtext = m_item->text(); +} + +void TextChangeCommand::execute() +{ + if( canvasHasItem() ) + m_item->setText( text ); +} + +void TextChangeCommand::unexecute() +{ + if( canvasHasItem() ) + m_item->setText( oldtext ); +} + +TextRotationCommand::TextRotationCommand( double rot, TextItem* t ) + : CommandUtils( t->canvasItem() ), m_item( t ) +{ + rot1 = rot; + rot2 = t->rotation(); +} + +void TextRotationCommand::execute() +{ + m_item->setRotation( rot1 ); +} + +void TextRotationCommand::unexecute() +{ + m_item->setRotation( rot2 ); +} + +//NY24 +TextLineChangeCommand::TextLineChangeCommand( TextLineItem* it, QString t, int font , int magvert, int maghor) + : CommandUtils( it->canvasItem() ) +{ + m_item = it; + text = t; + oldtext = m_item->text(); + m_font = font; + m_mag_vert = magvert; + m_mag_hor = maghor; +} + +void TextLineChangeCommand::execute() +{ + if( canvasHasItem() ){ + m_item->setText( text ); + m_item->setFont(m_font); + m_item->setMagVert(m_mag_vert); + m_item->setMagHor(m_mag_hor); + } +} + +void TextLineChangeCommand::unexecute() +{ + if( canvasHasItem() ) + m_item->setText( oldtext ); +} +//NY24 + +BarcodeCommand::BarcodeCommand( BarcodeItem* bcode, Barkode* d ) + : CommandUtils( bcode->canvasItem() ) +{ + m_item = bcode; + olddata = *bcode; + data = d; +} + +void BarcodeCommand::execute() +{ + if( canvasHasItem() ) { + m_item->setData( *data ); + m_item->updateBarcode(); + } +} + +void BarcodeCommand::unexecute() +{ + if( canvasHasItem() ) { + m_item->setData( olddata ); + m_item->updateBarcode(); + } +} + +void NewPictureCommand::create() +{ + ImageItem* r = new ImageItem(); + m_object = r; +} + +NewRectCommand::NewRectCommand( MyCanvasView* v, bool circle ) + : NewItemCommand( v, i18n("New Rectangle") ) +{ + m_circle = circle; +} + +void NewRectCommand::create() +{ + RectItem* r = new RectItem(); + r->setCircle( m_circle ); + + m_object = r; +} + +NewLineCommand::NewLineCommand( MyCanvasView* v ) + : NewItemCommand( v, i18n("New Line") ) +{ +} + +void NewLineCommand::create() +{ + m_object = new LineItem(); +} + +NewTextCommand::NewTextCommand( QString t, MyCanvasView* v, TokenProvider* token ) + : NewItemCommand( v, i18n("New Text") ), + m_token( token ) +{ + text = t; +} + +void NewTextCommand::create() +{ + TextItem* t = new TextItem(); + t->setTokenProvider( m_token ); + t->setText( text ); + + m_object = t; +} + +//NY25 +NewTextLineCommand::NewTextLineCommand( QString t, MyCanvasView* v, TokenProvider* token ) + : NewItemCommand( v, i18n("New TextLine") ), + m_token( token ) +{ + text = t; +} + +void NewTextLineCommand::create() +{ + TextLineItem* t = new TextLineItem(); + t->setTokenProvider( m_token ); + t->setText( text ); + + m_object = t; +} +//NY25 + +NewBarcodeCommand::NewBarcodeCommand( MyCanvasView* v, TokenProvider* token ) + : NewItemCommand( v, i18n("New Barcode") ), + m_token( token ) +{ +} + +void NewBarcodeCommand::create() +{ + m_object = new BarcodeItem(); + m_object->setTokenProvider( m_token ); +} + +DeleteCommand::~DeleteCommand() +{ + if( m_canvas_item && canvasHasItem() && m_canvas_item->canvas() == 0 ) + { + DocumentItem* item = m_canvas_item->item(); + if( item ) + item->disconnect( item, SIGNAL( destroyed() ), this, 0 ); + delete m_canvas_item; + } +} + +void DeleteCommand::execute() +{ + if( canvasHasItem() ) { + m_canvas_item->setCanvas( 0 ); + m_canvas_item->hide(); + } +} + +void DeleteCommand::unexecute() +{ + // canvasHasItem won't work here + if( m_canvas_item ) { + m_canvas_item->setCanvas( c ); + m_canvas_item->show(); + } +} + +BorderCommand::BorderCommand( bool border, const QPen & pen, DocumentItem* item ) + : CommandUtils( item->canvasItem() ) +{ + m_new_border = border; + m_new_pen = pen; + m_item = item; +} + +void BorderCommand::execute() +{ + if( canvasHasItem() ) + { + m_old_border = m_item->border(); + m_old_pen = m_item->pen(); + m_item->setBorder( m_new_border ); + m_item->setPen( m_new_pen ); + + m_canvas_item->update(); + } +} + +void BorderCommand::unexecute() +{ + if( canvasHasItem() ) + { + m_item->setBorder( m_old_border ); + m_item->setPen( m_old_pen ); + + m_canvas_item->update(); + } +} + +FillCommand::FillCommand( QColor c, RectItem* r ) + : CommandUtils( r->canvasItem() ) +{ + fill = c; + m_item = r; +} + +void FillCommand::execute() +{ + if( canvasHasItem() ) { + fill2 = m_item->color(); + m_item->setColor( fill ); + } +} + +void FillCommand::unexecute() +{ + if( canvasHasItem() ) { + m_item->setColor( fill2 ); + } +} + +void ScriptCommand::execute() +{ + if( canvasHasItem() ) + { + m_old_script = m_canvas_item->item()->visibilityScript(); + m_canvas_item->item()->setVisibilityScript( m_script ); + m_canvas_item->update(); + } +} + +void ScriptCommand::unexecute() +{ + if( canvasHasItem() ) + { + m_canvas_item->item()->setVisibilityScript( m_old_script ); + m_canvas_item->update(); + } +} + +#include "commands.moc" diff --git a/kbarcode/commands.h b/kbarcode/commands.h new file mode 100644 index 0000000..e9eb001 --- /dev/null +++ b/kbarcode/commands.h @@ -0,0 +1,433 @@ +/*************************************************************************** + commands.h - description + ------------------- + begin : Don Dez 19 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef COMMANDS_H +#define COMMANDS_H + +#include "mycanvasitem.h" + +#include + +#include +#include + +#include "barcodeitem.h" +#include "tcanvasitem.h" +#include "imageitem.h" + +struct barcodeData; +class RectItem; +class MyCanvasLine; +class MyCanvasRectangle; +class MyCanvasView; +class CanvasBarcode; +class PictureRectangle; +class QCanvasItem; +class QColor; +class QFont; +class QImage; +class QPen; +class QPixmap; +class QPoint; +class QString; +class TextItem; +//NY29 +class TextLineItem; +//NY29 +class TokenProvider; + +// Stuff for undo redo + +class CommandUtils : public QObject { + Q_OBJECT + public: + CommandUtils(TCanvasItem* item); + ~CommandUtils(); + + bool canvasHasItem(); + + private slots: + void documentItemDeleted(); + + protected: + QCanvas* c; + TCanvasItem* m_canvas_item; +}; + +/** + * NewItemCommand is the base class for all classes + * that create a new item in the label editor (e.g. a + * barcode or a text element). + * You have to implement void create() which creates + * a QCanvasItem in item. + * NewItemCommand takes care about possitioning and + * undo/redo (because of KCommand). + * + * @author Dominik Seichter + */ +class NewItemCommand : public QObject, public KCommand { + Q_OBJECT + public: + NewItemCommand( MyCanvasView* view, const QString & name ); + virtual ~NewItemCommand(); + + void execute(); + void unexecute(); + QString name() const { + return m_name; + }; + + /** @returns a pointer to the TCanvasItem created by this class + */ + inline TCanvasItem* createdItem() const { return m_item; } + + private slots: + void documentItemDeleted(); + + protected: + /** This function has to be reimplemented in all subclasses + * and has to create a QCanvasItem and store a pointer to it + * in item. Otherwise KBarcode is going to crash. + * + * Example: + * + *
+          * void create() {
+          *     DrawingRect* r = new DrawingRect( 0 ); // Drawing rect is a subclass of QCanvasItem
+          *     r->setCircle( m_circle );   // Do something with r
+          *     item = r;   // save r into item, so that NewItemCommand knows about it
+          * }
+          * 
+ */ + virtual void create() = 0; + + MyCanvasView* cv; + TCanvasItem* m_item; + DocumentItem* m_object; + QPoint m_point; + QString m_name; +}; + +class ResizeCommand : public KCommand, CommandUtils { + public: + ResizeCommand( TCanvasItem* it, bool shift = false ) + : CommandUtils( it ) + { + orect = rect = m_canvas_item->item()->rectMM(); + m_shift = shift; + } + ~ResizeCommand() {} + + void setRect( int cx, int cy, int cw, int ch ); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Resized Item"); + } + + protected: + QRect orect; + QRect rect; + bool m_shift; +}; + +/** Move a TCanvasItem on the canvas + */ +class MoveCommand : public KCommand, CommandUtils { + public: + /** + * @param cx move in x direction cx mm + * @param cy move in y direction cy mm + */ + MoveCommand( int cx, int cy, TCanvasItem* it ) + : CommandUtils( it ) + { + x = cx; + y = cy; + } + ~MoveCommand() {} + + void execute(); + void unexecute(); + QString name() const { + return i18n("Moved Item"); + } + + protected: + int x; + int y; +}; + +class ChangeZCommand : public KCommand, CommandUtils { + public: + ChangeZCommand( int z, TCanvasItem* it ); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Raised or lowered an item"); + } + + protected: + int m_z, m_oldz; +}; + +class LockCommand : public KCommand, CommandUtils { + public: + LockCommand( bool lock, TCanvasItem* it ) + : CommandUtils( it ) + { + m_locked = lock; + } + + void execute(); + void unexecute(); + QString name() const { + return i18n("Protected Item"); + } + + protected: + bool m_locked; +}; + +class PictureCommand : public KCommand, CommandUtils { + public: + PictureCommand( double r, bool mirrorh, bool mirrorv, EImageScaling s, ImageItem* it ); + ~PictureCommand() {} + + void setExpression( const QString & expr ); + void setPixmap( const QPixmap & pix ); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Changed Settings"); + } + protected: + double rotate, orotate; + bool mirrorv, omirrorv; + bool mirrorh, omirrorh; + QString expression, oexpression; + EImageScaling scaling, oscaling; + QPixmap pixmap, opixmap; + QSize oldsize; + int pixserial, opixserial; + + ImageItem* m_item; +}; + +class TextChangeCommand : public KCommand, CommandUtils { + public: + TextChangeCommand( TextItem* it, QString t ); + ~TextChangeCommand() { } + + void execute(); + void unexecute(); + QString name() const { + return i18n("Changed Text"); + } + protected: + QString oldtext, text; + TextItem* m_item; +}; + +class TextRotationCommand : public KCommand, protected CommandUtils { + public: + TextRotationCommand( double rot, TextItem* t ); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Rotated Text"); + } + + protected: + double rot1, rot2; + TextItem* m_item; +}; + + +//NY28 +class TextLineChangeCommand : public KCommand, CommandUtils { + public: + TextLineChangeCommand( TextLineItem* it, QString t, int font, int magvert, int maghor ); + ~TextLineChangeCommand() { } + + void execute(); + void unexecute(); + QString name() const { + return i18n("Changed Text"); + } + protected: + QString oldtext, text; + TextLineItem* m_item; + int m_font; + int m_mag_vert; + int m_mag_hor; +}; +//NY28 + +class BarcodeCommand : public KCommand, CommandUtils { + public: + BarcodeCommand( BarcodeItem* bcode, Barkode* d ); + ~BarcodeCommand() { + delete data; + } + + void execute(); + void unexecute(); + QString name() const { + return i18n("Changed Barcode"); + } + protected: + Barkode olddata; + Barkode* data; + BarcodeItem* m_item; +}; + +class NewPictureCommand : public NewItemCommand { + public: + NewPictureCommand( MyCanvasView* v ) + : NewItemCommand( v, i18n("New Picture") ) + { + } + + protected: + void create(); +}; + +class NewTextCommand : public NewItemCommand { + public: + NewTextCommand( QString t, MyCanvasView* v, TokenProvider* token ); + + protected: + void create(); + QString text; + TokenProvider* m_token; +}; + +//NY27 +class NewTextLineCommand : public NewItemCommand { + public: + NewTextLineCommand( QString t, MyCanvasView* v, TokenProvider* token ); + + protected: + void create(); + QString text; + TokenProvider* m_token; +}; +//NY27 + +class NewRectCommand : public NewItemCommand { + public: + NewRectCommand( MyCanvasView* v, bool circle = false ); + + protected: + void create(); + bool m_circle; +}; + +class NewLineCommand : public NewItemCommand { + public: + NewLineCommand( MyCanvasView* v ); + + protected: + void create(); +}; + +class NewBarcodeCommand : public NewItemCommand { + public: + NewBarcodeCommand( MyCanvasView* v, TokenProvider* token ); + + protected: + void create(); + + private: + TokenProvider* m_token; +}; + +class DeleteCommand : public KCommand, CommandUtils { + public: + DeleteCommand( TCanvasItem* it ) + : CommandUtils( it ) + { + } + ~DeleteCommand(); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Delete Item"); + } +}; + +class BorderCommand : public KCommand, protected CommandUtils { + public: + BorderCommand( bool border, const QPen & pen, DocumentItem* item ); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Modified Border"); + } + + protected: + bool m_new_border; + bool m_old_border; + QPen m_new_pen; + QPen m_old_pen; + + DocumentItem* m_item; +}; + +class FillCommand : public KCommand, protected CommandUtils { + public: + FillCommand( QColor c, RectItem* r ); + + void execute(); + void unexecute(); + QString name() const { + return i18n("Modified Rectangle or Ellipse"); + } + + protected: + QColor fill, fill2; + RectItem* m_item; +}; + +class ScriptCommand : public KCommand, CommandUtils { + public: + ScriptCommand( const QString & script, TCanvasItem* it ) + : CommandUtils( it ) + { + m_script = script; + } + ~ScriptCommand() {} + + void execute(); + void unexecute(); + QString name() const { + return i18n("Changed visibility JavaScript"); + } + + protected: + QString m_script; + QString m_old_script; +}; + +#endif diff --git a/kbarcode/configdialog.cpp b/kbarcode/configdialog.cpp new file mode 100644 index 0000000..787a560 --- /dev/null +++ b/kbarcode/configdialog.cpp @@ -0,0 +1,351 @@ +/*************************************************************************** + configdialog.cpp - description + ------------------- + begin : Fre Apr 26 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "configdialog.h" +#include "printersettings.h" +#include "sqltables.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const QString cached = I18N_NOOP("There are currently %1 cached barcodes."); +using namespace KABC; + +ConfigDialog::ConfigDialog( QWidget* parent ) + : KDialogBase( IconList, i18n("Configure KBarcode"), KDialogBase::Ok|KDialogBase::Cancel, + KDialogBase::Ok, parent, "", true, true ) +{ + setupTab2(); // Printer + setupTab1(); // SQL + setupTab4(); // label editor + setupTab3(); // import + setupTab5(); // on new +} + +ConfigDialog::~ConfigDialog() +{ +} + +void ConfigDialog::setupTab1( ) +{ + QFrame* box = addPage( i18n("SQL Settings"), "", BarIcon("connect_no") ); + QVBoxLayout* layout = new QVBoxLayout( box, 6, 6 ); + QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ); + + sqlwidget = new SqlWidget( false, box, "sqlwidget" ); + + layout->addWidget( sqlwidget ); + layout->addItem( spacer ); +} + +void ConfigDialog::setupTab2() +{ + labelprinterdata* lb = PrinterSettings::getInstance()->getData(); + + QFrame* box = addPage( i18n("Print Settings"), "", BarIcon("fileprint") ); + + QVBoxLayout* tabLayout = new QVBoxLayout( box, 11, 6 ); + QHBoxLayout* Layout0 = new QHBoxLayout( 0, 6, 6 ); + QHBoxLayout* Layout1 = new QHBoxLayout( 0, 6, 6 ); + QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ); + + printerQuality = new KComboBox( false, box ); + printerQuality->insertItem( i18n("Medium Resolution (300dpi)") ); + printerQuality->insertItem( i18n("High Resolution (600dpi)") ); + printerQuality->insertItem( i18n("Very High Resolution (1200dpi)") ); + + switch( lb->quality ) { + case PrinterSettings::Middle: + printerQuality->setCurrentItem( 0 ); + break; + case PrinterSettings::High: + printerQuality->setCurrentItem( 1 ); + break; + case PrinterSettings::VeryHigh: + printerQuality->setCurrentItem( 2 ); + break; + default: + break; + } + + pageFormat = new KComboBox( false, box ); + PrinterSettings::getInstance()->insertPageFormat( pageFormat ); + pageFormat->setCurrentItem( lb->format ); + + Layout0->addWidget( new QLabel( i18n("Printer Resolution:"), box ) ); + Layout0->addWidget( printerQuality ); + Layout1->addWidget( new QLabel( i18n("Preview Page Format:"), box ) ); + Layout1->addWidget( pageFormat ); + tabLayout->addLayout( Layout0 ); + tabLayout->addLayout( Layout1 ); + tabLayout->addItem( spacer ); +} + +void ConfigDialog::setupTab3() +{ + labelprinterdata* lb = PrinterSettings::getInstance()->getData(); + + QFrame* box = addPage( i18n("Import"), "", BarIcon("fileimport") ); + QGridLayout* grid = new QGridLayout( box, 2, 2 ); + + QLabel* label = new QLabel( box ); + label->setText( i18n("Comment:") ); + grid->addWidget( label, 0, 0 ); + + comment = new KLineEdit( lb->comment, box ); + grid->addWidget( comment, 0, 1 ); + + label = new QLabel( box ); + label->setText( i18n( "Separator:" ) ); + grid->addWidget( label, 1, 0 ); + + separator = new KLineEdit( lb->separator, box ); + grid->addWidget( separator, 1, 1 ); + + label = new QLabel( box ); + label->setText( i18n("Quote Character:") ); + grid->addWidget( label, 2, 0 ); + + quote = new KLineEdit( lb->quote, box ); + grid->addWidget( quote, 2, 1 ); + + checkUseCustomNo = new QCheckBox( i18n("&Use customer article no. for import"), box ); + checkUseCustomNo->setChecked( lb->useCustomNo ); + + grid->addMultiCellWidget( checkUseCustomNo, 3, 3, 0, 2 ); + + QHBoxLayout* Layout1 = new QHBoxLayout( 0, 6, 6 ); + Layout1->addWidget( new QLabel( i18n("File Format:"), box ) ); + + combo1 = new KComboBox( box ); + combo1->insertItem( i18n("Quantity") ); + combo1->insertItem( i18n("Article Number") ); + combo1->insertItem( i18n("Group") ); + Layout1->addWidget( combo1 ); + + combo2 = new KComboBox( box ); + combo2->insertItem( i18n("Quantity") ); + combo2->insertItem( i18n("Article Number") ); + combo2->insertItem( i18n("Group") ); + Layout1->addWidget( combo2 ); + + combo3 = new KComboBox( box ); + combo3->insertItem( i18n("Quantity") ); + combo3->insertItem( i18n("Article Number") ); + combo3->insertItem( i18n("Group") ); + Layout1->addWidget( combo3 ); + + grid->addMultiCellLayout( Layout1, 4, 4, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + grid->addItem( spacer, 5, 0 ); + + KConfig* config = kapp->config(); + config->setGroup("FileFormat"); + combo1->setCurrentItem( config->readNumEntry("Data0", 0 ) ); + combo2->setCurrentItem( config->readNumEntry("Data1", 1 ) ); + combo3->setCurrentItem( config->readNumEntry("Data2", 2 ) ); +} + +void ConfigDialog::setupTab4() +{ + QFrame* box = addPage( i18n("Label Editor"), "", BarIcon("kbarcode") ); + QGridLayout* tabLayout = new QGridLayout( box, 11, 6 ); + + checkNewDlg = new QCheckBox( box ); + checkNewDlg->setText( i18n("&Create a new label on startup") ); + + date = new KLineEdit( box ); + labelDate = new QLabel( box ); + + connect( date, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateDatePreview() ) ); + + spinGrid = new KIntNumInput( 0, box ); + spinGrid->setLabel( i18n("Grid:" ), AlignLeft | AlignVCenter ); + spinGrid->setRange(2, 100, 1, false ); + + colorGrid = new KColorButton( box ); + + tabLayout->addWidget( checkNewDlg, 0, 0 ); + tabLayout->addMultiCellWidget( spinGrid, 1, 1, 0, 2 ); + tabLayout->addWidget( new QLabel( i18n("Grid Color:"), box ), 2, 0 ); + tabLayout->addWidget( colorGrid, 2, 1 ); + tabLayout->addWidget( new QLabel( i18n("Date Format:"), box ), 3, 0 ); + tabLayout->addWidget( date, 3, 1 ); + tabLayout->addWidget( labelDate, 3, 2 ); +} + +void ConfigDialog::setupTab5() +{ + labelprinterdata* lb = PrinterSettings::getInstance()->getData(); + QFrame* box = addPage( i18n("On New"), "", BarIcon("filenew") ); + + QVBoxLayout* tabLayout = new QVBoxLayout( box, 11, 6 ); + + QButtonGroup* bg = new QButtonGroup( i18n("On New Article"), box ); + bg->setColumnLayout(0, Qt::Vertical ); + bg->layout()->setSpacing( 6 ); + bg->layout()->setMargin( 11 ); + QGridLayout* bgLayout = new QGridLayout( bg->layout() ); + + QStringList alist, glist; + alist.append( i18n("No Line Break") ); + alist.append( i18n("Line Break") ); + alist.append( i18n("Insert Label X") ); + alist.append( i18n("New Page") ); + alist.append( i18n("Article No.") ); + + glist.append( i18n("No Line Break") ); + glist.append( i18n("Line Break") ); + glist.append( i18n("Insert Label X") ); + glist.append( i18n("New Page") ); + glist.append( i18n("Group Name") ); + + onNewArticle1 = new KComboBox( false, bg ); + onNewArticle2 = new KComboBox( false, bg ); + onNewArticle3 = new KComboBox( false, bg ); + onNewArticle4 = new KComboBox( false, bg ); + + onNewArticle1->insertStringList( alist ); + onNewArticle2->insertStringList( alist ); + onNewArticle3->insertStringList( alist ); + onNewArticle4->insertStringList( alist ); + + bgLayout->setColStretch( 1, 3 ); + + bgLayout->addWidget( new QLabel( "1.", bg ), 0, 0 ); + bgLayout->addWidget( new QLabel( "2.", bg ), 1, 0 ); + bgLayout->addWidget( new QLabel( "3.", bg ), 2, 0 ); + bgLayout->addWidget( new QLabel( "4.", bg ), 3, 0 ); + + bgLayout->addWidget( onNewArticle1, 0, 1 ); + bgLayout->addWidget( onNewArticle2, 1, 1 ); + bgLayout->addWidget( onNewArticle3, 2, 1 ); + bgLayout->addWidget( onNewArticle4, 3, 1 ); + + QButtonGroup* bg2 = new QButtonGroup( i18n("On New Group"), box ); + bg2->setColumnLayout(0, Qt::Vertical ); + bg2->layout()->setSpacing( 6 ); + bg2->layout()->setMargin( 11 ); + QGridLayout* bg2Layout = new QGridLayout( bg2->layout() ); + + onNewGroup1 = new KComboBox( false, bg2 ); + onNewGroup2 = new KComboBox( false, bg2 ); + onNewGroup3 = new KComboBox( false, bg2 ); + onNewGroup4 = new KComboBox( false, bg2 ); + + onNewGroup1->insertStringList( glist ); + onNewGroup2->insertStringList( glist ); + onNewGroup3->insertStringList( glist ); + onNewGroup4->insertStringList( glist ); + + bg2Layout->setColStretch( 1, 3 ); + + bg2Layout->addWidget( new QLabel( "1.", bg2 ), 0, 0 ); + bg2Layout->addWidget( new QLabel( "2.", bg2 ), 1, 0 ); + bg2Layout->addWidget( new QLabel( "3.", bg2 ), 2, 0 ); + bg2Layout->addWidget( new QLabel( "4.", bg2 ), 3, 0 ); + + bg2Layout->addWidget( onNewGroup1, 0, 1 ); + bg2Layout->addWidget( onNewGroup2, 1, 1 ); + bg2Layout->addWidget( onNewGroup3, 2, 1 ); + bg2Layout->addWidget( onNewGroup4, 3, 1 ); + + tabLayout->addWidget( bg ); + tabLayout->addWidget( bg2 ); + + onNewArticle1->setCurrentItem( lb->articleEvent1 ); + onNewArticle2->setCurrentItem( lb->articleEvent2 ); + onNewArticle3->setCurrentItem( lb->articleEvent3 ); + onNewArticle4->setCurrentItem( lb->articleEvent4 ); + + onNewGroup1->setCurrentItem( lb->groupEvent1 ); + onNewGroup2->setCurrentItem( lb->groupEvent2 ); + onNewGroup3->setCurrentItem( lb->groupEvent3 ); + onNewGroup4->setCurrentItem( lb->groupEvent4 ); +} + +void ConfigDialog::accept() +{ + KConfig* config = kapp->config(); + config->setGroup("FileFormat"); + config->writeEntry("Data0", combo1->currentItem() ); + config->writeEntry("Data1", combo2->currentItem() ); + config->writeEntry("Data2", combo3->currentItem() ); + + sqlwidget->save(); + + labelprinterdata* lpdata = PrinterSettings::getInstance()->getData(); + lpdata->comment = comment->text(); + lpdata->separator = separator->text(); + lpdata->quote = quote->text(); + lpdata->format = pageFormat->currentItem(); + + lpdata->articleEvent1 = onNewArticle1->currentItem(); + lpdata->articleEvent2 = onNewArticle2->currentItem(); + lpdata->articleEvent3 = onNewArticle3->currentItem(); + lpdata->articleEvent4 = onNewArticle4->currentItem(); + + lpdata->groupEvent1 = onNewGroup1->currentItem(); + lpdata->groupEvent2 = onNewGroup2->currentItem(); + lpdata->groupEvent3 = onNewGroup3->currentItem(); + lpdata->groupEvent4 = onNewGroup4->currentItem(); + lpdata->useCustomNo = checkUseCustomNo->isChecked(); + + switch( printerQuality->currentItem() ) { + case 0: + lpdata->quality = PrinterSettings::Middle; + break; + case 1: + lpdata->quality = PrinterSettings::High; + break; + case 2: + lpdata->quality = PrinterSettings::VeryHigh; + break; + default: + break; + } + + QDialog::accept(); +} + +void ConfigDialog::updateDatePreview() +{ + labelDate->setText( i18n("Preview: ") + QDateTime::currentDateTime().toString( date->text() ) ); +} + +#include "configdialog.moc" diff --git a/kbarcode/configdialog.h b/kbarcode/configdialog.h new file mode 100644 index 0000000..5838f78 --- /dev/null +++ b/kbarcode/configdialog.h @@ -0,0 +1,95 @@ +/*************************************************************************** + configdialog.h - description + ------------------- + begin : Fre Apr 26 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include + +struct labelprinterdata; +struct mysqldata; +class KComboBox; +class KColorButton; +class KIntNumInput; +class KDoubleNumInput; +class KLineEdit; +class KPushButton; +class QRadioButton; +class QCheckBox; +class QLabel; +class QString; +class QWidget; +class SqlWidget; +/** KBarcodes configuration dialog for advanced settings. + */ + +class ConfigDialog : public KDialogBase { + Q_OBJECT + public: + ConfigDialog( QWidget* parent ); + ~ConfigDialog(); + + KLineEdit* comment; + KLineEdit* separator; + KLineEdit* quote; + KLineEdit* date; + + KIntNumInput* spinGrid; + + KComboBox* printerQuality; + KComboBox* pageFormat; + + QLabel* labelDate; + + QCheckBox* checkNewDlg; + QCheckBox* checkUseCustomNo; + + KComboBox* combo1; + KComboBox* combo2; + KComboBox* combo3; + + KComboBox* onNewArticle1; + KComboBox* onNewArticle2; + KComboBox* onNewArticle3; + KComboBox* onNewArticle4; + + KComboBox* onNewGroup1; + KComboBox* onNewGroup2; + KComboBox* onNewGroup3; + KComboBox* onNewGroup4; + + KColorButton* colorGrid; + + private: + void accept(); + + void setupTab1(); + void setupTab2(); + void setupTab3(); + void setupTab4(); + void setupTab5(); + + private slots: + void updateDatePreview(); + + protected: + KComboBox* comboDataMatrix; + + SqlWidget* sqlwidget; +}; + +#endif diff --git a/kbarcode/confwizard.cpp b/kbarcode/confwizard.cpp new file mode 100644 index 0000000..7809c6c --- /dev/null +++ b/kbarcode/confwizard.cpp @@ -0,0 +1,255 @@ +/*************************************************************************** + confwizard.cpp - description + ------------------- + begin : Son Jun 16 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "confwizard.h" +#include "sqltables.h" +#include "printersettings.h" +#include "dsmainwindow.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include + + +const char* description = I18N_NOOP( + "KBarcode is a barcode and label printing application for KDE 3. It can " + "be used to print every thing from simple business cards up to complex " + "labels with several barcodes (e.g. article descriptions). KBarcode " + "comes with an easy to use WYSIWYG label designer, a setup wizard, " + "batch import of labels (directly from the delivery note), thousands " + "of predefined labels, database management tools and translations " + "in many languages. Even printing more than 10.000 labels in one go is " + "no problem for KBarcode. Additionally it is a simply xbarcode " + "replacement for the creation of barcodes. All major types of barcodes " + "like EAN, UPC, CODE39 and ISBN are supported." ); + +ConfWizard::ConfWizard( QWidget* parent, const char* name, bool modal ) + : KWizard( parent, name, modal ) +{ + setCaption( i18n( "Configure KBarcode" ) ); + + setupPage1(); + setupPage0(); + setupPage2(); + setupPage3(); + + setNextEnabled( page_2, false ); + helpButton()->hide(); + + connect( buttonCreate, SIGNAL( clicked() ), this, SLOT( create() ) ); + connect( buttonExample, SIGNAL( clicked() ), this, SLOT( example() ) ); + connect( checkDatabase, SIGNAL( clicked() ), this, SLOT( useDatabase() ) ); +} + +ConfWizard::~ConfWizard() +{ } + +void ConfWizard::accept() +{ + sqlwidget->save( checkDatabase->isChecked() ); + + KWizard::accept(); +} + +void ConfWizard::setupPage1() +{ + page = new QWidget( this, "page" ); + pageLayout = new QVBoxLayout( page, 11, 6, "pageLayout"); + + Layout8 = new QHBoxLayout( 0, 0, 6, "Layout8"); + + Layout7 = new QVBoxLayout( 0, 0, 6, "Layout7"); + + logo = new QLabel( page, "logo" ); + logo->setPixmap( locate("data", "kbarcode/logo.png") ); + QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + pageLayout->addWidget( logo ); + Layout7->addItem( spacer ); + Layout8->addLayout( Layout7 ); + + TextLabel2_2 = new QLabel( page, "TextLabel2_2" ); + TextLabel2_2->setText( i18n( "

Welcome to KBarcode



") + + i18n( description ) + "
" ); + Layout8->addWidget( TextLabel2_2 ); + + pageLayout->addLayout( Layout8 ); + + KURLLabel1 = new KURLLabel( page, "KURLLabel1" ); + KURLLabel1->setText( "http://www.kbarcode.net" ); + KURLLabel1->setURL("http://www.kbarcode.net"); + pageLayout->addWidget( KURLLabel1 ); + addPage( page, i18n( "Welcome" ) ); +} + +void ConfWizard::setupPage0() +{ + QWidget* page_0 = new QWidget( this, "page_0" ); + QVBoxLayout* pageLayout = new QVBoxLayout( page_0, 11, 6, "pageLayout"); + + QTextBrowser* b = new QTextBrowser( page_0, "b" ); + b->setText( DSMainWindow::systemCheck() ); + + pageLayout->addWidget( b ); + + addPage( page_0, i18n("System Check") ); +} + +void ConfWizard::setupPage2() +{ + page_2 = new QWidget( this, "page_2" ); + pageLayout_2 = new QVBoxLayout( page_2, 11, 6, "pageLayout_2"); + + checkDatabase = new QCheckBox( page_2 ); + checkDatabase->setText( i18n("&Use database with KBarcode") ); + checkDatabase->setChecked( true ); + + sqlwidget = new SqlWidget( true, page_2, "sqlwidget" ); + connect( sqlwidget, SIGNAL( databaseWorking( bool ) ), this, SLOT( testSettings( bool ) ) ); + + QSpacerItem* spacer_5 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + pageLayout_2->addWidget( checkDatabase ); + pageLayout_2->addWidget( sqlwidget ); + pageLayout_2->addItem( spacer_5 ); + + addPage( page_2, i18n( "Database" ) ); +} + +void ConfWizard::setupPage3() +{ + page_3 = new QWidget( this, "page_3" ); + pageLayout_3 = new QVBoxLayout( page_3, 11, 6, "pageLayout_3"); + + TextLabel1_2 = new QLabel( page_3, "TextLabel1_2" ); + TextLabel1_2->setText( i18n( "KBarcode can create the required SQL tables for you.
KBarcode will add also some Label Definitions to the tables.
After that you can fill the tables with some example data." ) ); + TextLabel1_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); + pageLayout_3->addWidget( TextLabel1_2 ); + + Layout5_2 = new QVBoxLayout( 0, 0, 6, "Layout5_2"); + + buttonCreate = new KPushButton( page_3, "buttonCreate" ); + buttonCreate->setText( i18n( "&Create Tables" ) ); + Layout5_2->addWidget( buttonCreate ); + + buttonExample = new KPushButton( page_3, "buttonExample" ); + buttonExample->setEnabled( FALSE ); + buttonExample->setText( i18n( "&Add Example Data" ) ); + Layout5_2->addWidget( buttonExample ); + QSpacerItem* spacer_6 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout5_2->addItem( spacer_6 ); + pageLayout_3->addLayout( Layout5_2 ); + addPage( page_3, i18n( "Create Tables" ) ); +} + +void ConfWizard::testSettings( bool b ) +{ + setNextEnabled( page_2, b ); +} + +void ConfWizard::create() +{ + KApplication::setOverrideCursor( Qt::WaitCursor ); + if(!SqlTables::getInstance()->newTables( sqlwidget->username(), sqlwidget->password(), sqlwidget->hostname(), sqlwidget->database(), sqlwidget->driver() ) ) + { + KApplication::restoreOverrideCursor(); + return; + } + else + KApplication::restoreOverrideCursor(); + + QSqlDatabase* db = QSqlDatabase::addDatabase( sqlwidget->driver() ); + db->setDatabaseName( sqlwidget->database() ); + db->setUserName( sqlwidget->username() ); + db->setPassword( sqlwidget->password() ); + db->setHostName( sqlwidget->hostname() ); + + if( !db->open() ) + KMessageBox::error( this, i18n("Connection failed:
") + sqlwidget->database(), + db->lastError().databaseText() + "
" ); + + if( db->open() ) { + KApplication::setOverrideCursor( Qt::WaitCursor ); + SqlTables::getInstance()->importData( + locate("appdata", "labeldefinitions.sql"), db ); + buttonExample->setEnabled( true ); + KApplication::restoreOverrideCursor(); + } + + db->close(); +} + +void ConfWizard::example() +{ + QSqlDatabase* db = QSqlDatabase::addDatabase( sqlwidget->driver() ); + db->setDatabaseName( sqlwidget->database() ); + db->setUserName( sqlwidget->username() ); + db->setPassword( sqlwidget->password() ); + db->setHostName( sqlwidget->hostname() ); + + if( !db->open() ) + KMessageBox::error( this, i18n("Connection failed:
") + sqlwidget->database(), + db->lastError().databaseText() + "
" ); + + + SqlTables::getInstance()->importData( + locate("appdata", "exampledata.sql"), db ); + KMessageBox::information( this, i18n("Example data has been imported.") ); + + db->close(); +} + +void ConfWizard::showPage( QWidget* page ) +{ + QWizard::showPage(page); + + if( page == page_2 && !sqlwidget->driverCount() ) { + KMessageBox::information( this, i18n( + "There are no Qt SQL drivers installed. " + "KBarcode needs those drivers to access the different SQL databases. " + "This drivers are part of the Qt Source distribution and should also be part of " + "your distribution. Please install them first.") ); + } + + if ( page == page_3 ) + finishButton()->setEnabled( true ); +} + +void ConfWizard::useDatabase() +{ + setFinishEnabled( page_2, !checkDatabase->isChecked() ); + setNextEnabled( page_2, false ); + setFinishEnabled( page_3, checkDatabase->isChecked() ); + sqlwidget->setEnabled( checkDatabase->isChecked() ); +} + + +#include "confwizard.moc" diff --git a/kbarcode/confwizard.h b/kbarcode/confwizard.h new file mode 100644 index 0000000..c1bfc20 --- /dev/null +++ b/kbarcode/confwizard.h @@ -0,0 +1,101 @@ +/*************************************************************************** + confwizard.h - description + ------------------- + begin : Son Jun 16 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef CONFWIZARD_H +#define CONFWIZARD_H + +#include + +class QButtonGroup; +class QCheckBox; +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QRadioButton; +class KComboBox; +class KLineEdit; +class KPushButton; +class KURLLabel; +class QLabel; +class QWidget; +class SqlWidget; +/** KBarcodes configuration wizard. + */ +class ConfWizard : public KWizard +{ + Q_OBJECT + + public: + ConfWizard( QWidget* parent = 0, const char* name = 0, bool modal = true ); + ~ConfWizard(); + + void showPage( QWidget* page ); + + // used in dsmainwindow.cpp + // not a clean API, but I am lazy :-( + QCheckBox* checkDatabase; + + private slots: + void testSettings( bool b ); + void create(); + void example(); + void useDatabase(); + + protected slots: + void accept(); + + private: + void setupPage1(); + void setupPage0(); + void setupPage2(); + void setupPage3(); + + SqlWidget* sqlwidget; + + QWidget* page; + QLabel* logo; + QLabel* TextLabel2_2; + KURLLabel* KURLLabel1; + QWidget* page_2; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QLabel* TextLabel4; + QLabel* TextLabel5; + QLabel* TextLabel6; + KPushButton* buttonTest; + QWidget* page_3; + QLabel* TextLabel1_2; + KPushButton* buttonCreate; + KPushButton* buttonExample; + QButtonGroup* groupDatabase; + + protected: + QVBoxLayout* pageLayout; + QHBoxLayout* Layout8; + QVBoxLayout* Layout7; + QVBoxLayout* pageLayout_2; + QVBoxLayout* pageLayout_4; + QHBoxLayout* Layout5; + QVBoxLayout* Layout3; + QVBoxLayout* Layout4; + QVBoxLayout* Layout6; + QVBoxLayout* pageLayout_3; + QVBoxLayout* Layout5_2; +}; + +#endif // CONFWIZARD_H diff --git a/kbarcode/csvfile.cpp b/kbarcode/csvfile.cpp new file mode 100644 index 0000000..f8cc81f --- /dev/null +++ b/kbarcode/csvfile.cpp @@ -0,0 +1,168 @@ +/*************************************************************************** + csvfile.h - description + ------------------- + begin : Mon Mar 28 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "csvfile.h" + +#include "printersettings.h" + +#include +#include + +CSVFile::CSVFile( const QString & filename ) +{ + m_eof = false; + m_csv = true; + + m_quote = PrinterSettings::getInstance()->getData()->quote; + m_separator = PrinterSettings::getInstance()->getData()->separator; + m_comment = PrinterSettings::getInstance()->getData()->comment; + + m_file.setName( filename ); + m_file.open( IO_ReadOnly ); + + if( m_file.isOpen() ) + m_stream.setDevice( &m_file ); +} + +CSVFile::CSVFile( QBuffer & buf ) +{ + m_eof = false; + m_csv = true; + + m_quote = PrinterSettings::getInstance()->getData()->quote; + m_separator = PrinterSettings::getInstance()->getData()->separator; + m_comment = PrinterSettings::getInstance()->getData()->comment; + + buf.open( IO_ReadOnly ); + + if( buf.isOpen() ) + m_stream.setDevice( &buf ); +} + +CSVFile::~CSVFile() +{ + if( m_stream.device() && m_stream.device()->isOpen() ) + m_stream.device()->close(); +} + +QStringList CSVFile::readNextLine() +{ + QString line; + + if( !m_stream.device() ) + return QStringList(); + + if( !m_stream.device()->isOpen() ) + return QStringList(); + + // walk through the lines until a line containing valid data + for( ;; ) + { + line = m_stream.readLine(); + line = line.stripWhiteSpace(); + + // check for eof + if( line.isNull() ) + { + m_eof = true; + return QStringList(); + } + + // ignore comments and empty lines + if( (!m_comment.isEmpty() && line.startsWith( m_comment )) || line.isEmpty() ) + continue; + + break; + } + + return m_csv ? readCsvLine( line ) : readFixedLine( line ); +} + +QStringList CSVFile::readCsvLine( const QString & l ) +{ + QString line( l ); + QStringList sections; + unsigned int start = 0; + unsigned int end = 0; + unsigned int len; + bool quoted = false; + bool quote_empty; + + // if line does not end with separator, add one + if( !line.endsWith( m_separator ) ) + line.append( m_separator ); + + // we have to handle here the case, + // that the separator is included + // in a quoted field + len = line.length(); // cache for better speed + quote_empty = m_quote.isEmpty(); + while( end < len ) + { + if( !quote_empty && line.right( len - end ).startsWith( m_quote ) ) + quoted = !quoted; + else if( !quoted && line.right( len - end ).startsWith( m_separator ) ) + { + sections << removeQuote( line.mid( start, end-start ) ); + + start = end; + ++start; + } + else if( line[end] == '\n' ) + break; + + ++end; + } + + return sections; +} + +QStringList CSVFile::readFixedLine( const QString & line ) +{ + QString data( line ); + QStringList list; + + for( unsigned int i=0;i +#include +#include + +class QBuffer; + +/** This class makes it very easy to parse a comma separated value file + */ +class CSVFile { + public: + CSVFile( const QString & filename ); + CSVFile( QBuffer & buf ); + ~CSVFile(); + + /** reads the next line from the CSV file and returns + * the line split into sections. Comments are ignored by this + * line. + */ + QStringList readNextLine(); + + /** returns true when the CSVFile object is valid. + * returns false incase of an error + */ + inline bool isValid() const; + + /** returns true when the end of file was reached + */ + inline bool isEof() const; + + /** set the encoding to use for the data + */ + void setEncoding( const QString & enc ); + + /** set the separator to use for the data + */ + inline void setSeparator( const QString & sep ); + + /** set the quoting character + */ + inline void setQuote( const QString & quote ); + + /** set the comment character + */ + inline void setComment( const QString & comment ); + + /** set the field widths for fixed field width files + */ + inline void setFieldWidth( const QValueList & width ); + + /** sets wether this is a CSV file or + * a file with fixed field width. + * \param b if true this is a CSV file (default) + */ + inline void setCSVFile( bool b ); + + /** + * \returns true if this is a CSV file + */ + inline bool isCSVFile() const; + + private: + /** removes quoting characters as defined in lpdata from the + * string @p text + */ + QString removeQuote( const QString & text ); + + QStringList readCsvLine( const QString & line ); + + QStringList readFixedLine( const QString & line ); + + private: + /** the filehandle which is used to access the file + */ + QFile m_file; + QTextStream m_stream; + + QString m_quote; + QString m_separator; + QString m_comment; + + QValueList m_width; + + bool m_csv; + bool m_eof; +}; + +bool CSVFile::isValid() const +{ + if( !m_stream.device() ) + return false; + + return m_stream.device()->isOpen(); +} + +bool CSVFile::isEof() const +{ + return m_eof; +} + +void CSVFile::setCSVFile( bool b ) +{ + m_csv = b; +} + +bool CSVFile::isCSVFile() const +{ + return m_csv; +} + +void CSVFile::setSeparator( const QString & sep ) +{ + m_separator = sep; +} + +void CSVFile::setQuote( const QString & quote ) +{ + m_quote = quote; +} + +void CSVFile::setComment( const QString & comment ) +{ + m_comment = comment; +} + +void CSVFile::setFieldWidth( const QValueList & width ) +{ + m_width = width; +} + + +#endif // CSVFILE_H diff --git a/kbarcode/csvimportdlg.cpp b/kbarcode/csvimportdlg.cpp new file mode 100644 index 0000000..3da1899 --- /dev/null +++ b/kbarcode/csvimportdlg.cpp @@ -0,0 +1,430 @@ +/*************************************************************************** + csvimportdlg.cpp - description + ------------------- + begin : Don Aug 21 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "csvimportdlg.h" +#include "printersettings.h" +#include "sqltables.h" +#include "encodingcombo.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include "csvfile.h" + +// import from labelprinter.cpp +extern QString removeQuote( QString text, QString quote ); + +const char* NOFIELD = ""; + +CSVImportDlg::CSVImportDlg(QWidget *parent, const char *name ) + : KDialogBase( KDialogBase::Tabbed, i18n("Import"), + KDialogBase::Ok | KDialogBase::Close, KDialogBase::Ok, parent,name,false,true) +{ + setButtonOKText( i18n("&Import"), i18n("Import the selected file into your tables.") ); + + createPage1(); + createPage2(); + + connect( requester, SIGNAL( textChanged( const QString & ) ), this, SLOT( settingsChanged() ) ); + connect( buttonSet, SIGNAL( clicked() ), this, SLOT( setCol() ) ); + connect( comboSQL, SIGNAL( activated( int ) ), this, SLOT( updateFields() ) ); + connect( databaseName, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateFields() ) ); + connect( comboEncoding, SIGNAL( activated( int ) ), this, SLOT( settingsChanged() ) ); + connect( table->horizontalHeader(), SIGNAL( clicked( int ) ), this, SLOT( updateCol( int ) ) ); + connect( radioCSVFile, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioFixedFile, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( buttonAdd, SIGNAL( clicked() ), this, SLOT( addWidth() ) ); + connect( buttonRemove,SIGNAL( clicked() ), this, SLOT( removeWidth() ) ); + connect( comment, SIGNAL( textChanged( const QString & ) ), this, SLOT( settingsChanged() ) ); + connect( quote, SIGNAL( textChanged( const QString & ) ), this, SLOT( settingsChanged() ) ); + connect( separator, SIGNAL( textChanged( const QString & ) ), this, SLOT( settingsChanged() ) ); + connect( checkLoadAll, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + + updateFields(); + enableControls(); + + show(); +} + +CSVImportDlg::~CSVImportDlg() +{ +} + +void CSVImportDlg::createPage1() +{ + QFrame* box = addPage( i18n("&Import Data") ); + QVBoxLayout* layout = new QVBoxLayout( box, 6, 6 ); + QGridLayout* grid = new QGridLayout( 2 ); + + requester = new KURLRequester( box ); + comboEncoding = new EncodingCombo( box ); + comboSQL = new KComboBox( false, box ); + comboSQL->insertItem( TABLE_BASIC ); + comboSQL->insertItem( TABLE_CUSTOMER ); + comboSQL->insertItem( TABLE_CUSTOMER_TEXT ); + comboSQL->insertItem( TABLE_LABEL_DEF ); + comboSQL->insertItem( i18n("Other table...") ); + + databaseName = new KLineEdit( box ); + checkLoadAll = new QCheckBox( i18n("&Load complete file into preview"), box ); + spinLoadOnly = new KIntNumInput( box ); + spinLoadOnly->setLabel( i18n("Load only a number of datasets:"), AlignLeft | AlignVCenter ); + spinLoadOnly->setRange( 0, 10000, 1, false ); + checkLoadAll->setChecked( true ); + + table = new QTable( box ); + table->setReadOnly( true ); + + frame = new QFrame( box ); + QHBoxLayout* layout2 = new QHBoxLayout( frame, 6, 6 ); + + spinCol = new KIntNumInput( frame ); + spinCol->setLabel( i18n("Column:"), AlignLeft | AlignVCenter ); + spinCol->setRange( 0, 0, 0, false ); + + comboField = new KComboBox( false, frame ); + buttonSet = new KPushButton( i18n("Set"), frame ); + + layout2->addWidget( spinCol ); + layout2->addWidget( new QLabel( i18n("Database field to use for this column:"), frame ) ); + layout2->addWidget( comboField ); + layout2->addWidget( buttonSet ); + + grid->addWidget( new QLabel( i18n("File to import:"), box ), 0, 0 ); + grid->addWidget( requester, 0, 1 ); + grid->addWidget( new QLabel( i18n("Encoding:"), box ), 1, 0 ); + grid->addWidget( comboEncoding, 1, 1 ); + grid->addWidget( new QLabel( i18n("Import into table:"), box ), 2, 0 ); + grid->addWidget( comboSQL, 2, 1 ); + grid->addWidget( new QLabel( i18n("Table Name:"), box ), 3, 0 ); + grid->addWidget( databaseName, 3, 1 ); + grid->addWidget( checkLoadAll, 4, 0 ); + grid->addWidget( spinLoadOnly, 4, 1 ); + + layout->addLayout( grid ); + layout->addWidget( table ); + layout->setStretchFactor( table, 2 ); + layout->addWidget( frame ); +} + +void CSVImportDlg::createPage2() +{ + labelprinterdata* lb = PrinterSettings::getInstance()->getData(); + QFrame* mainBox = addPage( i18n("&Import Settings") ); + QVBoxLayout* layout = new QVBoxLayout( mainBox, 6, 6 ); + QSpacerItem* spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + QSpacerItem* spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + + QHButtonGroup* buttonGroup = new QHButtonGroup( i18n("File Format:"), mainBox ); + radioCSVFile = new QRadioButton( i18n("&CSV File"), buttonGroup ); + radioFixedFile = new QRadioButton( i18n("File with &fixed field width"), buttonGroup ); + + QHBox* hboxFrame = new QHBox( mainBox ); + + groupCSV = new QGroupBox( i18n("CSV File"), hboxFrame ); + groupFixed = new QGroupBox( i18n("Fixed Field Width File"), hboxFrame ); + + groupCSV->setColumnLayout(0, Qt::Vertical ); + groupCSV->layout()->setSpacing( 6 ); + groupCSV->layout()->setMargin( 11 ); + + QVBoxLayout* vbox = new QVBoxLayout( groupCSV->layout() ); + QGridLayout* grid = new QGridLayout( 2, 2 ); + grid->setSpacing( 6 ); + grid->setMargin( 11 ); + + QLabel* label = new QLabel( groupCSV ); + label->setText( i18n("Comment:") ); + grid->addWidget( label, 0, 0 ); + + comment = new KLineEdit( lb->comment, groupCSV ); + grid->addWidget( comment, 0, 1 ); + + label = new QLabel( groupCSV ); + label->setText( i18n( "Separator:" ) ); + grid->addWidget( label, 1, 0 ); + + separator = new KLineEdit( lb->separator, groupCSV ); + grid->addWidget( separator, 1, 1 ); + + label = new QLabel( groupCSV ); + label->setText( i18n("Quote Character:") ); + grid->addWidget( label, 2, 0 ); + + quote = new KLineEdit( lb->quote, groupCSV ); + grid->addWidget( quote, 2, 1 ); + + vbox->addLayout( grid ); + vbox->addItem( spacer1 ); + + groupFixed->setColumnLayout(0, Qt::Horizontal ); + groupFixed->layout()->setSpacing( 6 ); + groupFixed->layout()->setMargin( 11 ); + QHBoxLayout* groupFixedLayout = new QHBoxLayout( groupFixed->layout() ); + groupFixedLayout->setAlignment( Qt::AlignTop ); + + listWidth = new KListBox( groupFixed ); + + buttonAdd = new KPushButton( groupFixed ); + buttonAdd->setText( i18n( "&Add Field" ) ); + + buttonRemove = new KPushButton( groupFixed ); + buttonRemove->setText( i18n( "&Remove Field" ) ); + + spinNumber = new KIntNumInput( groupFixed ); + spinNumber->setMinValue( 0 ); + spinNumber->setValue( 1 ); + spinNumber->setFocus(); + + QVBoxLayout* layout2 = new QVBoxLayout( 0, 6, 6 ); + layout2->addWidget( buttonAdd ); + layout2->addWidget( buttonRemove ); + layout2->addWidget( spinNumber ); + layout2->addItem( spacer2 ); + + groupFixedLayout->addWidget( listWidth ); + groupFixedLayout->addLayout( layout2 ); + + layout->addWidget( buttonGroup ); + layout->addWidget( hboxFrame ); + + radioCSVFile->setChecked( true ); +} + +void CSVImportDlg::settingsChanged() +{ + CSVFile file( requester->url() ); + QStringList list; + + int i = 0; + unsigned int z; + + initCsvFile( &file ); + + table->setNumCols( 0 ); + table->setNumRows( 0 ); + + if( !file.isValid() ) + return; + + while( !file.isEof() ) + { + list = file.readNextLine(); + + if( table->numCols() < (int)list.count() ) + table->setNumCols( list.count() ); + + if( table->numRows() <= i ) + // add 100 rows to get a reasonable speed + table->setNumRows( i + 100 ); + + for( z = 0; z < list.count(); z++ ) + table->setText( i, z, list[z] ); + + if( !checkLoadAll->isChecked() && i > spinLoadOnly->value() ) + break; + + i++; + } + + table->setNumRows( i ); + spinCol->setRange( 1, table->numCols(), 1, false ); + + enableControls(); +} + +void CSVImportDlg::setCol() +{ + QString text = comboField->currentText(); + int v = spinCol->value() - 1; + if( text == NOFIELD ) + table->horizontalHeader()->setLabel( v, QString::number( v + 1 ) ); + else { + for( int i = 0; i < table->horizontalHeader()->count(); i++ ) + if( table->horizontalHeader()->label( i ) == text ) + table->horizontalHeader()->setLabel( i, QString::number( i + 1 ) ); + + table->horizontalHeader()->setLabel( v, text ); + } +} + +QString CSVImportDlg::getDatabaseName() +{ + bool b = comboSQL->currentItem() == (comboSQL->count()-1); + + databaseName->setEnabled( b ); + return b ? databaseName->text() : comboSQL->currentText(); +} + +void CSVImportDlg::updateFields() +{ + // also enables databaseName if necessary + QString name = getDatabaseName(); + + comboField->clear(); + comboField->insertItem( NOFIELD ); + QSqlQuery query( SqlTables::getInstance()->driver()->showColumns( name ) ); + while( query.next() ) + comboField->insertItem( query.value( 0 ).toString() ); + + for( int i = 0; i < table->horizontalHeader()->count(); i++ ) + table->horizontalHeader()->setLabel( i, QString::number( i + 1 ) ); +} + +void CSVImportDlg::enableControls() +{ + bool b = table->numRows() && table->numCols(); + + groupCSV->setEnabled( radioCSVFile->isChecked() ); + groupFixed->setEnabled( radioFixedFile->isChecked() ); + + spinLoadOnly->setEnabled( !checkLoadAll->isChecked() ); + + enableButtonOK( b ); + frame->setEnabled( b ); +} + +void CSVImportDlg::updateCol( int c ) +{ + spinCol->setValue( ++c ); +} + +void CSVImportDlg::accept() +{ + CSVFile file( requester->url() ); + QHeader* h = table->horizontalHeader(); + QValueList headers; + QStringList list; + QString name = getDatabaseName(); + int i = 0; + + QString q = "INSERT INTO " + name + " ("; + for( int c = 0; c < table->horizontalHeader()->count(); c++ ) { + bool ok = true; + h->label( c ).toInt( &ok ); + if( !ok ) { + q = q + table->horizontalHeader()->label( c ) + ","; + headers << c; + } + } + + // remove last "," + if( q.right( 1 ) == "," ) + q = q.left( q.length() - 1 ); + + q = q + ") VALUES ("; + + initCsvFile( &file ); + if( !file.isValid() ) + KMessageBox::error( this, i18n("Cannot load data from the file:") + requester->url() ); + + + + KApplication::setOverrideCursor( QCursor( Qt::WaitCursor) ); + while( !file.isEof() ) + { + list = file.readNextLine(); + + QString line = q; + for( unsigned int c = 0; c < headers.count(); c++ ) + line.append( "'" + list[ headers[c] ] + "'" + "," ); + + // remove last "," + if( line.right( 1 ) == "," ) + line = line.left( line.length() - 1 ); + + line = line + ");"; + + QSqlQuery query; + if( !query.exec( line ) ) + qDebug( i18n("Could not import the following line:") + line ); + //KMessageBox::error( this, i18n("Could not import the following line:") + line ); + } + + KApplication::restoreOverrideCursor(); + KMessageBox::information( this, i18n("Data was imported successfully.") ); + KDialogBase::accept(); +} + +void CSVImportDlg::addWidth() +{ + listWidth->insertItem( QString("%1").arg(spinNumber->value()), -1 ); + settingsChanged(); +} + +void CSVImportDlg::removeWidth() +{ + unsigned int i = 0; + do { + if(listWidth->isSelected( i )) { + listWidth->removeItem( i ); + listWidth->setSelected( i-1, true ); + return; + } else + i++; + } while( i < listWidth->count() ); + settingsChanged(); +} + +QValueList CSVImportDlg::getFieldWidth() +{ + QValueList list; + + for( unsigned int i=0;icount();i++ ) + list << listWidth->text( i ).toInt(); + + return list; +} + +void CSVImportDlg::initCsvFile( CSVFile* file ) +{ + QValueList width = getFieldWidth(); + + file->setEncoding( comboEncoding->currentText() ); + file->setCSVFile( radioCSVFile->isChecked() ); + file->setComment( comment->text() ); + file->setSeparator( separator->text() ); + file->setQuote( quote->text() ); + file->setFieldWidth( width ); +} + + +#include "csvimportdlg.moc" diff --git a/kbarcode/csvimportdlg.h b/kbarcode/csvimportdlg.h new file mode 100644 index 0000000..b586880 --- /dev/null +++ b/kbarcode/csvimportdlg.h @@ -0,0 +1,127 @@ +/*************************************************************************** + csvimportdlg.h - description + ------------------- + begin : Don Aug 21 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef CSVIMPORTDLG_H +#define CSVIMPORTDLG_H + +#include +#include + +class CSVFile; +class EncodingCombo; +class KComboBox; +class KIntNumInput; +class KLineEdit; +class KPushButton; +class KURLRequester; +class QCheckBox; +class QFrame; +class QGroupBox; +class QTable; +class QRadioButton; + +/** Import a CSV (comma separated value) file into + * a SQL table. CSV files can be generated by almost + * any spreadsheet application. + * This dialog is also available as a separate application + * KESI ( http://kesi.sf.net ). + * This class makes importing data in KBarcode very easy + * for the user. + * + * @author Dominik Seichter + */ +class CSVImportDlg : public KDialogBase { + Q_OBJECT + public: + CSVImportDlg(QWidget *parent=0, const char *name=0); + ~CSVImportDlg(); + + private slots: + void settingsChanged(); + void setCol(); + void updateFields(); + void updateCol( int c ); + void addWidth(); + void removeWidth(); + + void enableControls(); + + private: + /** + * Returns the current database name which can be + * user specified or internal to KBarcode. + * It also enables the correct GUI items for + * a user specified or internal database. + * + * \returns the name of the current database table. + */ + QString getDatabaseName(); + + /** Get the field with from listWidth + * as an integer list. + */ + QValueList getFieldWidth(); + + /** Create the first tab of the dialog + * to set the import data. + */ + void createPage1(); + + /** Create the first tab of the dialog + * to set the import settings. + */ + void createPage2(); + + /** Initialize a CSVFile with the settings + * from the GUI. + */ + void initCsvFile( CSVFile* file ); + + private: + KComboBox* comboSQL; + KComboBox* comboField; + EncodingCombo* comboEncoding; + KIntNumInput* spinCol; + KPushButton* buttonSet; + KURLRequester* requester; + QFrame* frame; + QTable* table; + KLineEdit* databaseName; + + QRadioButton* radioCSVFile; + QRadioButton* radioFixedFile; + + KLineEdit* comment; + KLineEdit* quote; + KLineEdit* separator; + + QGroupBox* groupCSV; + QGroupBox* groupFixed; + + KListBox* listWidth; + KPushButton* buttonAdd; + KPushButton* buttonRemove; + KIntNumInput* spinNumber; + + QCheckBox* checkLoadAll; + KIntNumInput* spinLoadOnly; + + protected slots: + void accept(); +}; + +#endif diff --git a/kbarcode/databasebrowser.cpp b/kbarcode/databasebrowser.cpp new file mode 100644 index 0000000..50af772 --- /dev/null +++ b/kbarcode/databasebrowser.cpp @@ -0,0 +1,204 @@ +/*************************************************************************** + databasebrowser.cpp - description + ------------------- + begin : Mit Mai 15 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "databasebrowser.h" +#include "mydatatable.h" +#include "definition.h" +#include "sqltables.h" +#include "csvimportdlg.h" + +// Qt includes +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include + +#define CUR_TABLE_ID 6666 + +DatabaseBrowser::DatabaseBrowser( QString _database, QWidget *parent, const char *name ) + : DSMainWindow(parent,name) +{ + m_direction = m_case = false; + + table = new MyDataTable(this ); + setCentralWidget( table ); + + statusBar()->insertItem( i18n("Current Table: " ) + _database, CUR_TABLE_ID, 0, true ); + statusBar()->setSizeGripEnabled( true ); + statusBar()->show(); + + database = _database; + + connect( table, SIGNAL( cursorChanged( QSql::Op ) ), + SqlTables::getInstance(), SIGNAL( tablesChanged() ) ); + + connect( this, SIGNAL( connectedSQL() ), this, SLOT( setupSql() ) ); + + findDlg = 0; + + setupActions(); + show(); + + setupSql(); +} + +DatabaseBrowser::~DatabaseBrowser() +{ + // update sql label definitions + // because they may have changed + // TODO: + // add selction here to only update + // if neccessary! + Definition::updateProducer(); + DSMainWindow::saveConfig(); + + if( findDlg ) + delete findDlg; +} + +void DatabaseBrowser::setupActions() +{ + DSMainWindow::setupActions(); + KPopupMenu* editMenu = new KPopupMenu( this ); + + KAction* acut = KStdAction::cut( this, SLOT( cut() ), actionCollection() ); + KAction* acopy = KStdAction::copy( this, SLOT( copy() ), actionCollection() ); + KAction* apaste = KStdAction::paste( this, SLOT( paste() ), actionCollection() ); + KAction* afind = KStdAction::find( this, SLOT( find() ), actionCollection() ); + menuBar()->insertItem( i18n("&Edit"), editMenu, -1, 1 ); + + acut->plug( editMenu ); + acopy->plug( editMenu ); + apaste->plug( editMenu ); + + editMenu->insertSeparator(); + afind->plug( editMenu ); + KStdAction::findNext( this, SLOT( findNext() ), actionCollection() )->plug( editMenu ); + editMenu->insertSeparator(); + KAction* aimport = new KAction( i18n("&Import CSV File..."), "", + 0, this, SLOT(import()), actionCollection(), "import" ); + aimport->plug( editMenu ); + + acut->plug( toolBar() ); + acopy->plug( toolBar() ); + apaste->plug( toolBar() ); + + toolBar()->insertSeparator(); + afind->plug( toolBar() ); + + DSMainWindow::loadConfig(); +} + +void DatabaseBrowser::setupSql() +{ + QSqlCursor* cur = new QSqlCursor( database, true ); + cur->select(); + unsigned int i = 0; + unsigned int c = 0; + while ( cur->next() ) { + for( c = 0; c < cur->count(); c++ ) { + table->setText( i, c, cur->value( c ).toString() ); + table->horizontalHeader()->setLabel( c, cur->fieldName( c ) ); + } + i++; + } + + table->setNumCols( c ); + table->setNumRows( i ); + + table->setSqlCursor( cur, true, true ); + table->setSorting( true ); + table->setConfirmDelete( true ); + table->setAutoEdit( true ); + table->refresh( QDataTable::RefreshAll ); +} + +void DatabaseBrowser::find() +{ + if( !findDlg ) + findDlg = new KEdFind( this, "findDlg", false ); + + findDlg->setText( m_find ); + findDlg->setDirection( m_direction ); + findDlg->setCaseSensitive( m_case ); + connect( findDlg, SIGNAL( search() ), this, SLOT( findNext() ) ); + + findDlg->exec(); + +} + +void DatabaseBrowser::findNext() +{ + if( findDlg ) { + m_find = findDlg->getText(); + m_direction = findDlg->get_direction(); + m_case = findDlg->case_sensitive(); + } else + find(); + + table->find( m_find, m_case, m_direction ); +} + +void DatabaseBrowser::cut() +{ + QString text = table->value( table->currentRow(), table->currentColumn() ).toString(); + if( !text.isEmpty() ) { + kapp->clipboard()->setText( text ); + + QSqlRecord* buffer = table->sqlCursor()->primeUpdate(); + if( buffer ) { + buffer->setValue( table->horizontalHeader()->label( table->currentColumn() ), "" ); + table->sqlCursor()->update(); + table->refresh(); + } + + } +} + +void DatabaseBrowser::copy() +{ + QString text = table->value( table->currentRow(), table->currentColumn() ).toString(); + if( !text.isEmpty() ) + kapp->clipboard()->setText( text ); +} + +void DatabaseBrowser::paste() +{ + QString text = kapp->clipboard()->text(); + if( !text.isEmpty() ) { + QSqlRecord* buffer = table->sqlCursor()->primeUpdate(); + if( buffer ) { + buffer->setValue( table->horizontalHeader()->label( table->currentColumn() ), text ); + table->sqlCursor()->update(); + table->refresh(); + } + } + +} + +void DatabaseBrowser::import() +{ + new CSVImportDlg( this ); +} + +#include "databasebrowser.moc" diff --git a/kbarcode/databasebrowser.h b/kbarcode/databasebrowser.h new file mode 100644 index 0000000..1968f88 --- /dev/null +++ b/kbarcode/databasebrowser.h @@ -0,0 +1,69 @@ +/*************************************************************************** + databasebrowser.h - description + ------------------- + begin : Mit Mai 15 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef DATABASEBROWSER_H +#define DATABASEBROWSER_H + +#include "dsmainwindow.h" + +class KAction; +class KEdFind; +class KMenuBar; +class KToolBar; +class KPushButton; +class KPopupMenu; +class MyDataTable; +/** A database browser widget. Allows small changes to SQL tables + * and is mostly used for having a quick look on the tables. + */ +class DatabaseBrowser : public DSMainWindow{ + Q_OBJECT + public: + DatabaseBrowser( QString _database, QWidget *parent=0, const char *name=0); + ~DatabaseBrowser(); + + private: + void setupActions(); + + private slots: + void setupSql(); + + void cut(); + void copy(); + void paste(); + + void find(); + void findNext(); + + void import(); + + protected: + QString database; + MyDataTable* table; + + KAction* undoAct; + KAction* deleteAct; + KAction* newAct; + + KEdFind* findDlg; + + QString m_find; + bool m_direction; + bool m_case; +}; + +#endif diff --git a/kbarcode/definition.cpp b/kbarcode/definition.cpp new file mode 100644 index 0000000..675a36d --- /dev/null +++ b/kbarcode/definition.cpp @@ -0,0 +1,579 @@ +/*************************************************************************** + definition.cpp - description + ------------------- + begin : Mit Nov 20 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "definition.h" +#include "sqltables.h" + +// Qt includes +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include + +// a simple helper function +// that copies a file +bool filecopy( const char* src, const char* dest ) +{ + FILE* s; + FILE* d; + int c; + + d = fopen(dest, "w"); + if( d == NULL ) + return false; + + s = fopen(src, "r"); + if( s == NULL ) { + fclose( d ); + remove( dest ); + return false; + } + + while(( c = getc( s )) != EOF ) + putc( c, d ); + + fclose( s ); + fclose( d ); + return true; +} + +class PrivateParser { + public: + PrivateParser( QString line, bool all = true ); + ~PrivateParser(); + + const QString & getId() const { return m_label_def_id; } + const QString & getProducer() const { return m_producer; } + const QString & getType() const { return m_type; } + const Measurements & getMeasurements() const { return m_measure; }; + + private: + QString removeQuote( const QString & q ); + + QString m_label_def_id; + QString m_producer; + QString m_type; + + Measurements m_measure; +}; + +PrivateParser::PrivateParser( QString line, bool all ) +{ + line = line.stripWhiteSpace(); + int pos = line.find("("); + line = line.mid( pos + 1, line.length() - pos - 1 ); + + m_label_def_id = line.section( ",", 0, 0 ).stripWhiteSpace(); + m_producer = removeQuote( line.section( ",", 1, 1 ) ); + m_type = removeQuote( line.section( ",", 2, 2 ) ); + + if( all ) { + m_measure.setGapTopMM( line.section( ",", 4, 4 ).toDouble() ); + m_measure.setGapLeftMM( line.section( ",", 5, 5 ).toDouble() ); + m_measure.setHeightMM( line.section( ",", 6, 6 ).toDouble() ); + m_measure.setWidthMM( line.section( ",", 7, 7 ).toDouble() ); + m_measure.setGapVMM( line.section( ",", 8, 8 ).toDouble() ); + m_measure.setGapHMM( line.section( ",", 9, 9 ).toDouble() ); + m_measure.setNumH( line.section( ",", 10, 10 ).toInt() ); + m_measure.setNumV( line.section( ",", 11, 11 ).toInt() ); + + // fix broken label definitions + // with numh and numv = 0 + if( !m_measure.numH() ) + m_measure.setNumH( 1 ); + + if( !m_measure.numV() ) + m_measure.setNumV( 1 ); + } +} + +PrivateParser::~PrivateParser() +{ } + +QString PrivateParser::removeQuote( const QString & q ) +{ + QString quote = q.stripWhiteSpace(); + + if( quote.startsWith("'") ) + quote = quote.mid( 1, quote.length() - 1 ); + + if( quote.endsWith("'") ) + quote = quote.left( quote.length() - 1 ); + + return quote; +} + + +/***************************************************************************/ + +Definition::Definition( QWidget* parent ) + : m_parent( parent ) +{ + id = -1; +} + +Definition::Definition( int label_def_id, QWidget* parent ) + : m_parent( parent ) +{ + init( QString("%1").arg( label_def_id ) ); +} + +Definition::Definition( const QString & label_def_id, QWidget* parent ) + : m_parent( parent ) +{ + init( label_def_id ); +} + +Definition::Definition( const QString & producer, const QString & type, QWidget* parent ) + : m_parent( parent ) +{ + if( SqlTables::isConnected() ) { + QSqlQuery query( + "select label_no from " TABLE_LABEL_DEF " WHERE manufacture='" + producer + "' AND type='" + type + "'"); + while( query.next() ) + init( query.value( 0 ).toString() ); + } else { + if(!openFile()) + return; + + initProgress(); + + QString s; + while( file->readLine( s, 1000 ) != -1 ) { + if( s.isEmpty() || s.left( 1 ) == "#" ) + continue; + + increaseProgress(); + + PrivateParser p( s ); + if( p.getProducer() ==producer && p.getType() == type ) { + init( p.getId() ); + break; + } + } + + destroyProgress(); + } + +} + +Definition::~Definition() +{ +} + +QFile* Definition::file = 0; +QByteArray* Definition::array = 0; +QStringList* Definition::listProducers = 0; +QMap Definition::mapTypes; +QProgressDialog* Definition::m_progress = 0; + +void Definition::initProgress() +{ +/* + if(!m_progress) + m_progress = new QProgressDialog( i18n("Loading Label Definitions..."), QString::null, 0, NULL, "m_progress", true ); + + m_progress->setTotalSteps( 1000 ); + m_progress->show(); +*/ +// m_progress->reparent( m_parent, m_progress->pos(), true ); +} + +void Definition::increaseProgress() +{ +/* + if( m_progress ) + m_progress->setProgress( m_progress->progress() + 1 ); +*/ +} + +void Definition::destroyProgress() +{ +/* + if( m_progress ) + delete m_progress; + m_progress = NULL; +*/ +} + +void Definition::setId( const QString & label_def_id ) +{ + init( label_def_id ); +} + +void Definition::setId( int label_def_id ) +{ + init( QString("%1").arg( label_def_id ) ); +} + +void Definition::init( const QString & label_def_id ) +{ + if( SqlTables::isConnected() ) { + QSqlQuery* query = new QSqlQuery( + "select number_h, number_v, gap_left, gap_top, gap_v, gap_h, width, height, manufacture, type from " TABLE_LABEL_DEF + " WHERE label_no = " + label_def_id ); + + while( query->next() ) { + m_measure.setNumH( query->value( 0 ).toInt() ); + m_measure.setNumV( query->value( 1 ).toInt() ); + m_measure.setGapLeftMM( query->value( 2 ).toDouble() ); + m_measure.setGapTopMM( query->value( 3 ).toDouble() ); + m_measure.setGapVMM( query->value( 4 ).toDouble() ); + m_measure.setGapHMM( query->value( 5 ).toDouble() ); + m_measure.setWidthMM( query->value( 6 ).toDouble() ); + m_measure.setHeightMM( query->value( 7 ).toDouble() ); + producer = query->value( 8 ).toString(); + type = query->value( 9 ).toString(); + } + } else { + getFileMeasurements( label_def_id ); + } + + id = label_def_id.toInt(); + +} + +const Measurements & Definition::getMeasurements() const +{ + return m_measure; +} + +void Definition::getFileMeasurements( const QString & label_def_id ) +{ + if(!openFile()) { + m_measure = Measurements(); + return; + } + + initProgress(); + + QTextStream stream(*array, IO_ReadOnly ); + while( !stream.atEnd() ) { + QString s = stream.readLine(); + if( s.isEmpty() || s.startsWith( "#" ) ) + continue; + + increaseProgress(); + + PrivateParser p( s ); + if( p.getId() != label_def_id ) + continue; + + producer = p.getProducer(); + type = p.getType(); + m_measure = p.getMeasurements(); + break; + } + + destroyProgress(); +} + +bool Definition::openFile() +{ + if( file ) { + file->at( 0 ); + return true; + } + + QString f = locateLocal( "data", "kbarcode/labeldefinitions.sql" ); + if( !QFile::exists( f ) ) { + KConfig* config = kapp->config(); + config->setGroup( "Definitions" ); + + // copy file to new location + QString fname = config->readEntry( "defpath", locate( "data", "kbarcode/labeldefinitions.sql" ) ); + if( !QFile::exists( fname ) || fname.isEmpty() ) + return ( showFileError() ? openFile() : false ); + + if(!filecopy( (const char*)fname, (const char*)f )) + return ( showFileError() ? openFile() : false ); + } + + file = new QFile( f ); + if( !file->open( IO_ReadOnly ) ) { + delete file; + file = 0; + return ( showFileError() ? openFile() : false ); + } + + // keeping this array around + // increases speed quite a lot + // but does also cost lot's of memory + array = new QByteArray(); + *array = file->readAll(); + file->at( 0 ); + + return true; +} + +const QStringList Definition::getProducers() +{ + if( listProducers ) + return *listProducers; + + listProducers = new QStringList(); + + if( SqlTables::isConnected() ) { + QSqlQuery query("SELECT manufacture FROM " TABLE_LABEL_DEF " GROUP by manufacture;"); + while( query.next() ) + listProducers->append( query.value( 0 ).toString() ); + } else { + if(!openFile() ) + return *listProducers; + + initProgress(); + + QTextStream stream(*array, IO_ReadOnly ); + while( !stream.atEnd() ) { + QString s = stream.readLine(); + if( s.isEmpty() || s.startsWith( "#" ) ) + continue; + + increaseProgress(); + + PrivateParser p( s, false ); + if( !listProducers->contains( p.getProducer() ) ) + listProducers->append( p.getProducer() ); + } + + destroyProgress(); + } + + return *listProducers; +} + +const QStringList Definition::getTypes( QString producer ) +{ + if( mapTypes.contains( producer ) ) { + return mapTypes[producer]; + } + + QStringList list; + + if( SqlTables::isConnected() ) { + QSqlQuery query("SELECT type FROM " TABLE_LABEL_DEF " WHERE manufacture='" + producer + "'" ); + while( query.next() ) + if( !list.contains( query.value( 0 ).toString() ) ) + list.append( query.value( 0 ).toString() ); + } else { + if(!openFile()) + return list; + + initProgress(); + + QTextStream stream(*array, IO_ReadOnly ); + while( !stream.atEnd() ) { + QString s = stream.readLine(); + if( s.isEmpty() || s.startsWith( "#" ) ) + continue; + + increaseProgress(); + + PrivateParser p( s, false ); + if( p.getProducer() == producer ) + if( !list.contains( p.getType() ) ) + list.append( p.getType() ); + } + + destroyProgress(); + } + + mapTypes.insert( producer, list ); + + return list; +} + +void Definition::updateProducer() +{ + // TODO: check wether this function is + // correct! w/ SQL and without + if( listProducers ) { + delete listProducers; + listProducers = 0; + + if( array ) { + delete array; + array = 0; + } + + if( file ) { + file->close(); + delete file; + file = 0; + } + mapTypes.clear(); + } +} + +int Definition::write( const Measurements & c, QString type, QString producer ) +{ + int r = -1; + if( SqlTables::isConnected() ) + r = Definition::writeSQL( c, type, producer ); + else + r = Definition::writeFile( c, type, producer ); + + Definition::updateProducer(); + return r; +} + +int Definition::writeFile( const Measurements & c, QString type, QString producer ) +{ + if( !openFile() ) + return -1; + + QStringList data; + bool datawritten = false; + int index = 0; + QString entry = ", '" + + producer + "', '" + type + "', 'C',"+ I2S(c.gapTopMM()) + + ", " + I2S(c.gapLeftMM()) + ", " + + I2S(c.heightMM()) + ", " + I2S(c.widthMM()) + ", " + + I2S(c.gapVMM()) + ", " + I2S(c.gapHMM()) + ", " + + I2S(c.numH()) + ", " + I2S(c.numV()) + ", NULL, NULL )"; + + QString s; + while( file->readLine( s, 1000 ) != -1 ) { + if( s.isEmpty() || s.left( 1 ) == "#" ) { + data.append( s ); + continue; + } + + PrivateParser p( s ); + if( p.getId().toInt() > index ) + index = p.getId().toInt(); + + if( p.getType() == type && p.getProducer() == producer ) { + // update an item already present in the list + entry = entry.prepend( "INSERT INTO " TABLE_LABEL_DEF " VALUES (" + I2S(p.getId().toInt()) ); + data.append( entry ); + datawritten = true; + } else + data.append( s ); + } + + if( !datawritten ) { + entry = entry.prepend( "INSERT INTO " TABLE_LABEL_DEF " VALUES (" + I2S(index+1) ); + data.append( entry ); + } + + file->close(); + if( !file->open( IO_WriteOnly ) ) { + file->open( IO_ReadOnly ); + return -1; + } + + QTextStream t( file ); + for( unsigned int i = 0; i < data.count(); i++ ) + t << data[i].replace( QRegExp("\\n"), "" ) << "\n"; + + // get the file back to the normal stage + file->close(); + file->open( IO_ReadOnly ); + + return index + 1; +} + +int Definition::writeSQL( const Measurements & c, QString type, QString producer ) +{ + bool newitem = true; + QSqlQuery q( "SELECT manufacture, type FROM " TABLE_LABEL_DEF ); + // TODO: use a more inteligent query using where= + while( q.next() ) + if( q.value( 0 ) == producer && + q.value( 1 ) == type ) + newitem = false; + + if( newitem ) { + QSqlQuery query( + "INSERT INTO " TABLE_LABEL_DEF " (manufacture, type, gap_top, gap_left, " + "width, height, gap_v, gap_h, number_h, number_v) VALUES ('" + + producer + "', '" + type + "', '"+ I2S( c.gapTopMM() ) + + "', '" + I2S( c.gapLeftMM() ) + "', '" + + I2S( c.widthMM() ) + "', '" + I2S( c.heightMM() ) + "', '" + + I2S( c.gapVMM() ) + "', '" + I2S( c.gapHMM() ) + "', '" + + I2S( c.numH() ) + "', '" + I2S( c.numV() ) + "')" + ); + + if(!query.isValid()) + qDebug("Query to insert values not valid!"); + } else { + QSqlQuery query( "UPDATE " TABLE_LABEL_DEF " SET " + "gap_top = " + I2S( c.gapTopMM() ) + " ,gap_left = " + I2S( c.gapLeftMM() ) + + " ,width = " + I2S( c.widthMM() ) + " ,height = " + I2S( c.heightMM() ) + + " ,gap_v = " + I2S( c.gapVMM() ) + " ,gap_h = " + I2S( c.gapHMM() ) + + " ,number_h = " + I2S( c.numH() ) + " ,number_v = " + I2S( c.numV() ) + + " WHERE manufacture = '" + producer + "' AND" + " type = '" + type + "'" ); + + if(!query.isValid()) + qDebug("Query to update values not valid!\n%s\n", query.lastQuery().latin1() ); + } + + QSqlQuery qi("SELECT label_no FROM " TABLE_LABEL_DEF " WHERE manufacture='" + producer + "' AND type='" + type + "'" ); + while( qi.next() ) + return qi.value( 0 ).toInt(); + + return -1; +} + + +bool Definition::nodefmsg = true; +bool Definition::showFileError() +{ + if( nodefmsg ) { + KMessageBox::information( 0, + i18n("KBarcode is unable to find its label definitions." + "Please make sure that the file $KDEDIR/share/apps/kbarcode/labeldefinitions.sql " + "does exist. This file is part of the KBarcode distribution. " + "You will be prompted now to select the file containing the labeldefinitions."), + "", "NoDefinitionsFound" ); + + QString f = KFileDialog::getOpenFileName( QString::null, QString::null, 0 ); + if( !f.isEmpty() && QFile::exists( f ) ) { + KConfig* config = kapp->config(); + config->setGroup( "Definitions" ); + config->writeEntry( "defpath", f ); + config->sync(); + } + nodefmsg = false; + return openFile(); + } else + qDebug("No label definitions found. Please install them."); + + return false; +} + +int Definition::getClosest( const QString & producer, const QString & type ) +{ + QStringList t = Definition::getTypes(producer); + for( unsigned int z = 0; z < t.count(); z++ ) { + if( t[z] == type ) { + Definition d( producer, type ); + return d.getId(); + } + } + + return -1; +} diff --git a/kbarcode/definition.h b/kbarcode/definition.h new file mode 100644 index 0000000..a853a67 --- /dev/null +++ b/kbarcode/definition.h @@ -0,0 +1,101 @@ +/*************************************************************************** + definition.h - description + ------------------- + begin : Mit Nov 20 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef DEFINITION_H +#define DEFINITION_H + +#include "measurements.h" +#include "labelutils.h" +#include +#include + +#ifndef I2S + #define I2S(x) QString::number(x) +#endif // I2S + +class QWidget; +class QFile; +class QPaintDevice; +class QString; +class QStringList; +class QSqlQuery; +class Measurements; +class QProgressDialog; +/** @short A label definition; + * + * Represents a label definition. The definition is either read from + * a SQL database or from a text file on the harddisk. + * This class supports also writing new label definitions. + * After you selected a definition, you can retrieve its measurements. + * + * @author Dominik Seichter + */ +class Definition : private LabelUtils { + public: + Definition( QWidget* parent = 0 ); + Definition( int label_def_id, QWidget* parent = 0 ); + Definition( const QString & label_def_id, QWidget* parent = 0 ); + Definition( const QString & producer, const QString & type, QWidget* parent = 0 ); + ~Definition(); + + void setId( const QString & label_def_id ); + void setId( int label_def_id ); + + const Measurements & getMeasurements() const; + + static int write( const Measurements & c, QString type, QString producer ); + static int getClosest( const QString & producer, const QString & type ); + + static const QStringList getProducers(); + static const QStringList getTypes( QString producer ); + /** reread the list of producers, because it has changed + * mapType is also cleared and reread when necessary. + */ + static void updateProducer(); + + int getId() const { return id; } + const QString getProducer() const { return producer; } + const QString getType() const { return type; } + + private: + void init( const QString & label_def_id ); + void getFileMeasurements( const QString & label_def_id ); + static void initProgress(); + static void increaseProgress(); + static void destroyProgress(); + + static int writeSQL( const Measurements & c, QString type, QString producer ); + static int writeFile( const Measurements & c, QString type, QString producer ); + + static bool showFileError(); + static bool openFile(); + static QStringList* listProducers; + static QMap mapTypes; + static QFile* file; + static QByteArray* array; + static QProgressDialog* m_progress; + + QWidget* m_parent; + int id; + QString producer; + QString type; + Measurements m_measure; + bool locked; + static bool nodefmsg; +}; + +#endif diff --git a/kbarcode/definitiondialog.cpp b/kbarcode/definitiondialog.cpp new file mode 100644 index 0000000..d8f9484 --- /dev/null +++ b/kbarcode/definitiondialog.cpp @@ -0,0 +1,428 @@ +/*************************************************************************** + definitiondialog.cpp - description + ------------------- + begin : Don Apr 18 12:34:56 CEST 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "definitiondialog.h" +#include "printersettings.h" +#include "labelutils.h" +#include "definition.h" + +#include +#include +#include +#include +#include +#include + +// KDE includes +#include + +LabelPreview::LabelPreview( QWidget* parent, const char* name ) + : QWidget( parent, name) +{ + // For old DIN A4 preview + PrinterSettings* ps = PrinterSettings::getInstance(); + setFixedSize( QSize( ((int)ps->pageWidth() + 20)/2, ((int)ps->pageHeight() + 20)/2 ) ); + m_prv_enabled = true; +} + +LabelPreview::~LabelPreview() +{ } + +void LabelPreview::paintEvent( QPaintEvent* ) +{ + QPainter p( this ); + p.fillRect( 0, 0, width(), height(), QBrush( Qt::white ) ); + p.setPen( QPen( Qt::black ) ); + p.translate( 10, 10 ); + + p.fillRect( 0, 0, 210/2, 297/2, QBrush( Qt::gray ) ); + p.drawRect( 0, 0, 210/2, 297/2 ); + + if(!m_prv_enabled) + return; + +// int numv = measure.num_v > 0 ? measure.num_v : 1; + for( int v = 0; v < measure.numV(); v++ ) { + for( int h = 0; h < measure.numH(); h++ ) { + if( !v && !h ) + p.setPen( QPen( Qt::red ) ); + else + p.setPen( QPen( Qt::black ) ); + + p.fillRect( int(measure.gapLeftMM() + (measure.gapHMM() * h)) / 2, + int(measure.gapTopMM() + (measure.gapVMM() * v)) / 2 , + (int)measure.widthMM() / 2 , (int)measure.heightMM() / 2, QBrush( Qt::white ) ); + + p.drawRect( int(measure.gapLeftMM() + (measure.gapHMM() * h)) / 2, + int(measure.gapTopMM() + (measure.gapVMM() * v)) / 2, + (int)measure.widthMM() / 2, (int)measure.heightMM() / 2 ); + } + } +} + +/*****************************************/ +DefinitionDialog::DefinitionDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + resize( 465, 345 ); + setCaption( i18n( "Add Label Definition" ) ); + QHBoxLayout* layout = new QHBoxLayout( this, 6, 6 ); + DefinitionDialogLayout = new QVBoxLayout( 0, 11, 6, "DefinitionDialogLayout"); + + Layout17 = new QHBoxLayout( 0, 0, 6, "Layout17"); + + Layout13 = new QVBoxLayout( 0, 0, 6, "Layout13"); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setText( i18n( "Producer:" ) ); + Layout13->addWidget( TextLabel1 ); + + TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2->setText( i18n( "Type:" ) ); + Layout13->addWidget( TextLabel2 ); + + TextLabel3 = new QLabel( this, "TextLabel3" ); + TextLabel3->setText( QString( i18n( "Width (in %1):" ) ).arg( Measurements::system() ) ); + Layout13->addWidget( TextLabel3 ); + + TextLabel4 = new QLabel( this, "TextLabel4" ); + TextLabel4->setText( QString( i18n( "Height (in %1):" ) ).arg( Measurements::system() ) ); + Layout13->addWidget( TextLabel4 ); + + TextLabel5 = new QLabel( this, "TextLabel5" ); + TextLabel5->setText( i18n( "Horizontal Gap:" ) ); + Layout13->addWidget( TextLabel5 ); + + TextLabel6 = new QLabel( this, "TextLabel6" ); + TextLabel6->setText( i18n( "Vertical Gap:" ) ); + Layout13->addWidget( TextLabel6 ); + + TextLabel7 = new QLabel( this, "TextLabel7" ); + TextLabel7->setText( i18n( "Top Gap:" ) ); + Layout13->addWidget( TextLabel7 ); + + TextLabel8 = new QLabel( this, "TextLabel8" ); + TextLabel8->setText( i18n( "Left Gap:" ) ); + Layout13->addWidget( TextLabel8 ); + + TextLabel9 = new QLabel( this, "TextLabel9" ); + TextLabel9->setText( i18n("Number Horizontal:") ); + Layout13->addWidget( TextLabel9 ); + + TextLabel10 = new QLabel( this, "TextLabel10" ); + TextLabel10->setText( i18n("Number Vertical:") ); + Layout13->addWidget( TextLabel10 ); + + Layout17->addLayout( Layout13 ); + Layout14 = new QVBoxLayout( 0, 0, 6, "Layout14"); + + comboProducer = new KComboBox( FALSE, this, "comboProducer" ); + comboProducer->setEditable( TRUE ); + Layout14->addWidget( comboProducer ); + + comboType = new KComboBox( FALSE, this, "type" ); + comboType->setEditable( TRUE ); + Layout14->addWidget( comboType ); + + editWidth = new KRestrictedLine( this, "editWidth" ); + editWidth->setText( i18n( "0" ) ); + editWidth->setValidChars( i18n( "0123456789." ) ); + Layout14->addWidget( editWidth ); + + editHeight = new KRestrictedLine( this, "editHeight" ); + editHeight->setText( i18n( "0" ) ); + editHeight->setValidChars( i18n( "0123456789." ) ); + Layout14->addWidget( editHeight ); + + editHGap = new KRestrictedLine( this, "editHGap" ); + editHGap->setText( i18n( "0" ) ); + editHGap->setValidChars( i18n( "0123456789." ) ); + Layout14->addWidget( editHGap ); + + editVGap = new KRestrictedLine( this, "editVGap" ); + editVGap->setText( i18n( "0" ) ); + editVGap->setValidChars( i18n( "0123456789." ) ); + Layout14->addWidget( editVGap ); + + editTGap = new KRestrictedLine( this, "editTGap" ); + editTGap->setText( i18n( "0" ) ); + editTGap->setValidChars( i18n( "0123456789." ) ); + Layout14->addWidget( editTGap ); + + editLGap = new KRestrictedLine( this, "editLGap" ); + editLGap->setText( i18n( "0" ) ); + editLGap->setValidChars( i18n( "0123456789." ) ); + Layout14->addWidget( editLGap ); + + editNumH = new KRestrictedLine( this, "editNumH" ); + editNumH->setText( i18n( "0" ) ); + editNumH->setValidChars( "0123456789" ); + Layout14->addWidget( editNumH ); + + editNumV = new KRestrictedLine( this, "editNumV" ); + editNumV->setText( i18n( "0" ) ); + editNumV->setValidChars( "0123456789" ); + Layout14->addWidget( editNumV ); + + Layout17->addLayout( Layout14 ); + QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout17->addItem( spacer ); + DefinitionDialogLayout->addLayout( Layout17 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + DefinitionDialogLayout->addItem( spacer_2 ); + + Layout16 = new QHBoxLayout( 0, 0, 6, "Layout16"); + buttonInfo = new KPushButton( i18n("More &Information"), this ); + Layout16->addWidget( buttonInfo ); + + QSpacerItem* spacer_3 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout16->addItem( spacer_3 ); + + buttonAdd = new KPushButton( this, "buttonAdd" ); + buttonAdd->setText( i18n( "&Add" ) ); + Layout16->addWidget( buttonAdd ); + + buttonCancel = new KPushButton( this, "buttonCancel" ); + buttonCancel->setText( i18n( "&Cancel" ) ); + Layout16->addWidget( buttonCancel ); + DefinitionDialogLayout->addLayout( Layout16 ); + + preview = new LabelPreview( this ); + layout->addLayout( DefinitionDialogLayout ); + layout->addWidget( preview ); + + l = new QLabel( this ); + setExtension( l ); + setOrientation( Vertical ); + + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonAdd, SIGNAL( clicked() ), this, SLOT( add() ) ); + + connect( editWidth, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editHeight, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editHGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editVGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editTGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editLGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editNumH, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + connect( editNumV, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) ); + + comboProducer->setInsertionPolicy( QComboBox::NoInsertion ); + comboType->setInsertionPolicy( QComboBox::NoInsertion ); + + comboProducer->clear(); + QStringList list = Definition::getProducers(); + comboProducer->insertStringList( list ); + + types = new QStringList[list.count()]; + for( unsigned int i = 0; i < list.count(); i++ ) + types[i] = Definition::getTypes( list[i] ); + + connect( comboProducer, SIGNAL( textChanged(const QString &) ), this, SLOT( updateType() ) ); + connect( comboType, SIGNAL( textChanged(const QString &) ), this, SLOT( updateText() ) ); + connect( buttonInfo, SIGNAL( clicked() ), this, SLOT( toggleExtension() ) ); + + drawGraphic(); + updateType(); + + showExtension( false ); +} + +DefinitionDialog::~DefinitionDialog() +{ + delete [] types; +} + +void DefinitionDialog::add() +{ + Definition::write( getCurrentMeasure(), comboType->currentText(), comboProducer->currentText() ); + + accept(); +} + +void DefinitionDialog::updateType() +{ + comboType->clear(); + if( comboProducer->currentText() == comboProducer->text( comboProducer->currentItem() ) ) + if( comboProducer->currentItem() < comboProducer->count()) + comboType->insertStringList( types[ comboProducer->currentItem() ] ); + comboType->insertItem( i18n( "Custom" ), 0 ); +} + +const Measurements DefinitionDialog::getCurrentMeasure() +{ + Measurements m; + m.setGapLeft( editLGap->text().toDouble() ); + m.setGapTop( editTGap->text().toDouble() ); + m.setWidth( editWidth->text().toDouble() ); + m.setHeight( editHeight->text().toDouble() ); + m.setGapV( editVGap->text().toDouble() ); + m.setGapH( editHGap->text().toDouble() ); + m.setNumH( editNumH->text().toInt() ); + m.setNumV( editNumV->text().toInt() ); + + return m; +} + +void DefinitionDialog::updateText() +{ + Definition d( comboProducer->currentText(), comboType->currentText() ); + Measurements m = d.getMeasurements(); + + editTGap->setText( I2S( m.gapTop() ) ); + editLGap->setText( I2S( m.gapLeft() ) ); + editWidth->setText( I2S( m.width() ) ); + editHeight->setText( I2S( m.height() ) ); + editVGap->setText( I2S( m.gapV() ) ); + editHGap->setText( I2S( m.gapH() ) ); + editNumH->setText( I2S( m.numH() ) ); + editNumV->setText( I2S( m.numV() ) ); + + updatePreview(); +} + +void DefinitionDialog::updatePreview() +{ + Measurements m = getCurrentMeasure(); + + editHeight->setPaletteForegroundColor( Qt::black ); + editWidth->setPaletteForegroundColor( Qt::black ); + editVGap->setPaletteForegroundColor( Qt::black ); + editHGap->setPaletteForegroundColor( Qt::black ); + editTGap->setPaletteForegroundColor( Qt::black ); + editLGap->setPaletteForegroundColor( Qt::black ); + editNumH->setPaletteForegroundColor( Qt::black ); + editNumV->setPaletteForegroundColor( Qt::black ); + + // Mark errors in Red + if( m.heightMM() > PrinterSettings::getInstance()->pageHeight() ) + editHeight->setPaletteForegroundColor( Qt::red ); + + if( m.widthMM() > PrinterSettings::getInstance()->pageWidth() ) + editWidth->setPaletteForegroundColor( Qt::red ); + + if( m.gapVMM() < m.heightMM() ) + editVGap->setPaletteForegroundColor( Qt::red ); + + if( m.gapHMM() < m.widthMM() ) + editHGap->setPaletteForegroundColor( Qt::red ); + + if( m.gapTopMM() > PrinterSettings::getInstance()->pageHeight() - m.heightMM() ) + editTGap->setPaletteForegroundColor( Qt::red ); + + if( m.gapLeftMM() > PrinterSettings::getInstance()->pageWidth() - m.widthMM() ) + editLGap->setPaletteForegroundColor( Qt::red ); + + if( m.gapLeftMM() + m.numH() * m.gapHMM() > PrinterSettings::getInstance()->pageWidth() ) + editNumH->setPaletteForegroundColor( Qt::red ); + + if( m.gapTopMM() + m.numV() * m.gapVMM() > PrinterSettings::getInstance()->pageHeight() ) + editNumV->setPaletteForegroundColor( Qt::red ); + + preview->setRect( QRect( (int)m.gapLeftMM(), (int)m.gapTopMM(), (int)m.widthMM(), (int)m.heightMM() ) ); + preview->setMeasurements( m ); + preview->repaint(); +} + +void DefinitionDialog::drawGraphic() +{ + QWMatrix wm; + wm.rotate( 90 ); + + QPixmap pic( 450, 330 ); + pic.fill( Qt::gray ); + + QPainter p( &pic ); + p.setPen( Qt::black ); + + p.fillRect( 60, 60, 450, 330, QColor( 255, 254, 217 ) ); + p.drawRect( 60, 60, 450, 330 ); + p.setBrush( Qt::white ); + + p.setPen( Qt::DotLine ); + p.drawRoundRect( 90, 90, 150, 90 ); + p.drawRoundRect( 270, 90, 150, 90 ); + + p.drawRoundRect( 90, 210, 150, 90 ); + p.drawRoundRect( 270, 210, 150, 90 ); + + // Draw width + p.setPen( QPen( Qt::red, 2 ) ); + p.drawLine( 90, 150, 240, 150 ); + + // Draw numh + p.drawLine( 90, 270, 450, 270 ); + + // Draw Gap Top + p.setPen( QPen( Qt::red, 2, Qt::DotLine ) ); + p.drawLine( 0, 60, 90, 60 ); + p.drawLine( 0, 90, 90, 90 ); + + // draw Gap V + p.drawLine( 0, 210, 90, 210 ); + + // Draw height + p.setPen( QPen( Qt::green, 2 ) ); + p.drawLine( 150, 90, 150, 180 ); + + + // Draw numv + p.drawLine( 330, 90, 330, 330 ); + + // Draw Gap Left + p.setPen( QPen( Qt::green, 2, Qt::DotLine ) ); + p.drawLine( 60, 0, 60, 90 ); + p.drawLine( 90, 0, 90, 90 ); + + // draw Gap H + p.drawLine( 270, 0, 270, 90 ); + + // draw Texts: + p.setPen( Qt::black ); + p.drawText( 100, 140, i18n("Width") ); + p.drawText( 160, 120, i18n("Height") ); + p.drawText( 100, 260, i18n("Number of horizontal Labels") ); + + QPixmap* pix = LabelUtils::drawString( i18n("Number of vertical Labels") ); + p.drawPixmap( 340, 110, pix->xForm( wm ) ); + delete pix; + + p.drawText( 5, 80, i18n("Gap Top") ); + + pix = LabelUtils::drawString( i18n("Gap Left") ); + + p.drawPixmap( 60, 5, pix->xForm( wm ) ); + delete pix; + + p.drawText( 5, 150, i18n("Vertical Gap") ); + p.drawText( 150, 50, i18n("Horizontal Gap") ); + + p.end(); + + l->setPixmap( pic ); +} + +void DefinitionDialog::toggleExtension() +{ + if( l->isVisible() ) { + showExtension( false ); + } else + showExtension( true ); +} + + +#include "definitiondialog.moc" diff --git a/kbarcode/definitiondialog.h b/kbarcode/definitiondialog.h new file mode 100644 index 0000000..701ce6f --- /dev/null +++ b/kbarcode/definitiondialog.h @@ -0,0 +1,99 @@ +#ifndef DEFINITIONDIALOG_H +#define DEFINITIONDIALOG_H + +#include +#include +#include "measurements.h" + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class KComboBox; +class KPushButton; +class KRestrictedLine; +class QLabel; +class QStringList; +class QRect; +class QPaintEvent; +/** Displays a preview of the given label measurements. + * The current page size setting of the user is used. + * The labels are drawn using QPainter. Only one page is previewed. + */ +class LabelPreview : public QWidget { + Q_OBJECT + public: + LabelPreview( QWidget* parent = 0, const char* name = 0 ); + ~LabelPreview(); + + void setRect( QRect label ) { size = label; } + void setMeasurements( const Measurements & m ) { measure = m; } + + void setPrvEnabled( bool b ) { m_prv_enabled = b; } + + protected: + void paintEvent( QPaintEvent* ); + QRect size; + Measurements measure; + + bool m_prv_enabled; +}; + +/** A dialog which allows the user to create his/her own + * label definitions easily. + */ +class DefinitionDialog : public QDialog +{ + Q_OBJECT + +public: + DefinitionDialog( QWidget* parent = 0, const char* name = 0, bool modal = true, WFlags fl = 0 ); + ~DefinitionDialog(); +private: + const Measurements getCurrentMeasure(); + +private slots: + void add(); + void updateType(); + void updateText(); + void updatePreview(); + void toggleExtension(); + void drawGraphic(); + +protected: + QLabel* l; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QLabel* TextLabel4; + QLabel* TextLabel5; + QLabel* TextLabel6; + QLabel* TextLabel7; + QLabel* TextLabel8; + QLabel* TextLabel9; + QLabel* TextLabel10; + KComboBox* comboProducer; + KComboBox* comboType; + KRestrictedLine* editWidth; + KRestrictedLine* editHeight; + KRestrictedLine* editHGap; + KRestrictedLine* editVGap; + KRestrictedLine* editTGap; + KRestrictedLine* editLGap; + KRestrictedLine* editNumH; + KRestrictedLine* editNumV; + KPushButton* buttonAdd; + KPushButton* buttonCancel; + KPushButton* buttonInfo; + + QStringList* types; + LabelPreview* preview; + +protected: + QVBoxLayout* DefinitionDialogLayout; + QHBoxLayout* Layout17; + QVBoxLayout* Layout13; + QVBoxLayout* Layout14; + QHBoxLayout* Layout16; +}; + +#endif // DEFINITIONDIALOG_H diff --git a/kbarcode/documentitem.cpp b/kbarcode/documentitem.cpp new file mode 100644 index 0000000..8d85eeb --- /dev/null +++ b/kbarcode/documentitem.cpp @@ -0,0 +1,245 @@ +/*************************************************************************** + documentitem.cpp - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "documentitem.h" +#include "tcanvasitem.h" + +#include "labelutils.h" + +#include + +#include +#include +#include +#include + +DocumentItem::DocumentItem() + : QObject(), XMLUtils() +{ + init(); +} + +void DocumentItem::init() +{ + m_canvasitem = NULL; + m_token = NULL; + m_device = KApplication::desktop(); + + m_z = 0; + m_border = true; + m_locked = false; + m_pen = QPen( Qt::black, 1, Qt::SolidLine ); + m_rect = QRect( 0, 0, 0, 0 ); + m_visibilityScript = "true"; +} + +void DocumentItem::drawBorder(QPainter* painter) +{ + if( m_border ) + { + painter->save(); + painter->setPen( m_pen ); + painter->drawRect( rect() ); + painter->restore(); + } +} + +void DocumentItem::loadXML (QDomElement* element) +{ + LabelUtils l; + m_rect.setX( element->attribute( "x_mm", "0" ).toInt() ); + m_rect.setY( element->attribute( "y_mm", "0" ).toInt() ); + m_rect.setWidth( element->attribute( "width_mm", "-1" ).toInt() ); + m_rect.setHeight( element->attribute( "height_mm", "-1" ).toInt() ); + + m_pen.setColor( readXMLColor( element, "line-color", Qt::black ) ); + m_pen.setStyle( (Qt::PenStyle)element->attribute( "line-style", "0" ).toInt() ); + m_pen.setWidth( element->attribute( "line-width", "1" ).toInt() ); + m_border = (bool)element->attribute( "line-visible", "1" ).toInt(); + m_z = element->attribute( "z", "0" ).toInt(); + m_locked = (bool)element->attribute( "locked", "0" ).toInt(); + m_visibilityScript = element->attribute( "visibilityScript", "true" ); +} + +void DocumentItem::saveXML (QDomElement* element) +{ + element->setAttribute( "x_mm", m_rect.x() ); + element->setAttribute( "y_mm", m_rect.y() ); + element->setAttribute( "width_mm", m_rect.width() ); + element->setAttribute( "height_mm", m_rect.height() ); + + writeXMLColor( element, "line-color", m_pen.color() ); + element->setAttribute( "line-style", (Qt::PenStyle)m_pen.style() ); + element->setAttribute( "line-width", m_pen.width() ); + element->setAttribute( "line-visible", (int)m_border ); + element->setAttribute( "z", m_z ); + element->setAttribute( "locked", (int)m_locked ); + element->setAttribute( "visibilityScript", m_visibilityScript ); +} + +void DocumentItem::move( int x, int y ) +{ + LabelUtils l; + moveMM( (int)(l.pixelToMm( x, m_device, LabelUtils::DpiX ) * 1000.0 ), + (int)(l.pixelToMm( y, m_device, LabelUtils::DpiY ) * 1000.0 ) ); +} + +void DocumentItem::moveMM( int x, int y ) +{ +// Move is not relative! +/* m_rect.setX( m_rect.x() + x ); + m_rect.setY( m_rect.y() + y );*/ + m_rect = QRect( x, y, m_rect.width(), m_rect.height() ); +} + +void DocumentItem::setSize( int w, int h ) +{ + LabelUtils l; + setSizeMM( (int)(l.pixelToMm( w, m_device, LabelUtils::DpiX ) * 1000.0 ), + (int)(l.pixelToMm( h, m_device, LabelUtils::DpiY ) * 1000.0 ) ); +} + +void DocumentItem::setSizeMM( int w, int h ) +{ + m_rect.setWidth( w ); + m_rect.setHeight( h ); +} + +void DocumentItem::setBoundingRect( const QRect & rect ) +{ + QRect r; + LabelUtils l; + r.setX( (int)(l.pixelToMm( rect.x(), m_device, LabelUtils::DpiX ) * 1000.0 ) ); + r.setY( (int)(l.pixelToMm( rect.y(), m_device, LabelUtils::DpiY ) * 1000.0 ) ); + r.setWidth( (int)(l.pixelToMm( rect.width(), m_device, LabelUtils::DpiX ) * 1000.0 ) ); + r.setHeight( (int)(l.pixelToMm( rect.height(), m_device, LabelUtils::DpiY ) * 1000.0 ) ); + + // avoid resizing to negative values + setRectMM( r.normalize() ); +} + +QRect DocumentItem::boundingRect() const +{ + QRect r; + + LabelUtils l; + r.setX( (int)(l.mmToPixel( m_rect.x(), m_device, LabelUtils::DpiX ) / 1000.0 ) ); + r.setY( (int)(l.mmToPixel( m_rect.y(), m_device, LabelUtils::DpiY ) / 1000.0 ) ); + r.setWidth( (int)(l.mmToPixel( m_rect.width(), m_device, LabelUtils::DpiX ) / 1000.0 ) ); + r.setHeight( (int)(l.mmToPixel( m_rect.height(), m_device, LabelUtils::DpiY ) / 1000.0 ) ); + +// qDebug("bounding rect %i %i %i %i", r.x(), r.y(), r.width(), r.height() ); + + return r; +} + +void DocumentItem::setRect( const QRect & rect) +{ + // avoid resizing to negative values + QRect r = rect.normalize(); + setBoundingRect( QRect( r.x() - m_pen.width(), r.y() - m_pen.width(), r.width() + 2 * m_pen.width(), r.height() + 2 * m_pen.width() ) ); +} + +QRect DocumentItem::rect() const +{ + QRect bound = boundingRect(); + QRect r( bound.x() + m_pen.width(), bound.y() + m_pen.width(), bound.width() - 2 * m_pen.width(), bound.height() - 2 * m_pen.width() ); +// qDebug("rect %i %i %i %i", r.x(), r.y(), r.width(), r.height() ); + return r; +} + +void DocumentItem::setRectMM( const QRect & rect ) +{ + // avoid resizing to negative values + m_rect = rect.normalize(); +} + +QRect DocumentItem::rectMM() const +{ + return m_rect; +} + +void DocumentItem::setBorder (bool b) +{ + m_border = b; +} + +bool DocumentItem::border () const +{ + return m_border; +} + +void DocumentItem::setPen( const QPen & pen ) +{ + m_pen = pen; +} + +QPen DocumentItem::pen() const +{ + return m_pen; +} + +void DocumentItem::setCanvasItem( TCanvasItem* item ) +{ + m_canvasitem = item; +} + +TCanvasItem* DocumentItem::canvasItem() const +{ + return m_canvasitem; +} + +int DocumentItem::z() const +{ + return m_z; +} + +void DocumentItem::setZ( int z ) +{ + m_z = z; +} + +void DocumentItem::setPaintDevice( QPaintDevice* device ) +{ + m_device = device; +} + +QPaintDevice* DocumentItem::paintDevice() const +{ + return m_device; +} + +void DocumentItem::setTokenProvider( TokenProvider* token ) +{ + m_token = token; +} + +TokenProvider* DocumentItem::tokenProvider() const +{ + return m_token; +} + +void DocumentItem::setLocked( bool locked ) +{ + m_locked = locked; +} + +const bool DocumentItem::locked() const +{ + return m_locked; +} + diff --git a/kbarcode/documentitem.h b/kbarcode/documentitem.h new file mode 100644 index 0000000..ff528d3 --- /dev/null +++ b/kbarcode/documentitem.h @@ -0,0 +1,230 @@ +/*************************************************************************** + documentitem.h - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef DOCUMENTITEM_H +#define DOCUMENTITEM_H + +#include +#include +#include +#include +#include + +#include +#include + +#include "zplutils.h" + +enum ERtti { + eRtti_Barcode, + eRtti_Image, + eRtti_Line, + eRtti_Rect, + eRtti_Text, + //NY33 + eRtti_TextLine + //NY33 +}; + +class QDomElement; +class QPainter; +class QPaintDevice; +class QTextStream; +class TCanvasItem; +class TokenProvider; + +/** + * Class DocumentItem + * Every object which can be placed on a document has to be a subclass of this class. + */ +class DocumentItem : public QObject, protected XMLUtils { +public: + DocumentItem ( ); + virtual ~DocumentItem() { }; + + /** + * + * @param element + */ + virtual void loadXML (QDomElement* element); + + + /** + * save this item to XML + */ + virtual void saveXML (QDomElement* element); + + + /** + * Draws the item + */ + virtual void draw (QPainter* painter) = 0; + + + /** + * Draw a border around the item, has to be reimplemented for round items or barcodes which do not allow borders. + */ + virtual void drawBorder (QPainter* painter); + + virtual int rtti () const = 0; + + /** + * Write a ZPL string for drawing this item onto a zebra printer to a QTextStream + */ + virtual void drawZpl( QTextStream* stream ) = 0; + + /** + * Write a IPL string for drawing this item onto a zebra printer to a QTextStream + */ + virtual void drawIpl( QTextStream* stream, IPLUtils* utils ) = 0; + + /** + * Write a EPCL string for drawing this item onto a zebra printer to a QTextStream + */ + virtual void drawEPcl( QTextStream* stream ) = 0; + + void setCanvasItem( TCanvasItem* item ); + TCanvasItem* canvasItem() const; + + void setPaintDevice( QPaintDevice* device ); + QPaintDevice* paintDevice() const; + + void setTokenProvider( TokenProvider* token ); + TokenProvider* tokenProvider() const; + + /** + * + * @param b + */ + void setBorder (bool b); + bool border () const; + + void setPen( const QPen& pen ); + QPen pen() const; + + /** move the documentitem using pixel coordinates on the current + * paint device + */ + void move( int x, int y ); + /** move the documentitem using 1/1000th of a millimeter coordinates + */ + void moveMM( int x, int y ); + + /** set the width and height of this item using pixel coordinates + * of the current paint device + */ + void setSize( int w, int h ); + /** set the width and height of this item using 1/1000th of a + * millimeter coordinates + */ + void setSizeMM( int w, int h ); + + /** The bounding rectangle. I.e. the rectangle including + * the border width + */ + void setBoundingRect( const QRect & rect ); + /** The bounding rectangle. I.e. the rectangle including + * the border width + */ + QRect boundingRect() const; + + /** The drawing rectangle. I.e. the rectangle with the + * border width substracted + */ + void setRect( const QRect & rect ); + /** The drawing rectangle. I.e. the rectangle with the + * border width substracted + */ + QRect rect() const; + + /** the bounding rectangle including the border in 1/1000mm + */ + void setRectMM( const QRect & rect ); + /** the bounding rectangle including the border in 1/1000mm + */ + QRect rectMM() const; + + /** set the item to be locked in the label editor + * i.e protect it from being move or resized by the user + */ + void setLocked( bool locked ); + const bool locked() const; + + /** set a javascript script for this item which is evaluate + * to determine wether this item should be printed (only in Label + * as items are always shown in the labeleditor. + * The script shall return true if the item should be visible. + * If script returns false the item will not be printed. + */ + inline void setVisibilityScript( const QString & script ); + inline const QString visibilityScript() const; + + int z() const; + void setZ( int z ); + + /** Only the z index is compared + */ + bool operator<( const DocumentItem & docitem ) + { + return m_z < docitem.m_z; + } + + /** Only the z index is compared + */ + bool operator==( const DocumentItem & docitem ) + { + return m_z == docitem.m_z; + } +private: + void init(); + +private: + /** + * Defines wether this item has a border or not + */ + bool m_border; + QPen m_pen; + QRect m_rect; + int m_z; + bool m_locked; + + /** + * Background color of this document item + */ + QColor m_background; + + QString m_visibilityScript; + + QPaintDevice* m_device; + TCanvasItem* m_canvasitem; + TokenProvider* m_token; +}; + +void DocumentItem::setVisibilityScript( const QString & script ) +{ + m_visibilityScript = script; +} + +const QString DocumentItem::visibilityScript() const +{ + return m_visibilityScript; +} + +typedef QSortedList DocumentItemList; + +#endif //DOCUMENTITEM_H + diff --git a/kbarcode/documentitemdlg.cpp b/kbarcode/documentitemdlg.cpp new file mode 100644 index 0000000..9055de4 --- /dev/null +++ b/kbarcode/documentitemdlg.cpp @@ -0,0 +1,121 @@ +/*************************************************************************** + documentitemdlg.cpp - description + ------------------- + begin : Do Sep 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "documentitemdlg.h" +#include "tokenprovider.h" + +#include + +#include +#include + +DocumentItemDlg::DocumentItemDlg( TokenProvider* token, DocumentItem* item, KCommandHistory* history, QWidget* parent ) + : KDialogBase( Tabbed, i18n("Properties"), KDialogBase::Ok|KDialogBase::Cancel, + KDialogBase::Ok, parent, 0, true, true ) +{ + m_item = item; + m_history = history; + //m_list.setAutoDelete( false ); + + QVBox* boxBorder = addVBoxPage(i18n("&Position && Size"), QString::null, QPixmap() ); + addPage( new PropertySize( boxBorder ) ); + + boxBorder = addVBoxPage(i18n("&Border"), QString::null, QPixmap() ); + addPage( new PropertyBorder( boxBorder ) ); + + if( m_item->rtti() == eRtti_Rect ) + { + boxBorder = addVBoxPage(i18n("&Fill Color"), QString::null, QPixmap() ); + addPage( new PropertyFill( boxBorder) ); + } + else if ( m_item->rtti() == eRtti_Barcode ) + { + boxBorder = addVBoxPage(i18n("&Barcode"), QString::null, QPixmap() ); + addPage( new PropertyBarcode( token, boxBorder) ); + } + else if ( m_item->rtti() == eRtti_Text ) + { + boxBorder = addVBoxPage(i18n("&Rotation"), QString::null, QPixmap() ); + addPage( new PropertyRotation( boxBorder ) ); + + boxBorder = addVBoxPage(i18n("&Text"), QString::null, QPixmap() ); + addPage( new PropertyText( token, boxBorder) ); + } + else if( m_item->rtti() == eRtti_Image ) + { + boxBorder = addVBoxPage(i18n("&Image"), QString::null, QPixmap() ); + addPage( new PropertyImage( token, boxBorder) ); + } +//NY19 + else if ( m_item->rtti() == eRtti_TextLine ) + { + boxBorder = addVBoxPage(i18n("&Text"), QString::null, QPixmap() ); + addPage( new PropertyTextLine( token, boxBorder) ); + } +//NY19 + + showPage( pageIndex( boxBorder ) ); + + // Add it after the call to showPage + // so that this page is not always shown + // as default page + if( TokenProvider::hasJavaScript() ) + { + boxBorder = addVBoxPage(i18n("&Visibility"), QString::null, QPixmap() ); + addPage( new PropertyVisible( boxBorder ) ); + } + + std::list::iterator it; + for( it=m_list.begin();it!=m_list.end();it++) + { + (*it)->initSettings( m_item ); + } + + resize( configDialogSize("DocumentItemDlg") ); +} + +DocumentItemDlg::~DocumentItemDlg() +{ + saveDialogSize("DocumentItemDlg"); + + std::list::iterator it; + for( it=m_list.begin();it!=m_list.end();it++) + { + delete (*it); + } +} + +void DocumentItemDlg::addPage( PropertyWidget* widget ) +{ + m_list.push_back( widget ); +} + +void DocumentItemDlg::accept() +{ + KMacroCommand* mc = new KMacroCommand( i18n("Property changed") ); + std::list::iterator it; + for( it=m_list.begin();it!=m_list.end();it++) + { + (*it)->applySettings( m_item, mc ); + } + + m_history->addCommand( mc, false ); + + KDialogBase::accept(); +} + +#include "documentitemdlg.moc" diff --git a/kbarcode/documentitemdlg.h b/kbarcode/documentitemdlg.h new file mode 100644 index 0000000..732432e --- /dev/null +++ b/kbarcode/documentitemdlg.h @@ -0,0 +1,47 @@ +/*************************************************************************** + documentitemdlg.h - description + ------------------- + begin : Do Sep 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef DOCUMENTITEMDLG_H +#define DOCUMENTITEMDLG_H + +#include +#include "documentitem.h" +#include "propertywidget.h" +#include + +class KCommandHistory; + +class DocumentItemDlg : public KDialogBase +{ + Q_OBJECT + public: + DocumentItemDlg( TokenProvider* token, DocumentItem* item, KCommandHistory* history, QWidget* parent ); + ~DocumentItemDlg(); + + void addPage( PropertyWidget* widget ); + + protected slots: + void accept(); + + private: + DocumentItem* m_item; + std::list m_list; + + KCommandHistory* m_history; +}; + +#endif diff --git a/kbarcode/dsmainwindow.cpp b/kbarcode/dsmainwindow.cpp new file mode 100644 index 0000000..0e30c4d --- /dev/null +++ b/kbarcode/dsmainwindow.cpp @@ -0,0 +1,268 @@ +/*************************************************************************** + dsmainwindow.cpp - description + ------------------- + begin : Fri Jan 17 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "dsmainwindow.h" +#include "sqltables.h" +#include "confwizard.h" +#include "printersettings.h" +#include "kbarcodesettings.h" +#include "kactionmap.h" +#include "barkode.h" + +// Qt includes +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +bool DSMainWindow::autoconnect = true; +bool DSMainWindow::startwizard = true; + +DSMainWindow::DSMainWindow(QWidget *parent, const char *name, WFlags f) + : KMainWindow(parent,name,f) +{ + connectAct = 0; + first = false; + loadConfig(); + + setAutoSaveSettings( QString("Window") + name, true ); + connect( kapp, SIGNAL( aboutToQuit() ), this, SLOT( saveConfig() ) ); + + if( first && startwizard ) { + wizard(); + startwizard = false; + } + +} + +DSMainWindow::~DSMainWindow() +{ +} + +void DSMainWindow::setupActions() +{ + KAction* quitAct = KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + KAction* closeAct = KStdAction::close( this, SLOT( close() ), actionCollection(), "close" ); + KAction* configureAct = KStdAction::preferences( KBarcodeSettings::getInstance(), SLOT(configure()), actionCollection() ); + KAction* wizardAct = new KAction( i18n("&Start Configuration Wizard..."), BarIcon("wizard"), 0, this, + SLOT(wizard()), actionCollection(), "wizard" ); + connectAct = new KAction(i18n("&Connect to Database"), BarIcon("connect_no"), 0, this, SLOT(connectMySQL()), + actionCollection(),"connect" ); + + + KAction* newTablesAct = new KAction( i18n("&Create Tables"), "", 0, this, + SLOT(newTables()), actionCollection(), "tables" ); + + importLabelDefAct = new KAction( i18n("&Import Label Definitions"), "", 0, SqlTables::getInstance(), + SLOT(importLabelDef()), actionCollection(), "import" ); + + importExampleAct = new KAction( i18n("&Import Example Data"), "", 0, SqlTables::getInstance(), + SLOT(importExampleData()), actionCollection(), "import" ); + + KPopupMenu* file = new KPopupMenu( this ); + KPopupMenu* settings = new KPopupMenu( this ); + KPopupMenu* hlpMenu = helpMenu(); + int helpid = hlpMenu->idAt( 0 ); + hlpMenu->removeItem( helpid ); + hlpMenu->insertItem( SmallIconSet("contents"), i18n("&Help"), + this, SLOT(appHelpActivated()), Key_F1, -1, 0 ); + hlpMenu->insertSeparator(-1); + hlpMenu->insertItem( i18n("&Action Map..."), this, SLOT( slotFunctionMap() ), 0, -1, 0 ); + hlpMenu->insertSeparator(-2); + hlpMenu->insertItem( SmallIconSet("system"), i18n("&System Check..."), this, SLOT(showCheck() ), 0, -1, 0 ); + hlpMenu->insertItem( SmallIconSet("barcode"), i18n("&Barcode Help..."), this, SLOT( startInfo() ), 0, -1, 0 ); + hlpMenu->insertItem( i18n("&Donate..."), this, SLOT( donations() ), 0, -1, 0 ); + + menuBar()->insertItem( i18n("&File"), file ); + menuBar()->insertItem( i18n("&Settings"), settings ); + menuBar()->insertItem( i18n("&Help"), hlpMenu ); + + closeAct->plug( file ); + quitAct->plug( file ); + + configureAct->plug( settings ); + wizardAct->plug( settings ); + connectAct->plug( settings ); + (new KActionSeparator( this ))->plug( settings ); + newTablesAct->plug( settings ); + importLabelDefAct->plug( settings ); + importExampleAct->plug( settings ); + + SqlTables* tables = SqlTables::getInstance(); + if( tables->getData().autoconnect && autoconnect && !first ) { + tables->connectMySQL(); + autoconnect = false; + } + + connectAct->setEnabled( !SqlTables::isConnected() ); + importLabelDefAct->setEnabled( !connectAct->isEnabled() ); + importExampleAct->setEnabled( !connectAct->isEnabled() ); +} + +void DSMainWindow::loadConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("Wizard"); + first = config->readBoolEntry("firststart2", true ); + + SqlTables* tables = SqlTables::getInstance(); + if( tables->getData().autoconnect && !first && autoconnect && connectAct ) { + connectAct->setEnabled( !tables->connectMySQL() ); + importLabelDefAct->setEnabled( !connectAct->isEnabled() ); + importExampleAct->setEnabled( !connectAct->isEnabled() ); + + autoconnect = false; + } + + KBarcodeSettings::getInstance()->loadConfig(); +} + +void DSMainWindow::saveConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("Wizard"); + config->writeEntry("firststart2", false ); + + PrinterSettings::getInstance()->saveConfig(); + SqlTables::getInstance()->saveConfig(); + KBarcodeSettings::getInstance()->saveConfig(); + + config->sync(); +} + +void DSMainWindow::wizard() +{ + ConfWizard* wiz = new ConfWizard( 0, "wiz", true ); + if( wiz->exec() == QDialog::Accepted && wiz->checkDatabase->isChecked() ) + SqlTables::getInstance()->connectMySQL(); + + delete wiz; +} + +void DSMainWindow::connectMySQL() +{ + connectAct->setEnabled( !SqlTables::getInstance()->connectMySQL() ); + importLabelDefAct->setEnabled( !connectAct->isEnabled() ); + importExampleAct->setEnabled( !connectAct->isEnabled() ); + + if( !connectAct->isEnabled() ) + emit connectedSQL(); +} + +void DSMainWindow::appHelpActivated() +{ + KMessageBox::information( this, i18n( + "The KBarcode documentation is avaible as PDF for download on our webpage.

") + + "" + + i18n("Download Now") + "
", + QString::null, QString::null, KMessageBox::AllowLink ); +} + +void DSMainWindow::showCheck() +{ + QTextBrowser* b = new QTextBrowser( 0, "b" ); + b->setText( DSMainWindow::systemCheck() ); + b->resize( 320, 240 ); + b->show(); +} + +void DSMainWindow::startInfo() +{ + QString info = locate("appdata", "barcodes.html"); + if( !info.isEmpty() ) + kapp->invokeBrowser( info ); +} + +bool DSMainWindow::newTables() +{ + return SqlTables::getInstance()->newTables(); +} + +void DSMainWindow::donations() +{ + // orig =https://www.paypal.com/xclick/business=domseichter%40web.de&item_name=Support+KBarcode+Development&item_number=0&image_url=http%3A//www.kbarcode.net/themes/DeepBlue/images/logo.gif&no_shipping=1&return=http%3A//www.kbarcode.net&cancel_return=http%3A//www.kbarcode.net&cn=Suggestions%2C+Comments%3F&tax=0¤cy_code=EUR + QString url = "https://www.paypal.com/xclick/business=domseichter@web.de&item_name=Support+KBarcode+Development&item_number=0&image_url=www.kbarcode.net/themes/DeepBlue/images/logo.gif&no_shipping=1&return=www.kbarcode.net&cancel_return=www.kbarcode.net&cn=Suggestions,+Comments,&tax=0¤cy_code=EUR"; + + KMessageBox::information( this, i18n( + "It is possible to support the further development of KBarcode through donations. " + "PayPal will be used for processing the donation.

" ) + + "" + + i18n("Donate Now") + "
", QString::null, QString::null, KMessageBox::AllowLink ); +} + +QString DSMainWindow::systemCheck() +{ + bool gnubarcode = !Barkode::haveGNUBarcode(); + bool pdf = !Barkode::havePDFBarcode(); + bool tbarcode = !Barkode::haveTBarcode(); + bool tbarcode2 = !Barkode::haveTBarcode2(); + bool pure = !Barkode::havePurePostscriptBarcode(); + + QString text; + + text.append( i18n("

Barcode Support

") ); + text.append( "

GNU Barcode: "); + text.append( gnubarcode ? i18n("No
") : i18n("Found
") ); + text.append( "PDF417 Encode: "); + text.append( pdf ? i18n("No
") : i18n("Found
") ); + text.append( "TBarcode: "); + text.append( tbarcode ? i18n("No
") : i18n("Found
") ); + text.append( "TBarcode2: "); + text.append( tbarcode2 ? i18n("No
") : i18n("Found
") ); + text.append( "Pure Postscript Barcode Writer: "); + text.append( pure ? i18n("No
") : i18n("Found
") ); + + if( gnubarcode && tbarcode && pdf ) + text.append( i18n("

To get barcode support you have to either install GNU Barcode, TBarcode or PDF417 Enc.

") ); + + text.append( i18n("

Database Support

") ); + + QStringList list = QSqlDatabase::drivers(); + + if( list.count() ) { + text.append( "
    " ); + QStringList::Iterator it = list.begin(); + while( it != list.end() ) { + text.append( i18n("
  • Driver found: ") + *it + "
  • " ); + ++it; + } + text.append( "
" ); + } else + text.append( i18n("

No database drivers found. SQL database support is disabled.

") ); + + return text; +} + +void DSMainWindow::slotFunctionMap() +{ + new KActionMapDlg( actionCollection(), this ); +} + +#include "dsmainwindow.moc" diff --git a/kbarcode/dsmainwindow.h b/kbarcode/dsmainwindow.h new file mode 100644 index 0000000..c43959b --- /dev/null +++ b/kbarcode/dsmainwindow.h @@ -0,0 +1,90 @@ +/*************************************************************************** + dsmainwindow.h - description + ------------------- + begin : Fre Jan 17 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef DSMAINWINDOW_H +#define DSMAINWINDOW_H + +#include +#include + +class KAction; +class KPopupMenu; +/** The base class of all main windows of KBarcode. It provides standard menu items + * for database connections, preferences, help, the first start wizard and donations. + * It checks also if this is the first start of KBarcode and if the configuration wizard + * should be started. + * + * @author Dominik Seichter + */ +class DSMainWindow : public KMainWindow { + Q_OBJECT + public: + DSMainWindow(QWidget *parent=0, const char *name=0, WFlags f = WType_TopLevel | WDestructiveClose ); + ~DSMainWindow(); + + /** Is this the first start of KBarcode ? + * If true, the configuration wizard will + * be started automatically. + */ + bool isFirstStart() const { + return first; + } + + + /** Do a system check and return a text + * informing the user about missing, programs + * and drivers for barcode support and database + * access. + */ + static QString systemCheck(); + + public slots: + void wizard(); + + signals: + void connectedSQL(); + + private slots: + void connectMySQL(); + void appHelpActivated(); + void startInfo(); + bool newTables(); + void donations(); + void showCheck(); + void slotFunctionMap(); + + protected slots: + void loadConfig(); + void saveConfig(); + + protected: + void setupActions(); + + static bool autoconnect; + static bool startwizard; + + bool first; + + KAction* connectAct; + KAction* importLabelDefAct; + KAction* importExampleAct; + + KPopupMenu* file; + KPopupMenu* settings; + KPopupMenu* hlpMenu; +}; +#endif diff --git a/kbarcode/dsrichtext.cpp b/kbarcode/dsrichtext.cpp new file mode 100644 index 0000000..01f7182 --- /dev/null +++ b/kbarcode/dsrichtext.cpp @@ -0,0 +1,427 @@ +/*************************************************************************** + dsrichtext.cpp - description + ------------------- + begin : Fre Okt 17 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "dsrichtext.h" + +#ifdef QT_TEXT_BUG + +// Qt includes +#include +#include +#include + +// for DSREPLACE +#include "sqltables.h" + +/* +EXAMPLE TEXT: + "" + "

A little bit formated " + "richtext which should be printed to a QPrinter with QSimpleRichText.

" + "

Printing should work in ScreenResolution as well as in HighResolution, but as you can see it will only work in ScreenResolution.

" + ""; + +Another example + +

Text test label

+

Resolution formated 108dpi. This text & text should now overlap with the first line. 4 < 6a

+

A longer paragraph with some text, so that I can test wether wordwrap is working. Another "line" to test line spacing without a bigger font (like the one found in the next sentence) messing up the spacing. Some text "in" a bigger courier font. Also this paragraph should be justified as blockquote. I hope it works and KBarcodes text redering will be better than the one found in Qt.

+ + +*/ + +DSRichText::DSRichText( const QString & t ) + : text( t ) +{ + if( text.find("") == -1 ) + text = "

" + + t + "

"; + + //qDebug( text ); + + start = end = pos = 0; + x = y = 0; + sx = sy = 1.0; + m_base = QFont(); + + QString tmp = parse( text, "", 0 ); + if( !tmp.isNull() ) { + pos += tmp.length(); + tmp = tmp.left( tmp.length() - 1 ); + tmp = tmp.mid( 5, tmp.length() - 5 ); + m_base = parseStyle( parse( tmp, "style=\"", "\"", pos ), &m_color ); + } + + pos = text.find( "text = QString::null; + f->line = false; + f->alignment = alignment; + f->font = m_base; + f->color = m_color; +} + +void DSRichText::initLine( QValueList* l ) +{ + formated_line li; + li.width = 0; + li.ascent = 0; + li.leading = 0; + li.lineSpacing = 0; + li.line = false; + l->append( li ); +} + +void DSRichText::updateSpacing( QValueList* l, QFontMetrics* fm ) +{ + l->last().lineSpacing = (l->last().lineSpacing < fm->lineSpacing()) ? fm->lineSpacing() : l->last().lineSpacing; + l->last().ascent = (l->last().ascent < fm->ascent()) ? fm->ascent() : l->last().ascent; + l->last().leading = (l->last().leading < fm->leading()) ? fm->leading() : l->last().leading; +} + +void DSRichText::fillLines() +{ + for( unsigned int z = 0; z < word_p.count(); z++ ) { + WordList words = word_p[z]; + LineList lines; + initLine( &lines ); + for( unsigned int i = 0; i < words.count(); i++ ) { + formated_word word = words[i]; + lines.last().line = lines.last().line | word.line; + + QFontMetrics fm( word.font ); + updateSpacing( &lines, &fm ); + + int tw = fm.width( word.text ); + // word does not fit in the current line, create a new one + if( lines.last().width + tw >= w ) + initLine( &lines ); + + // TODO: check here for words longer than one line + lines.last().formats.append( word ); + lines.last().width += tw; + } + line_p.append( lines ); + } +} + +void DSRichText::draw( QPainter* p ) +{ + /* don't try to draw if there is no space to draw */ + if( !w || !h ) + return; + + fillLines(); + + painter = p; + painter->save(); + painter->setClipRect( xpos, ypos, int(w*sx), int(h*sy), QPainter::CoordPainter ); + + for( unsigned int z = 0; z < line_p.count(); z++ ) { + LineList lines = line_p[z]; + if( lines.count() && z ) + y += int( lines[0].lineSpacing * 0.5); + + for( unsigned int i = 0; i < lines.count(); i++ ) { + formated_line l = lines[i]; + + if( l.formats.count() && l.formats[0].alignment == Qt::AlignJustify && i != lines.count() - 1 ) { + // last line in a paragraph is not justified (in blocksatz mode)! + drawJustified( &l ); + } else { + for( unsigned int z = 0; z < l.formats.count(); z++ ) { + formated_word f = l.formats[z]; + + painter->setFont( f.font ); + painter->setPen( QPen( f.color ) ); + + int a = f.alignment; + if( a == Qt::AlignRight ) { + a = Qt::AlignLeft; + if( !x ) + x = w - l.width; + } else if( a == Qt::AlignHCenter ) { + a = Qt::AlignLeft; + if( !x ) + x = ( w - l.width ) / 2; + } + + int ya = yDeviation( &l ); + painter->drawText( xpos + int(x*sx), ypos + int((y+ya)*sy), int(l.width*sx), int(l.lineSpacing * sy), a, f.text ); + x += painter->fontMetrics().width( f.text ); + } + } + + x = 0; + y += l.lineSpacing; + } + } + + painter->restore(); +} + +void DSRichText::drawJustified( formated_line* line ) +{ + int all = 0; + for( unsigned int z = 0; z < line->formats.count(); z++ ) { + line->formats[z].text = line->formats[z].text.stripWhiteSpace(); + QFontMetrics fm( line->formats[z].font ); + all += fm.width( line->formats[z].text ); + } + + int x = 0; + int space = (w - all) / (line->formats.count() - 1); + for( unsigned int z = 0; z < line->formats.count(); z++ ) { + painter->setFont( line->formats[z].font ); + painter->setPen( QPen( line->formats[z].color ) ); + + int ya = yDeviation( line ); + int tw = painter->fontMetrics().width(line->formats[z].text); + painter->drawText( int(x*sx), int((y+ya)*sy), int(tw*sx), int(line->lineSpacing * sy), Qt::AlignAuto, line->formats[z].text ); + x += tw; + x += space; + } + +} + +bool DSRichText::parseParagraph() +{ + int alignment = 0; + formated_word f; + QString d = parse( text, "", pos ); + //qDebug("D=" + d ); + //qDebug("POS=%i", pos ); + + pos += d.length(); + if( d.isNull() ) + return false; + + d = parseParagraphTag( d, &alignment ); + + WordList words; + QString data; + initFormat( &f, alignment ); + + if( d.isEmpty() ) { + // found empty paragraph + words.append( f ); + word_p.append( words ); + return true; + } + + for( unsigned int i = 0; i < d.length(); ) { + if( d[i] == '<' || i == (d.length() - 1) ) { + if( i == (d.length() - 1) ) + data.append( d[i] ); + + parseWords( data, &f, &words ); + initFormat( &f, alignment ); + data = QString::null; + + // bail out now, otherwise there is + // and endless loop for e.g.

a

+ if( i == (d.length() - 1) ) + break; + + if( d[i] == '<' ) { + QString span = d.mid( i, d.find( ">", i ) - i + 1 ); + i += span.length(); + + if( span.startsWith( "setNamedColor( s.right( s.length() - 6 ) ); + } else if( s.startsWith("text-decoration:") ) { + if( s.endsWith( "underline" ) ) + f.setUnderline( true ); +/*#if QT_VERSION >= 0x030200 + else if( s.endsWith( "overline" ) ) + f.setOverline( true ); +#endif */ + else if( s.endsWith( "line-through" ) ) + f.setStrikeOut( true ); + } else if( s.startsWith( "font-style:") ) { + if( s.endsWith( "italic" ) || s.endsWith( "oblique" ) ) + f.setItalic( true ); + } else if( s.startsWith( "font-weight:" ) ) { + bool ok = false; + int n = s.right( s.length() - 12 ).toInt( &ok ); + if( s.endsWith( "bold" ) ) + f.setBold( true ); + else if( ok ) + f.setWeight( n / 8 ); // convert CSS values to Qt values + } + } + + return f; +} + +QString DSRichText::parse( const QString & t, const QString & find, const QString & find2, int start ) +{ + int s = t.find( find, start ); + if( s == -1 || s < start ) + return QString::null; + + int pend = t.find( find2, s + find.length() ); + if( pend == -1 || pend < (signed int)(s + find.length()) ) + return QString::null; + + QString text = t.mid( s, pend - s + find2.length() ); + return text; +} + +void DSRichText::setX( int x ) +{ + xpos = x; +} + +void DSRichText::setY( int y ) +{ + ypos = y; +} + +void DSRichText::setWidth( int width ) +{ + w = width; +} + +void DSRichText::setHeight( int height ) +{ + h = height; +} + +int DSRichText::parseAlignment( const QString & align ) +{ + QString a = QString( align ); + if( a.endsWith("\"") ) + a = a.left( a.length() - 1 ); + + if( a.startsWith("align=\"") ) + a = a.mid( 7, a.length() - 7 ); + + if( a == "left" ) + return Qt::AlignLeft; + else if( a == "center" ) + return Qt::AlignHCenter; + else if( a == "right" ) + return Qt::AlignRight; + else if( a == "justify" ) + return Qt::AlignJustify; + + return 0; +} + +void DSRichText::parseWords( const QString & t, formated_word* w, WordList* words ) +{ + unsigned int p = 0; + for( unsigned int i = 0; i < t.length(); i++ ) { + if( (t[i].isSpace() && p != i) || i == t.length() - 1 ) { + formated_word word = *w; + + word.text = replaceEscapeSequences( t.mid( p, i + 1 - p ) ); + + p = i + 1; + words->append( word ); + } + } +} + +inline int DSRichText::yDeviation( const formated_line* line ) +{ + // leading = 1 (almost ever) + // linespacing = leading + height + // height = ascent + descent + 1 + if( line->lineSpacing != painter->fontMetrics().lineSpacing() ) { + return line->ascent + line->leading - painter->fontMetrics().ascent() - painter->fontMetrics().leading(); + } else { + return 0; + } +} + +QString DSRichText::replaceEscapeSequences( const QString & t ) +{ + QString tmp = QString( t ); + tmp = tmp.replace( DSREPLACE( "<" ), "<" ); + tmp = tmp.replace( DSREPLACE( ">" ), ">" ); + tmp = tmp.replace( DSREPLACE( "&" ), "&" ); + tmp = tmp.replace( DSREPLACE( """ ), "\"" ); + return tmp; +} + +QString DSRichText::parseParagraphTag( const QString &t, int* alignment ) +{ + QString d = QString( t ); + if( d.startsWith("

") ) { + d = d.mid( 3, d.length() - 3 ); + } else if( d.startsWith("

" ) ) { + int x = d.find(">" ) + 1; + d = d.mid( x, d.length() - x ); + } + } + + if( d.endsWith("

") ) + d = d.left( d.length() - 4 ); // strlen("

"); + + return d; +} + +#endif // QT_TEXT_BUG + + diff --git a/kbarcode/dsrichtext.h b/kbarcode/dsrichtext.h new file mode 100644 index 0000000..5da22b1 --- /dev/null +++ b/kbarcode/dsrichtext.h @@ -0,0 +1,193 @@ +/*************************************************************************** + dsrichtext.h - description + ------------------- + begin : Fre Okt 17 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef DSRICHTEXT_H +#define DSRICHTEXT_H + +#define QT_TEXT_BUG +/*#undef QT_TEXT_BUG*/ +#ifdef QT_TEXT_BUG + +#include +#include +#include +#include + +class DSRichText; + +/** This class represents one word, + * formated with a font, a color and an + * alignment. + */ +struct formated_word { + QString text; + QFont font; + QColor color; + int alignment; + bool line; +}; + +typedef QValueList WordList; + +/** This structure represents a single line. + * Every line contains a list of formated_words. + * Wordwrapping has been applied before the line + * was created. + * lineSpacing, ascent and leading come from the + * biggest font in the line. + */ +struct formated_line { + int width; + int lineSpacing; + int ascent; + int leading; + bool line; + + WordList formats; +}; +typedef QValueList LineList; + +class QColor; +class QPainter; + +/** A richtext rendering class, which draws a piece + * of HTML formated richtext on any QPainter. + * This class works with all printer resolutions compared + * to the buggy QSimpleRichText + * + * rendering the richtext happens in 3 steps: + *
    + *
  • the HTML data is parsed into text_format structures. Each + * of these text_format structures may represend multiple lines, but + * also single words. This depends on how long a formated text is. + * this step happens in the constructor and in parseParagraph()
  • + *
  • the text_format structures are parsed into line structures. + * In this step the wordwrapping is calculated. Each line structure + * has again text_format structures. This is necessary because a line + * of text may of course contain different formattings. A line struct is always + * a single line of drawn text, not more and not less. + * happens in draw() and fillLines()
  • + *
  • the line structure is drawn line by line using QPainter. + * happens in draw()
  • + *
+ * + * Printing to the screen is easy and the usage does not differ from + * QSimpleRichText. Drawing on QPrinter is a little bit more complicated. + * The most important thing is that you may not use QPainter::scale(). + * A small example on how to print on a QPrinter: + *
+  *  QPrinter printer( QPrinter::HighResolution );
+  *  QPainter painter( &printer );
+  *  QPaintDeviceMetrics metrics( &printer );
+  *  double scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX();
+  *  double scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY();
+  *
+  *  DSRichText dsr( "<html><p>Hallo World</p></html>" );
+  *  dsr.setWidth( 200 ); // in screenresolution coordinates
+  *  dsr.setHeight( 80 );  // in screenresolution coordinates
+  *  painter.translate( 10 * scalex, 10 * scaley ); // draw at 10, 10 instead of 0, 0
+  *  dsr.scale( scalex, scaley );
+  *  dsr.draw( &painter );
+  * 
+ * + *@author Dominik Seichter + */ +class DSRichText { + public: + /** construct a DSRichText object. @p t is formated text as produces by QTextEdit. + */ + DSRichText( const QString & t ); + ~DSRichText(); + + void setX( int x ); + void setY( int y ); + + /** draw the formated text on the QPainter* @p p + */ + void draw( QPainter* p ); + /** set the width of the clipping rectangle + */ + void setWidth( int width ); + /** set the height of the clipping rectangle + */ + void setHeight( int height ); + /** scale everything. This is necessary to print on devices + * with another resolution than the screen. QPainter::scale() won't work. + */ + void setScale( double x, double y ) { + sx = x; sy = y; + }; + + private: + /** parse a single pare of

elements + */ + bool parseParagraph(); + /** remove

and

from the QString @p t and return it. + * This function is also responsible for getting the + * correct alignment of the paragraph. + */ + QString parseParagraphTag( const QString & t, int* alignment ); + /** parse the align attribute of a

tag and return the corresponding Qt alignment value. + */ + int parseAlignment( const QString & align ); + /** parse the css style attribute of a tag and return a matching QFont for these + * style. The font color is saved in the QColor* @p color. + */ + QFont parseStyle( const QString & s, QColor* color ); + QString parse( const QString & t, const QString & find, const QString & end, int start ); + void parseWords( const QString & t, formated_word* w, WordList* words ); + void initFormat( formated_word* f, int alignment ); + void initLine( QValueList* l ); + void updateSpacing( QValueList* l, QFontMetrics* fm ); + /** draw the line @p line justified as blockquote + */ + void drawJustified( formated_line* line ); + /** calculate the y-deviation needed, because of different font sizes in this line + */ + inline int yDeviation( const formated_line* line ); + /** replace HTML escape sequences such as < to their real character meaning (i.e. < ) + */ + QString replaceEscapeSequences( const QString & t ); + + /** fill the line structures with data + */ + void fillLines(); + + int pos; // current position in text + int start; // start of a tag + int end; // end of a tag + int x; // x position + int y; // y position + int w; // width of the text element + int h; // height of the text element + int xpos; // x position at the beginning + int ypos; // y position at the beginning + + double sx; + double sy; + + QString text; + QFont m_base; + QColor m_color; + QPainter* painter; + + QValueList line_p; + QValueList word_p; +}; + +#endif // QT_TEXT_BUG +#endif diff --git a/kbarcode/dstextedit.cpp b/kbarcode/dstextedit.cpp new file mode 100644 index 0000000..e059e96 --- /dev/null +++ b/kbarcode/dstextedit.cpp @@ -0,0 +1,147 @@ +/*************************************************************************** + dstextedit.cpp - description + ------------------- + begin : Sam Jun 04 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "dstextedit.h" +#include "dstextedit.moc" +#include + +DSTextEdit::DSTextEdit( QWidget* parent, const char* name ) + : TextEditBase( parent, name ) +{ + connect( this, SIGNAL( textChanged() ), this, SLOT( fixParagraphs() ) ); +} + +void DSTextEdit::fixParagraphs() +{ + struct { + QFont font; + QColor color; + int alignment; + } tFormattings; + + QString t; + int pos = 0; + int count = 0; + int i; + int para, index; // needed to save the cursor position + int paraFrom, indexFrom, paraTo, indexTo; // needed to save the selection + QValueList chars; + QRegExp reg("]*>"); + + for( i = 0; i < paragraphs(); i++ ) + chars.append( paragraphLength( i ) ); + + // disconnect us first as we change the text here + disconnect( this, SIGNAL( textChanged() ), this, SLOT( fixParagraphs() ) ); + + getCursorPosition( ¶, &index ); + getSelection( ¶From, &indexFrom, ¶To, &indexTo ); + + if( !para && !index ) + setCursorPosition( 0, index+1 ); + + t = this->text(); + tFormattings.font = this->currentFont(); + tFormattings.color = this->color(); + tFormattings.alignment = this->alignment(); + + while( pos != -1 ) + { + pos = reg.search( t, pos ); + if( pos != -1 ) + { + if( count && count == para ) + { + for( i = 0; i < count; i++ ) + index += chars[i]; + ++index; // count the new
that is inserted later + } + + ++count; + + if( count > 1 ) //&& pos != -1 ) + t = t.remove( pos, reg.matchedLength() ); + else + pos += reg.matchedLength(); + } + } + + pos = t.length(); + count = 0; + + while( pos != -1 ) + { + pos = t.findRev( "

", pos ); + if( pos != -1 ) + { + ++count; + + if( count > 1 ) //&& pos != -1 ) + t = t.replace( pos, 4, "
" ); + else + pos -= 4; + } + } + + this->setText( t ); + this->setCursorPosition( 0, index ); + this->setCurrentFont( tFormattings.font ); + this->setColor( tFormattings.color ); + this->setAlignment( tFormattings.alignment ); + this->setSelection( paraFrom, indexFrom, paraTo, indexTo ); + + + connect( this, SIGNAL( textChanged() ), this, SLOT( fixParagraphs() ) ); +} + +/* +void DSTextEdit::moveCursor( CursorAction action, bool select ) +{ + do { + TextEditBase::moveCursor( action, select ); + } while( cursorIsInToken() ); +} + +bool DSTextEdit::cursorIsInToken() +{ + int para, index; + int firstopen, firstclose; + QString data; + + getCursorPosition( ¶, &index ); + + data = text( para ); + + qDebug("data=" + data ); + --index; + firstopen = data.findRev( "[", index ); + firstclose = data.findRev( "]", index ); + ++index; + + if( firstopen != -1 && firstopen > firstclose ) + { + firstopen = data.find( "[", index ); + firstclose = data.find( "]", index ); + if( ( firstclose != -1 && firstopen != -1 && firstclose < firstopen ) || + ( firstclose != -1 && firstopen == -1 ) ) + return true; + } + + return false; +} + +*/ diff --git a/kbarcode/dstextedit.h b/kbarcode/dstextedit.h new file mode 100644 index 0000000..15192a3 --- /dev/null +++ b/kbarcode/dstextedit.h @@ -0,0 +1,55 @@ +/*************************************************************************** + dstextedit.h - description + ------------------- + begin : Sam Jun 04 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _DS_TEXT_EDIT_H_ +#define _DS_TEXT_EDIT_H_ + +#include + +#if QT_VERSION >= 0x030100 + #include +#else + #include +#endif + +// Otherwise moc will complain +#if QT_VERSION >= 0x030100 + #define TextEditBase KTextEdit +#else + #define TextEditBase QTextEdit +#endif + +class DSTextEdit : public TextEditBase { + Q_OBJECT + + public: + DSTextEdit( QWidget* parent, const char* name = 0 ); + + //virtual void moveCursor( CursorAction action, bool select ); + private slots: + void fixParagraphs(); + + private: + /** + * returns true if the cursor is currently inside + * of a token of the form [value]. + */ + //bool cursorIsInToken(); +}; + +#endif // _DS_TEXT_EDIT_H_ + diff --git a/kbarcode/editoriface.h b/kbarcode/editoriface.h new file mode 100644 index 0000000..a568879 --- /dev/null +++ b/kbarcode/editoriface.h @@ -0,0 +1,55 @@ +/*************************************************************************** + editoriface.h - description + ------------------- + begin : Sat Dec 27 09:53:28 CET 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef EDITORIFACE_H +#define EDITORIFACE_H + +#include + +class EditorIface : virtual public DCOPObject +{ + K_DCOP + + public: + k_dcop: + + virtual const QString fileName() const = 0; + virtual bool isChanged() = 0; + virtual void print() = 0; + virtual bool newLabel() = 0; + + virtual void insertBarcode() = 0; + virtual void insertPicture() = 0; + virtual void insertText() = 0; + virtual void insertRect() = 0; + virtual void insertCircle() = 0; + virtual void insertLine() = 0; + + virtual void changeDes() = 0; + virtual void changeSize() = 0; + + virtual void preview() = 0; + virtual void toggleGrid() = 0; + + virtual void closeLabel() = 0; + + virtual bool openUrl( const QString & url ) = 0; + virtual bool save( QString url ) = 0; + +}; + +#endif /* EDITORIFACE_H */ diff --git a/kbarcode/encodingcombo.cpp b/kbarcode/encodingcombo.cpp new file mode 100644 index 0000000..52f7a21 --- /dev/null +++ b/kbarcode/encodingcombo.cpp @@ -0,0 +1,47 @@ +/*************************************************************************** + encodingcombo.h - description + ------------------- + begin : Fri Dec 23 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "encodingcombo.h" + +#include +#include +#include +#include + +EncodingCombo::EncodingCombo( QWidget* parent ) + : KComboBox( parent ) +{ + QString sEncoding = QString( KGlobal::locale()->encoding() ); + QStringList encodings (KGlobal::charsets()->availableEncodingNames()); + + this->insertStringList( encodings ); + + for (int i=0; i < encodings.count(); i++) + { + bool found = false; + QTextCodec *codecForEnc = KGlobal::charsets()->codecForName(encodings[i], found); + if (found && ( (codecForEnc->name() == sEncoding) || (encodings[i] == sEncoding) ) ) + { + this->setCurrentItem(i); + break; + } + } +} + +EncodingCombo::~EncodingCombo() +{ +} diff --git a/kbarcode/encodingcombo.h b/kbarcode/encodingcombo.h new file mode 100644 index 0000000..f6e0762 --- /dev/null +++ b/kbarcode/encodingcombo.h @@ -0,0 +1,35 @@ +/*************************************************************************** + encodingcombo.h - description + ------------------- + begin : Fri Dec 23 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _ENCODING_COMBO_H_ +#define _ENCODING_COMBO_H_ + +#include + +class EncodingCombo : public KComboBox { + Q_OBJECT + public: + EncodingCombo( QWidget* parent ); + ~EncodingCombo(); + + + + +}; + +#endif // _ENCODING_COMBO_H_ + diff --git a/kbarcode/exampledata.sql b/kbarcode/exampledata.sql new file mode 100644 index 0000000..2afcfe8 --- /dev/null +++ b/kbarcode/exampledata.sql @@ -0,0 +1,10 @@ +INSERT INTO barcode_basic VALUES (1,'art1001','Test1','1000001','ean','field0','field1','field2','field3','field4','field5','field6','field7','field8','field9') +INSERT INTO barcode_basic VALUES (2,'art1002','Test1','1000002','ean','field0','field1','field2','field3','field4','field5','field6','field7','field8','field9') +INSERT INTO barcode_basic VALUES (3,'art1003','Test1','1000003','ean','field0','field1','field2','field3','field4','field5','field6','field7','field8','field9') +INSERT INTO barcode_basic VALUES (4,'art1004','Test1','1000004','ean','field0','field1','field2','field3','field4','field5','field6','field7','field8','field9') +INSERT INTO barcode_basic VALUES (5,'art1005','Test1','1000005','ean','field0','field1','field2','field3','field4','field5','field6','field7','field8','field9') +INSERT INTO barcode_basic VALUES (6,'art1006','Test1','1000006','ean','field0','field1','field2','field3','field4','field5','field6','field7','field8','field9') +INSERT INTO customer VALUES (1,'EURO222','Europe') +INSERT INTO customer VALUES (2,'613203','USA') +INSERT INTO customer_text VALUES (1,'EURO222','code39','art1001','custom1001','2323232','EURO222-Line0','EURO222-Line1','EURO222-Line2','EURO222-Line3','EURO222-Line4','EURO222-Line5','EURO222-Line6','EURO222-Line7','EURO222-Line8','EURO222-Line9') +INSERT INTO customer_text VALUES (2,'613203','code39','art1003','custom1002','11111','test-Line0','test-Line1','test-Line2','test-Line3','test-Line4','test-Line5','test-Line6','test-Line7','test-Line8','test-Line9') diff --git a/kbarcode/gnubarcode.cpp b/kbarcode/gnubarcode.cpp new file mode 100644 index 0000000..6f69644 --- /dev/null +++ b/kbarcode/gnubarcode.cpp @@ -0,0 +1,348 @@ +/*************************************************************************** + gnubarcode.cpp - description + ------------------- + begin : + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "gnubarcode.h" + +#ifdef _ENABLE_NATIVE_GNU_BARCODE + +#include +#include "barkode.h" +#include +#include + +#include +#include +#include + +#include + +#define FONT_SPACE (2*m_scaley) +#define SHRINK_AMOUNT 0.15 +#define MUL_FACTOR 10 + +GnuBarcode::GnuBarcode() + : BarkodeEngine() +{ + m_item = NULL; + m_size = QSize( 0, 0 ); + + m_scalex = 1.0; + m_scaley = 1.0; + + m_font_size = 10; +} + +GnuBarcode::~GnuBarcode() +{ + if( m_item ) + Barcode_Delete( m_item ); +} + +void GnuBarcode::update( const QPaintDevice* device ) +{ + QString val = barkode->parsedValue(); + m_valid = false; + + if( m_item ) + { + qDebug("Deleting"); + Barcode_Delete( m_item ); + m_item = NULL; + } + + if( val.isEmpty() ) + return; + + char* value = new char[val.length()+1]; + strncpy( value, val.latin1(), val.length()+1 ); + value[val.length()] = '\0'; + + m_item = Barcode_Create( value ); + if( !m_item ) + { + Barcode_Delete( m_item ); + m_item = NULL; + delete [] value; + return; + } + + if( Barcode_Encode( m_item, Barkode::internalType( barkode->type() ) ) == -1 ) + { + Barcode_Delete( m_item ); + m_item = NULL; + + delete [] value; + return; + } + + delete [] value; + + QPaintDeviceMetrics metrics( device ); + m_scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX(); + m_scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY(); + + // 72.0 is the postscript resolution generated by GNU barcode + m_scale_ps_x = (double)metrics.logicalDpiX() / 72.0; + m_scale_ps_y = (double)metrics.logicalDpiY() / 72.0; + +/* m_scalex *= m_scale_ps_x; + m_scaley *= m_scale_ps_y;*/ + + m_font_size = (int)(barkode->fontsize() * barkode->scaling() * m_scaley); + setupSize(); + m_valid = true; +} + +const QSize GnuBarcode::size() const +{ + if( m_size.isNull() ) + return QSize( 100, 80 ); + else + return m_size; +} + +void GnuBarcode::drawBarcode( QPainter & painter, int x, int y ) +{ + int dx = x + barkode->quietZone(); + int dy = y + barkode->quietZone(); + + if( !m_item ) + { + barkode->drawInvalid( painter, x, y ); + return; + } + + painter.save(); + painter.scale( m_scalex, m_scaley ); + + // based on David J. Humphreys barcode-svg + // Draw the bars + drawBars( &painter, (int)(dx/m_scalex), (int)(dy/m_scaley) ); + + // Only scale for the bars, text should be scaled + // correctly by Qt on Qt >= 3.3.2 + painter.restore(); + + // draw the text + if( barkode->textVisible() ) + drawText( &painter, dx, dy ); +} + +void GnuBarcode::setupSize() +{ + m_bar_height = (int)(barkode->barHeight() * barkode->scaling() * barkode->cut()); + m_barcode_height = m_bar_height; + if( barkode->textVisible() ) + m_barcode_height += (int)(m_font_size/2 + FONT_SPACE*2); + + unsigned int width = drawBars( 0 , 0, 0 ); + unsigned int twidth = drawText( 0, 0, 0 ); + + //if(m_item->height == 0) + m_item->height = m_barcode_height + (2 * barkode->quietZone()); + + width = ( width > twidth ? width : twidth ); + width += 2* barkode->quietZone(); + + //if(m_item->width == 0) + m_item->width = width; + + m_size.setWidth( (int)(m_item->width * m_scalex) ); + m_size.setHeight( (int)(m_item->height * m_scaley) ); +} + +int GnuBarcode::drawBars( QPainter* painter, int x, int y ) +{ +#if 0 + int height = 0; // height of the bar to draw + int xpos = 0; // Where the current box is drawn + int current = 0; + unsigned int i = 0; + + qDebug("Partial=%s\n", m_item->partial ); + for( i = 0; i < strlen(m_item->partial); i++) + { + current = (int)m_item->partial[i] - ASCII_ZERO; + /* Guide bar */ + if(current > 9) + { + height = m_barcode_height; + current = (int)m_item->partial[++i] - ASCII_ZERO; + i++; /* Skip the following 'a' */ + } + else + height = m_bar_height; + + current *= barkode->scaling(); + + if( current < 0 ) + { + qDebug("current < 0: %i", current ); + current = 0; + break; + } + + if( i % 2) + { + painter.fillRect( x + xpos, y, current, height, barkode->foreground() ); + } + + xpos += current; + } +#endif + int xpos; + int mode = '-'; // text below bars + char *ptr; + int i, j; + int x0, yr, y0; + + xpos = m_item->partial[0]-'0'; + + for (ptr = m_item->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; + + j = (int)( j * barkode->scaling() ); + if (i%2) + { + x0 = xpos + j/2; + y0 = y; + yr = m_barcode_height; + + if( barkode->textVisible() ) + { + // leave space for text + if (mode == '-') + { + // text below bars + if( isdigit( *ptr ) ) + yr = m_bar_height; + else + yr = m_barcode_height; + } else { /* '+' */ + // text above bars + // TODO: this needs testing and a GUI + if( isdigit( *ptr ) ) + yr = m_bar_height; + else + { + yr = m_barcode_height; + y0 += (m_barcode_height - m_bar_height); + } + } + } + + if( painter ) + { + painter->fillRect( x + x0, y0, j, yr, barkode->foreground() ); + } + //qDebug("Bar = %i", j ); + } + xpos += j; + } + + return xpos; +} + +int GnuBarcode::drawText( QPainter* painter, int x, int y ) +{ +#if 0 + unsigned int infosz = strlen( m_item->textinfo ); + unsigned int correction = 0; // This correction seems to be needed to align text properly + unsigned int j = 0; + unsigned int i = 0; + int prev_x = 0; + int xpos = 0; + + double dub1, fsize; + char printer; + char *temp_info = new char[infosz+1]; + + painter.setFont( QFont( "Helvetica", 12 ) ); + while(i < infosz) + { + for(j = 0; m_item->textinfo[i + j + 1] != ' ' && + m_item->textinfo[i + j + 1] != '\0';j++); /* Empty loop, just increment j */ + j ++; + strncpy(temp_info, (m_item->textinfo + i),j); + sscanf(temp_info, "%lf:%lf:%c", &dub1, &fsize, &printer); + i += j; + + xpos = (int)dub1; + //if((xpos - prev_x) >= 10) + //correction += 2; + + prev_x = xpos; + painter.drawText( x + ((xpos-correction) * m_scalex), + y + ((m_bar_height + (unsigned int)(barkode->fontsize()/ 2) + FONT_SPACE) * m_scaley), + QChar( printer ) ); + } + delete [] temp_info; +#endif + + double f1, f2; + int y0; + char* ptr; + char c; + + int mode = '-'; + for (ptr = m_item->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; + } + + if( mode == '-' ) + { + // text below bars + y0 = y + (int)(m_bar_height * m_scaley + m_font_size - FONT_SPACE); + } + else + y0 = (int)(y + FONT_SPACE); + + if( painter ) + { + painter->setFont( QFont( "Helvetica", m_font_size ) ); + painter->drawText( x + (int)(f1 * m_scalex * barkode->scaling() ), y0, QChar( c ) ); + } + } + + return x; +} + +#endif // _ENABLE_NATIVE_GNU_BARCODE + diff --git a/kbarcode/gnubarcode.h b/kbarcode/gnubarcode.h new file mode 100644 index 0000000..afdec8e --- /dev/null +++ b/kbarcode/gnubarcode.h @@ -0,0 +1,75 @@ +/*************************************************************************** + gnubarcode.h - description + ------------------- + begin : + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef GNU_BARCODE_H +#define GNU_BARCODE_H + +// #define _ENABLE_NATIVE_GNU_BARCODE + +#ifdef _ENABLE_NATIVE_GNU_BARCODE + +#include "barkodeengine.h" + +struct Barcode_Item; + +class GnuBarcode : public BarkodeEngine { + public: + GnuBarcode(); + ~GnuBarcode(); + + inline EEngine engine() const; + + const QSize size() const; + void update( const QPaintDevice* device ); + void drawBarcode( QPainter & painter, int x, int y ); + + private: + /** Draws the barcodes bars if @p painter is not 0. + * Otherwise only the required width is returned. + */ + int drawBars( QPainter* painter, int x, int y ); + + /** Draws the text if @p painter is not 0. + * Otherwise only the required width is returned. + */ + int drawText( QPainter* painter, int x, int y ); + + /** Fill m_size with the needed space + */ + void setupSize(); + + private: + int m_bar_height; + int m_barcode_height; + int m_font_size; + + double m_scalex; + double m_scaley; + double m_scale_ps_x; + double m_scale_ps_y; + + Barcode_Item* m_item; + QSize m_size; +}; + +EEngine GnuBarcode::engine() const +{ + return GNU_BARCODE; +} + +#endif // _ENABLE_NATIVE_GNU_BARCODE +#endif /* GNU_BARCODE_H */ diff --git a/kbarcode/gnubarkodeengine.cpp b/kbarcode/gnubarkodeengine.cpp new file mode 100644 index 0000000..486c453 --- /dev/null +++ b/kbarcode/gnubarkodeengine.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** + gnubarkodeengine.cpp - description + ------------------- + begin : Fri Nov 05 2004 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include "gnubarkodeengine.h" +#include + +GnuBarkodeEngine::GnuBarkodeEngine() + : BarkodeEngine( "libbarcode.so" ) +{ +} + +void GnuBarkodeEngine::init() +{ + if( !m_loaded ) + { + (void*)Barcode_Create = dlsym(m_handle, "Barcode_Create"); + (void*)Barcode_Delete = dlsym(m_handle, "Barcode_Delete"); + (void*)Barcode_Encode = dlsym(m_handle, "Barcode_Encode"); + + m_loaded = true; + } +} + +GnuBarkodeEngine gnuBarkodeEngine; diff --git a/kbarcode/gnubarkodeengine.h b/kbarcode/gnubarkodeengine.h new file mode 100644 index 0000000..323553c --- /dev/null +++ b/kbarcode/gnubarkodeengine.h @@ -0,0 +1,46 @@ +/*************************************************************************** + gnubarkodeengine.h - description + ------------------- + begin : Fri Nov 05 2004 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef GNUBARKODEENGINE_H +#define GNUBARKODEENGINE_H + +#include + +struct Barcode_Item; + +/** + * Loads GNU Barcode lib dynamically when needed, + * so that KBarcode does not have to link against + * it and works even without lib gnu barcode. + * @author Dominik Seichter + */ +class GnuBarkodeEngine : public BarkodeEngine +{ + public: + GnuBarkodeEngine(); + + struct Barcode_Item* (*Barcode_Create)(char* text); + int (*Barcode_Delete)(struct Barcode_Item* bc); + int (*Barcode_Encode)(struct Barcode_Item *bc, int flags); + + + protected: + void init(); +}; + +extern GnuBarkodeEngine gnuBarkodeEngine; +#endif diff --git a/kbarcode/hi16-action-barcode.png b/kbarcode/hi16-action-barcode.png new file mode 100644 index 0000000..c238610 Binary files /dev/null and b/kbarcode/hi16-action-barcode.png differ diff --git a/kbarcode/hi16-action-kbarcodeellipse.png b/kbarcode/hi16-action-kbarcodeellipse.png new file mode 100644 index 0000000..ba683c3 Binary files /dev/null and b/kbarcode/hi16-action-kbarcodeellipse.png differ diff --git a/kbarcode/hi16-action-kbarcodegrid.png b/kbarcode/hi16-action-kbarcodegrid.png new file mode 100644 index 0000000..1bcbd32 Binary files /dev/null and b/kbarcode/hi16-action-kbarcodegrid.png differ diff --git a/kbarcode/hi16-action-kbarcodelinetool.png b/kbarcode/hi16-action-kbarcodelinetool.png new file mode 100644 index 0000000..80cd7e4 Binary files /dev/null and b/kbarcode/hi16-action-kbarcodelinetool.png differ diff --git a/kbarcode/hi16-app-kbarcode.png b/kbarcode/hi16-app-kbarcode.png new file mode 100644 index 0000000..08b115d Binary files /dev/null and b/kbarcode/hi16-app-kbarcode.png differ diff --git a/kbarcode/hi22-action-barcode.png b/kbarcode/hi22-action-barcode.png new file mode 100644 index 0000000..68db3b4 Binary files /dev/null and b/kbarcode/hi22-action-barcode.png differ diff --git a/kbarcode/hi32-action-barcode.png b/kbarcode/hi32-action-barcode.png new file mode 100644 index 0000000..5b4b3f3 Binary files /dev/null and b/kbarcode/hi32-action-barcode.png differ diff --git a/kbarcode/hi32-action-kbarcoderect.png b/kbarcode/hi32-action-kbarcoderect.png new file mode 100644 index 0000000..9c2768f Binary files /dev/null and b/kbarcode/hi32-action-kbarcoderect.png differ diff --git a/kbarcode/hi32-app-kbarcode.png b/kbarcode/hi32-app-kbarcode.png new file mode 100644 index 0000000..54facc9 Binary files /dev/null and b/kbarcode/hi32-app-kbarcode.png differ diff --git a/kbarcode/hi64-app-kbarcode.png b/kbarcode/hi64-app-kbarcode.png new file mode 100644 index 0000000..2f15c83 Binary files /dev/null and b/kbarcode/hi64-app-kbarcode.png differ diff --git a/kbarcode/imageitem.cpp b/kbarcode/imageitem.cpp new file mode 100644 index 0000000..139504f --- /dev/null +++ b/kbarcode/imageitem.cpp @@ -0,0 +1,307 @@ +/*************************************************************************** + imageitem.h - description + ------------------- + begin : Do Sep 9 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "imageitem.h" +#include "tokenprovider.h" + +#include +#include +#include +#include +#include + +#include +#include + +ImageItem::ImageItem() + : DocumentItem() +{ + init(); +} + +ImageItem::~ImageItem() +{ +} + +void ImageItem::init() +{ + m_rotation = 0.0; + m_mirror_h = false; + m_mirror_v = false; + m_scaling = eImage_Original; + setBorder( false ); + + setRect( QRect( 0, 0, 20, 20 ) ); +} + +void ImageItem::draw(QPainter* painter) +{ + createImage(); + + painter->save(); + painter->drawPixmap( rect().x(), rect().y(), m_tmp ); + painter->restore(); + DocumentItem::drawBorder(painter); +} + +void ImageItem::drawZpl( QTextStream* stream ) +{ + createImage(); + + QBuffer buffer; + if( buffer.open( IO_WriteOnly ) ) + { + // TODO: bmp???? + QImageIO io( &buffer, "PNG" ); + QImage image = m_tmp.convertToImage(); + // create a black and white image + io.setImage( image.convertDepth( 1 ) ); + io.write(); + buffer.close(); + + QByteArray data = buffer.buffer(); + *stream << ZPLUtils::fieldOrigin( rect().x(), rect().y() ); + *stream << "~DYD,p,P," << QString::number( data.size() ) + ",0,"; + for( unsigned int i=0;i= 0; i-- ){ + for( int j=0; j < height; j++ ){ + if( buf == 0 ) + c = qBlue(si.pixel(i,j)); // Yellow + else if( buf == 1 ) + c = qGreen(si.pixel(i,j)); // Magenta + else if( buf == 2 ) + c = qRed(si.pixel(i,j)); // Cyan + + // printer has 5-bits per color - drop 3 + // we also need to subtract from 255 to convert from RGB to CMY + out = (0xff - c) >> 3; + *stream << out; + } + } + + *stream << "\r\n"; + } +} + +void ImageItem::loadXML(QDomElement* element) +{ + QByteArray out; + if( !element->text().isEmpty() ) + { + KCodecs::base64Decode( element->text().utf8(), out ); + m_pixmap.loadFromData( out, "PNG" ); + } + + m_expression = element->attribute( "expression", QString::null ); + m_scaling = (EImageScaling)element->attribute( "scaling", "0" ).toInt(); + m_mirror_h = (bool)element->attribute("mirror_horizontal", "0" ).toInt(); + m_mirror_v = (bool)element->attribute("mirror_vertical", "0" ).toInt(); + m_rotation = element->attribute("rotation", "0.0").toDouble(); + DocumentItem::loadXML(element); + + updateImage(); +} + +void ImageItem::saveXML(QDomElement* element) +{ + QBuffer buf; + if( !m_pixmap.isNull() ) + { + if(!buf.open( IO_WriteOnly )) + return; + + m_pixmap.save( &buf, "PNG" ); + buf.close(); + + element->appendChild( element->ownerDocument().createCDATASection( KCodecs::base64Encode( buf.buffer(), true ) ) ); + } + + element->setAttribute( "expression", m_expression ); + element->setAttribute( "scaling", (int)m_scaling ); + element->setAttribute( "mirror_horizontal", m_mirror_h ); + element->setAttribute( "mirror_vertical", m_mirror_v ); + element->setAttribute( "rotation", m_rotation ); + + DocumentItem::saveXML(element); +} + +void ImageItem::setExpression( const QString & ex ) +{ + m_expression = ex; + updateImage(); +} + +void ImageItem::setPixmap( const QPixmap & pix ) +{ + m_pixmap = pix; + updateImage(); +} + +const QPixmap & ImageItem::pixmap() +{ + return m_pixmap; +} + +void ImageItem::setScaling( EImageScaling scaling ) +{ + m_scaling = scaling; + updateImage(); +} + +EImageScaling ImageItem::scaling() const +{ + return m_scaling; +} + +void ImageItem::updateImage() +{ + m_tmp.resize( QSize(0,0) ); +} + +void ImageItem::createImage() +{ + if( m_tmp.isNull() ) + { + QImage img; + + if( m_pixmap.isNull() ) + img.load( tokenProvider() ? tokenProvider()->parse( m_expression ) : m_expression ); + else + img = m_pixmap.convertToImage(); + + if( !img.isNull() ) + { + if( m_rotation != 0.0 ) + { + QWMatrix matrix; + matrix.rotate( m_rotation ); + img = img.xForm( matrix ); + } + + // scale with high quality on the printer + // but use faster scaling for onscreen operations + if( m_scaling != eImage_Original ) + { + if( DocumentItem::paintDevice()->isExtDev() ) + img = img.smoothScale( rect().width(), rect().height(), + (m_scaling == eImage_Scaled ? QImage::ScaleMin : QImage::ScaleFree) ); + else + img = img.scale( rect().width(), rect().height(), + (m_scaling == eImage_Scaled ? QImage::ScaleMin : QImage::ScaleFree) ); + } + else + { + // we have to scale because of the bigger printer resolution + if( DocumentItem::paintDevice()->isExtDev() ) + { + QPaintDeviceMetrics metrics( DocumentItem::paintDevice() ); + + img = img.smoothScale( (int)(img.width() * ((double)metrics.logicalDpiX()/QPaintDevice::x11AppDpiX())), + (int)(img.height() * ((double)metrics.logicalDpiY()/QPaintDevice::x11AppDpiY())), + QImage::ScaleMin ); + } + } + + if( m_mirror_h || m_mirror_v ) + img = img.mirror( m_mirror_h, m_mirror_v ); + + m_tmp.convertFromImage( img ); + } + else + { + // The expression does not return a valid image path + // or the user did not specify a image to load + + // make sure that we do not get a 0 0 0 0 rectangle + QRect myrect( 0, 0, rect().width() ? rect().width() : 100 , rect().height() ? rect().height() : 80 ); + m_tmp.resize( rect().width(), rect().height() ); + + QPainter painter( &m_tmp ); + painter.fillRect( myrect, Qt::white ); + painter.setPen( QPen( Qt::red, 2 ) ); + painter.drawRect( myrect ); + painter.drawLine( 0, 0, myrect.width(), myrect.height() ); + painter.drawLine( 0, myrect.height(), myrect.width(), 0 ); + painter.setPen( Qt::black ); + painter.drawText( 0, painter.fontMetrics().lineSpacing(), i18n("Expression: ") + m_expression ); + painter.end(); + } + } +} + +void ImageItem::setRotation( double rot ) +{ + if( m_rotation <= 360.0 && m_rotation >= -360.0 ) + { + m_rotation = rot; + updateImage(); + } +} + +double ImageItem::rotation() const +{ + return m_rotation; +} + +void ImageItem::setMirrorHorizontal( bool b ) +{ + m_mirror_h = b; + updateImage(); +} + +bool ImageItem::mirrorHorizontal() const +{ + return m_mirror_h; +} + +void ImageItem::setMirrorVertical( bool b ) +{ + m_mirror_v = b; + updateImage(); +} + +bool ImageItem::mirrorVertical() const +{ + return m_mirror_v; +} diff --git a/kbarcode/imageitem.h b/kbarcode/imageitem.h new file mode 100644 index 0000000..d3f4194 --- /dev/null +++ b/kbarcode/imageitem.h @@ -0,0 +1,79 @@ +/*************************************************************************** + imageitem.h - description + ------------------- + begin : Do Sep 9 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ +#ifndef IMAGEITEM_H +#define IMAGEITEM_H + +#include "documentitem.h" + +#include + +enum EImageScaling { eImage_Original = 0, eImage_Scaled, eImage_Zoomed }; + +/** +@author Dominik Seichter +*/ +class ImageItem : public DocumentItem +{ + public: + ImageItem(); + ~ImageItem(); + + void setExpression( const QString & ex ); + inline QString expression() const { return m_expression; }; + + void setPixmap( const QPixmap & pix ); + const QPixmap & pixmap(); + + void setScaling( EImageScaling scaling ); + EImageScaling scaling() const; + + void setRotation( double rot ); + double rotation() const; + + void setMirrorHorizontal( bool b ); + bool mirrorHorizontal() const; + + void setMirrorVertical( bool b ); + bool mirrorVertical() const; + + virtual int rtti() const { return eRtti_Image;} + virtual void draw(QPainter* painter); + virtual void drawZpl( QTextStream* stream ); + virtual void drawIpl( QTextStream* stream, IPLUtils* utils ); + virtual void drawEPcl( QTextStream* stream ); + virtual void loadXML(QDomElement* element); + virtual void saveXML(QDomElement* element); + + void updateImage(); + void createImage(); + + private: + void init(); + + private: + QString m_expression; + QPixmap m_pixmap; + QPixmap m_tmp; + + double m_rotation; + bool m_mirror_v; + bool m_mirror_h; + + EImageScaling m_scaling; +}; + +#endif diff --git a/kbarcode/kactionmap.cpp b/kbarcode/kactionmap.cpp new file mode 100644 index 0000000..7ef48ce --- /dev/null +++ b/kbarcode/kactionmap.cpp @@ -0,0 +1,188 @@ +/*************************************************************************** + kactionmap.cpp - description + ------------------- + begin : Fri Mai 19 2006 + copyright : (C) 2006 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "kactionmap.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#if KDE_VERSION >= 0x030500 +#include +#endif +#include + +class KListViewActionItem : public KListViewItem { +public: + KListViewActionItem( KListView* parent, KAction* action ) + : KListViewItem( parent ), m_action( action ) + { + QPixmap pix; + QSize size = QIconSet::iconSize( QIconSet::Large ); + QIconSet iconset = m_action->iconSet( KIcon::Panel, KIcon::SizeLarge ); + QRegExp regtag( "<[^>]*>" ); + + pix = iconset.pixmap( QIconSet::Large, QIconSet::Normal ); // m_action->isEnabled() ? QIconSet::Normal : QIconSet::Disabled ); + if( pix.isNull() ) + { + pix.resize( size ); + pix.fill( backgroundColor() ); + } + else + { + if( pix.size() != size ) + { + pix = pix.convertToImage().smoothScale( size ); + } + } + + setText( 0, m_action->plainText() ); + setText( 1, m_action->shortcutText() ); + // replace HTML tags in What's this help + setText( 2, m_action->whatsThis().replace( regtag, "" ) ); + setPixmap( 0, pix ); + } + + void paintCell( QPainter *p, const QColorGroup &cg, + int column, int width, int alignment ) + { + QColorGroup _cg( cg ); + QColor c = _cg.text(); + if( m_action && !m_action->isEnabled() ) + _cg.setColor( QColorGroup::Text, Qt::gray ); + + KListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( QColorGroup::Text, c ); + } + + inline KAction* action() const + { + return m_action; + } + +private: + KAction* m_action; +}; + +KActionMapDlg::KActionMapDlg( KActionCollection* actions, QWidget* parent, const char* name ) + : KDialogBase( parent, name, false, i18n("Action Map"), KDialogBase::Close, KDialogBase::Close ) +{ + QVBox *page = makeVBoxMainWidget(); + + new QLabel( i18n("Find and execute actions."), page ); + m_map = new KActionMap( actions, page ); + + show(); +} + +void KActionMapDlg::updateEnabledState() +{ + m_map->updateEnabledState(); +} + +KActionMap::KActionMap( KActionCollection* actions, QWidget* parent, const char* name ) + : QWidget( parent, name ), m_actions( actions ), m_showMenuTree( true ), m_grayOutItems( false ) +{ + QVBoxLayout* layout = new QVBoxLayout( this ); + + m_listView = new KListView( this ); +#if KDE_VERSION >= 0x030500 + m_searchLine = new KListViewSearchLineWidget( m_listView, this ); +#endif + + m_listView->addColumn( i18n("Action") ); + m_listView->addColumn( i18n("Shortcut") ); + m_listView->addColumn( i18n("Description") ); + m_listView->setColumnWidthMode( 0, QListView::Maximum ); + m_listView->setColumnWidthMode( 1, QListView::Maximum ); + m_listView->setColumnWidthMode( 2, QListView::Manual ); + m_listView->setSorting( 0 ); + m_listView->setAllColumnsShowFocus( true ); + +#if KDE_VERSION >= 0x030500 + layout->addWidget( m_searchLine ); +#endif + layout->addWidget( m_listView ); + + connect( m_listView, SIGNAL( executed( QListViewItem* ) ), this, SLOT( slotExecuteAction( QListViewItem* ) ) ); + connect( actions, SIGNAL( inserted( KAction* ) ), this, SLOT( slotActionCollectionChanged() ) ); + connect( actions, SIGNAL( removed( KAction* ) ), this, SLOT( slotActionCollectionChanged() ) ); + slotActionCollectionChanged(); +} + +KActionMap::~KActionMap() +{ + +} + +void KActionMap::slotActionCollectionChanged() +{ + KActionPtrList actions; + KActionPtrList::const_iterator it; + + m_listView->clear(); + + if( !m_actions ) + return; + + actions = m_actions->actions(); + it = actions.begin(); + + while( it != actions.end() ) + { + /* + if( m_showMenuTree ) + { + } + */ + + new KListViewActionItem( m_listView, (*it) ); + + connect( *it, SIGNAL( enabled(bool) ), this, SLOT( updateEnabledState() ) ); + + ++it; + } + +} + +void KActionMap::slotExecuteAction( QListViewItem* item ) +{ + KListViewActionItem* action = dynamic_cast(item); + if( !action ) + return; + + if( !action->action()->isEnabled() ) + return; + + action->action()->activate(); +} + +void KActionMap::updateEnabledState() +{ + m_listView->repaintContents(); +} + +#include "kactionmap.moc" diff --git a/kbarcode/kactionmap.h b/kbarcode/kactionmap.h new file mode 100644 index 0000000..a8d687b --- /dev/null +++ b/kbarcode/kactionmap.h @@ -0,0 +1,101 @@ +/*************************************************************************** + kactionmap.h - description + ------------------- + begin : Fri Mai 19 2006 + copyright : (C) 2006 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _KACTION_MAP_H_ +#define _KACTION_MAP_H_ + +#include +#include +#include + +class KActionCollection; +class KActionMap; +#if KDE_VERSION >= 0x030500 +class KListViewSearchLineWidget; +#endif +class KListView; +class QListViewItem; + +/** Open a simple dialog containing an action map. + */ +class KActionMapDlg : public KDialogBase { + public: + KActionMapDlg( KActionCollection* actions, QWidget* parent = NULL, const char* name = NULL ); + + /** Call this function whenever you changed the enabled/disalbed state of an action + * in your application. + */ + void updateEnabledState(); + + private: + KActionMap* m_map; +}; + +/** + * + * This class is an implementation of an Action Map for KDE. + * + * + * What is an Action Map? + * + * Almost every web page has a site map. According to Wikipedia, + * a site map "helps visitors, and search engine robots, to find + * pages on the site". Similar an Action Map should help the + * user to find actions (i.e. functions or menu items) in an application. + * + * More concrete an Action Map is a dialog with a list of all + * actions (i.e. make text bold, save file or insert image) + * that can be performed in the application at its current state. + * Additionally there is a search box at the top of the list so + * that the user can search the list easily for a special action. + * The action is executed by clicking on it. Disabled actions are + * grayed out and cannot be clicked. The dialog is modeless so that + * it can always be open and the normal usage of the application is not disturbed. + */ +class KActionMap : public QWidget { + Q_OBJECT + public: + /** Creates a new KActionMap widget + * @param action all actions from this KActionCollection are displayed. + * @param parent the parent + * @param name the name + */ + KActionMap( KActionCollection* actions, QWidget* parent = NULL, const char* name = NULL ); + ~KActionMap(); + + public slots: + /** Call this function whenever you changed the enabled/disalbed state of an action + * in your application. + */ + void updateEnabledState(); + + private slots: + void slotActionCollectionChanged(); + void slotExecuteAction( QListViewItem* item ); + + private: + KActionCollection* m_actions; + KListView* m_listView; +#if KDE_VERSION >= 0x030500 + KListViewSearchLineWidget* m_searchLine; +#endif + + bool m_showMenuTree; + bool m_grayOutItems; +}; + +#endif // _KACTION_MAP_H_ diff --git a/kbarcode/kbarcode-batch.desktop b/kbarcode/kbarcode-batch.desktop new file mode 100644 index 0000000..dc67d1b --- /dev/null +++ b/kbarcode/kbarcode-batch.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Exec=kbarcode --batch +Icon=kbarcode.png +DocPath=kbarcode/index.html +Comment=Barcode and label printing tool (batch printing mode) +Comment[de]=Werkzeug zum Barcode und Etiketten Druck (Stapelverarbeitung) +Terminal=false +Name=KBarcode Batch Printing +Name[de]=KBarcode Batch Druck +Categories=Qt;KDE;Office; diff --git a/kbarcode/kbarcode-editor.desktop b/kbarcode/kbarcode-editor.desktop new file mode 100644 index 0000000..1b47d01 --- /dev/null +++ b/kbarcode/kbarcode-editor.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Exec=kbarcode --label +Icon=kbarcode.png +DocPath=kbarcode/index.html +Comment=Barcode and label printing tool (editor) +Comment[de]=Werkzeug zum Barcode und Etiketten Druck (Editor) +Terminal=false +Name=KBarcode Label Editor +Name[de]=KBarcode Label Editor +Categories=Qt;KDE;Office; + + diff --git a/kbarcode/kbarcode-label.desktop b/kbarcode/kbarcode-label.desktop new file mode 100644 index 0000000..d90caef --- /dev/null +++ b/kbarcode/kbarcode-label.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=MimeType +Comment=KBarcode Label +Encoding=UTF-8 +Icon=kbarcode +MimeType=application/kbarcode-label +Name[de]=kbarcode-label.desktop +Patterns=*.kbarcode;*.KBARCODE; + diff --git a/kbarcode/kbarcode-single.desktop b/kbarcode/kbarcode-single.desktop new file mode 100644 index 0000000..22e9880 --- /dev/null +++ b/kbarcode/kbarcode-single.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Exec=kbarcode --barcode +Icon=kbarcode.png +DocPath=kbarcode/index.html +Comment=Barcode generation tool +Comment[de]=Barcode Erstellung +Terminal=0 +Name=KBarcode Barcode Generator +Name[de]=KBarcode Barcode Generator +Categories=Qt;KDE;Office; diff --git a/kbarcode/kbarcode.cpp b/kbarcode/kbarcode.cpp new file mode 100644 index 0000000..773c975 --- /dev/null +++ b/kbarcode/kbarcode.cpp @@ -0,0 +1,292 @@ +/*************************************************************************** + kbarcode.cpp - description + ------------------- + begin : Mit Jan 15 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "kbarcode.h" +#include "barkode.h" +#include "barcodedialog.h" +#include "batchwizard.h" +#include "labeleditor.h" +#include "databasebrowser.h" +#include "csvimportdlg.h" +#include "sqltables.h" +#include "kbarcodesettings.h" + +// Qt includes +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include + +KBarcode::KBarcode( QWidget *parent, const char *name, WFlags f) + : DCOPObject("KBarcode"), + DSMainWindow( parent, name, f ) +{ + QGroupBox* w = new QGroupBox( this ); + w->setColumnLayout(0, Qt::Vertical ); + QVBoxLayout* layout = new QVBoxLayout( w->layout() ); + setCentralWidget( w ); + + buttonSingle = new KPushButton( i18n("Barcode &Generator..."), w ); + buttonSingle->setEnabled( Barkode::haveBarcode() ); + buttonEditor = new KPushButton( i18n("&Label Editor..."), w ); + buttonBatch = new KPushButton( i18n("&Batch Printing..."), w ); + buttonData = new KPushButton( i18n("Edit SQL &Tables..."), w ); + buttonData->setEnabled( false ); + + buttonSingle->setIconSet( BarIconSet( "barcode" ) ); + buttonEditor->setIconSet( BarIconSet( "edit" ) ); + buttonBatch->setIconSet( BarIconSet( "fileprint" ) ); + + layout->addWidget( buttonSingle ); + layout->addWidget( buttonEditor ); + layout->addWidget( buttonBatch ); + layout->addWidget( buttonData ); + + connect( buttonSingle, SIGNAL( clicked() ), this, SLOT( startBarcode() ) ); + connect( buttonEditor, SIGNAL( clicked() ), this, SLOT( startLabelEditor() ) ); + connect( buttonBatch, SIGNAL( clicked() ), this, SLOT( startBatchPrint() ) ); + connect( SqlTables::getInstance(), SIGNAL( connectedSQL() ), this, SLOT( enableData() ) ); + + setupActions(); + show(); + + KAction* editLabelDefAct = new KAction(i18n("&Edit Label Definitions"), "", + 0, this, SLOT(editLabelDef()), actionCollection(), "design" ); + + KAction* editArticleAct = new KAction(i18n("&Edit Articles"), "", + 0, this, SLOT(editArticles()), actionCollection(), "design" ); + + KAction* editCustomerAct = new KAction(i18n("&Edit Customers"), "", + 0, this, SLOT(editCustomers()), actionCollection(), "design" ); + + KAction* editCustomerTextAct = new KAction(i18n("&Edit Customer Text"), "", + 0, this, SLOT(editCustomerText()), actionCollection() ); + + KAction* importCSVAct = new KAction(i18n("&Import CSV File..."), "", + 0, this, SLOT(importCSV()), actionCollection() ); + + KPopupMenu* data = new KPopupMenu( buttonData ); + editLabelDefAct->plug( data ); + editArticleAct->plug( data ); + editCustomerAct->plug( data ); + editCustomerTextAct->plug( data ); + buttonData->setPopup( data ); + data->insertSeparator(); + importCSVAct->plug( data ); + + enableData(); +} + +KBarcode::~KBarcode() +{ + DSMainWindow::saveConfig(); +} + +void KBarcode::setupActions() +{ + DSMainWindow::setupActions(); +} + +void KBarcode::startBarcode() +{ + new BarCodeDialog(); +} + +void KBarcode::startLabelEditor() +{ + LabelEditor* ed = new LabelEditor( NULL, QString::null, "LabelEditorWindow" ); + ed->startupDlg( LabelEditor::eCreateNewLabel, QString::null ); +} + +void KBarcode::startBatchPrint() +{ + new BatchWizard( this ); +} + +void KBarcode::editArticles() +{ + new DatabaseBrowser( TABLE_BASIC, NULL, "basicbrowser" ); +} + +void KBarcode::editCustomers() +{ + new DatabaseBrowser( TABLE_CUSTOMER, NULL, "customerbrowser" ); +} + +void KBarcode::editCustomerText() +{ + new DatabaseBrowser( TABLE_CUSTOMER_TEXT, NULL, "customertextbrowser" ); +} + +void KBarcode::editLabelDef() +{ + new DatabaseBrowser( TABLE_LABEL_DEF, NULL, "defbrowser" ); +} + +void KBarcode::enableData() +{ + buttonData->setEnabled( SqlTables::getInstance()->isConnected() ); +} + +bool KBarcode::parseCmdLine() +{ + enum { BARCODE, LABEL, BATCH, NONE } mode = NONE; + + KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + + BatchPrinter::EOutputFormat eFormat = BatchPrinter::POSTSCRIPT; + LabelEditor* pEdit = NULL; + QString serial; + QString sqlquery = QString::null; + QString csvfile = QString::null; + QString printer = QString::null; + + bool bPrintNow = args->isSet("print"); + int serialinc = 0; + int numlabels = -1; + + QString format = args->getOption("output"); + if( format.upper() == "BARCODE" ) + eFormat = BatchPrinter::BCP; + else if( format.upper() == "IMAGE" ) + eFormat = BatchPrinter::IMAGE; + else if( format.upper() == "POSTSCRIPT" ) + eFormat = BatchPrinter::POSTSCRIPT; + else + { + KMessageBox::error( this, i18n("%1 is no valid output format for --output. Valid values are POSTSCRIPT, IMAGE and BARCODE.").arg( format ) ); + } + + if( args->isSet("barcode") ) + { + mode = BARCODE; + startBarcode(); + } + + if( args->isSet("batch") ) + mode = BATCH; + + if( args->isSet("label") ) + mode = LABEL; + + if( args->isSet("serialnumber") ) + { + serial = args->getOption("serialnumber"); + if( args->isSet("serialinc") ) + serialinc = args->getOption("serialinc").toInt(); + } + + if( args->isSet("numlabels") ) + numlabels = args->getOption("numlabels").toInt(); + + if( args->isSet("importsql") ) + sqlquery = args->getOption("importsql"); + + if( args->isSet("importcsv") ) + csvfile = args->getOption("importcsv"); + + if( args->isSet("printer") ) + printer = args->getOption("printer"); + + for( int i = 0; i < args->count(); i++) + if( mode == BATCH ) + { + BatchWizard* b = new BatchWizard(); + b->setFilename( args->url( i ).path() ); + b->setOutputFormat( eFormat ); + b->setSerialNumber( serial, serialinc ); + if( !sqlquery.isEmpty() ) + b->setImportSqlQuery( sqlquery ); + + if( !csvfile.isEmpty() ) + b->setImportCsvFile( csvfile ); + + if( numlabels != -1 ) + b->setNumLabels( numlabels ); + + if( bPrintNow ) + { + b->printNow( printer, false ); + delete b; + } + } + else + { + pEdit = new LabelEditor( 0, args->url( i ).path() ); + if( bPrintNow ) + // TODO: use the printer set by the printer commandline option + pEdit->print(); + } + + if( !args->count() && mode == LABEL ) + { + pEdit = new LabelEditor(); + if( bPrintNow ) + // TODO: use the printer set by the printer commandline option + pEdit->print(); + + } + + int argc = args->count(); + args->clear(); // Free some memory + + // close after printing + if( bPrintNow && argc ) + { + // TODO: really close the whole application + this->close(); + return true; + } + else + return false; +} + +void KBarcode::importCSV() +{ + new CSVImportDlg( this, "csvimportdlg" ); +} + +bool KBarcode::isSQLConnected() const +{ + return SqlTables::isConnected(); +} + +bool KBarcode::connectSQL() +{ + return SqlTables::getInstance()->connectMySQL(); +} + +void KBarcode::showWizard() +{ + DSMainWindow::wizard(); +} + +void KBarcode::showConfigure() +{ + KBarcodeSettings::getInstance()->configure(); +} + + +#include "kbarcode.moc" diff --git a/kbarcode/kbarcode.desktop b/kbarcode/kbarcode.desktop new file mode 100644 index 0000000..7a10cc1 --- /dev/null +++ b/kbarcode/kbarcode.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Exec=kbarcode -caption "%c" %i %m %f +Icon=kbarcode.png +MimeType=application/kbarcode-label +DocPath=kbarcode/index.html +Comment=Barcode and label printing tool +Comment[de]=Werkzeug zum Barcode und Etiketten Druck +Terminal=0 +Name=KBarcode +Name[de]=KBarcode +Categories=Qt;KDE;Office; diff --git a/kbarcode/kbarcode.h b/kbarcode/kbarcode.h new file mode 100644 index 0000000..f00c6d8 --- /dev/null +++ b/kbarcode/kbarcode.h @@ -0,0 +1,98 @@ +/*************************************************************************** + kbarcode.h - description + ------------------- + begin : Don Apr 18 12:34:56 CEST 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KBARCODE_H +#define KBARCODE_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +enum linebreak { + NO_BREAK, + LINE_BREAK, + LABEL_X, + NEW_PAGE, + ARTICLE_GROUP_NO +}; + +#include "dsmainwindow.h" +#include "kbarcodeiface.h" + +class KAction; +class KPushButton; +/** The main window of KBarcode. All submodules + * are started from here. Submodules are the LabelEditor + * LabelPrinter (Batchprinting), DatabaseBrowser and BarcodeDialog. + * There are also a few smaller modules. + */ +class KBarcode: public DSMainWindow, public KBarcodeIface { + Q_OBJECT + public: + KBarcode( QWidget *parent=0, const char *name="kbarcode", WFlags f = WType_TopLevel | WDestructiveClose ); + ~KBarcode(); + + /** Parse all commandline options and start batchprinting + * if necessary. + * \returns true if the application should exit after this function + */ + bool parseCmdLine(); + + private slots: + void startBarcode(); + void startLabelEditor(); + void startBatchPrint(); + + void editArticles(); + void editCustomers(); + void editCustomerText(); + void editLabelDef(); + + void enableData(); + + void importCSV(); + + private: + void setupActions(); + + /** allow the DCOP interface + * to check for an SQL connection. + */ + bool isSQLConnected() const; + /** allow the DCOP interface + * to connect to the databases. + */ + bool connectSQL(); + /** allow DCOP interface + * to start the configuration wizard. + */ + void showWizard(); + /** show preferences from DCOP. + */ + void showConfigure(); + + + KAction* connectAct; + KPushButton* buttonSingle; + KPushButton* buttonEditor; + KPushButton* buttonBatch; + KPushButton* buttonData; +}; + +#endif diff --git a/kbarcode/kbarcodeiface.h b/kbarcode/kbarcodeiface.h new file mode 100644 index 0000000..b53f260 --- /dev/null +++ b/kbarcode/kbarcodeiface.h @@ -0,0 +1,46 @@ +/*************************************************************************** + kbarcodeiface.h - description + ------------------- + begin : Sat Dec 27 23:53:28 CET 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KBARCODEIFACE_H +#define KBARCODEIFACE_H + +#include + +class KBarcodeIface : virtual public DCOPObject +{ + K_DCOP + + public: + k_dcop: + virtual void startBarcode() = 0; + virtual void startLabelEditor() = 0; + virtual void startBatchPrint() = 0; + + virtual void editArticles() = 0; + virtual void editCustomers() = 0; + virtual void editCustomerText() = 0; + virtual void editLabelDef() = 0; + + virtual void importCSV() = 0; + + virtual bool isSQLConnected() const = 0; + virtual bool connectSQL() = 0; + virtual void showWizard() = 0; + virtual void showConfigure() = 0; +}; + +#endif /* KBARCODEIFACE_H */ diff --git a/kbarcode/kbarcodesettings.cpp b/kbarcode/kbarcodesettings.cpp new file mode 100644 index 0000000..aaa33d0 --- /dev/null +++ b/kbarcode/kbarcodesettings.cpp @@ -0,0 +1,106 @@ +/*************************************************************************** + kbarcodesettings.h - description + ------------------- + begin : Sat Jan 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "kbarcodesettings.h" +#include "configdialog.h" +#include "sqltables.h" +#include "printersettings.h" + +// KDE includes +#include +#include +#include +#include +#include + +// QT includes +#include + +KBarcodeSettings* KBarcodeSettings::m_instance = 0; +int KBarcodeSettings::gridsize = 30; +bool KBarcodeSettings::newdlg = true; +QColor KBarcodeSettings::gridcolor = Qt::black; +QString KBarcodeSettings::dateFormat = ""; + +KBarcodeSettings* KBarcodeSettings::getInstance() +{ + if( !m_instance ) + m_instance = new KBarcodeSettings(); + + return m_instance; +} + +KBarcodeSettings::KBarcodeSettings() +{ + +} + +KBarcodeSettings::~KBarcodeSettings() +{ + +} + +void KBarcodeSettings::saveConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("LabelEditor"); + config->writeEntry("grid", gridsize ); + config->writeEntry("gridcolor", gridcolor ); + config->writeEntry("AskNewDlg", newdlg ); + config->writeEntry("DateFormat", dateFormat ); +} + +void KBarcodeSettings::loadConfig() +{ + KConfig* config = kapp->config(); + + QColor tmpc( Qt::lightGray ); + config->setGroup("LabelEditor"); + gridsize = config->readNumEntry("grid", 5); + gridcolor = config->readColorEntry("gridcolor", &tmpc ); + newdlg = config->readBoolEntry("AskNewDlg", true ); + dateFormat = config->readEntry("DateFormat", "dd-MM-yyyy" ); +} + +void KBarcodeSettings::configure() +{ + ConfigDialog* cd = new ConfigDialog( 0 ); + cd->spinGrid->setValue( gridsize ); + cd->colorGrid->setColor( gridcolor ); + cd->checkNewDlg->setChecked( newdlg ); + cd->date->setText( dateFormat ); + if( cd->exec() == QDialog::Accepted ) { + PrinterSettings::getInstance()->saveConfig(); + SqlTables::getInstance()->saveConfig(); + + int oldgrid = gridsize; + QColor oldcolor = gridcolor; + gridsize = cd->spinGrid->value(); + gridcolor = cd->colorGrid->color(); + // gridsize or gridcolor has been changed + if( oldgrid != gridsize || oldcolor != gridcolor ) + emit updateGrid( gridsize ); + + newdlg = cd->checkNewDlg->isChecked(); + dateFormat = cd->date->text(); + + saveConfig(); + } +} + +#include "kbarcodesettings.moc" diff --git a/kbarcode/kbarcodesettings.h b/kbarcode/kbarcodesettings.h new file mode 100644 index 0000000..7a4cfea --- /dev/null +++ b/kbarcode/kbarcodesettings.h @@ -0,0 +1,65 @@ +/*************************************************************************** + kbarcodesettings.h - description + ------------------- + begin : Sat Jan 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KBARCODESETTINGS_H +#define KBARCODESETTINGS_H + +#include + +/** + A singleton which is responsible for loading and saving KBarcodes settings. + It emits also signals when some properties change. + + @author Dominik Seichter +*/ +class KBarcodeSettings : public QObject +{ + Q_OBJECT + public: + static KBarcodeSettings* getInstance(); + + static const QString getDateFormat() { + return dateFormat; + } + + int gridSize() const { return gridsize; } + const QColor & gridColor() const { return gridcolor; } + bool newDialog() const { return newdlg; } + public slots: + void loadConfig(); + void saveConfig(); + void configure(); + + signals: + /** Emitted when the user changes the grid size + */ + void updateGrid( int ); + + private: + KBarcodeSettings(); + ~KBarcodeSettings(); + + static KBarcodeSettings* m_instance; + + // LabelEditor settings: + static int gridsize; + static bool newdlg; + static QColor gridcolor; + static QString dateFormat; +}; + +#endif diff --git a/kbarcode/label.cpp b/kbarcode/label.cpp new file mode 100644 index 0000000..2537fcb --- /dev/null +++ b/kbarcode/label.cpp @@ -0,0 +1,303 @@ +/*************************************************************************** + label.cpp - description + ------------------- + begin : Mon Apr 29 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "label.h" +#include "measurements.h" +#include "kbarcode.h" +#include "printersettings.h" +#include "sqltables.h" +#include "documentitem.h" +#include "barcodeitem.h" +#include "rectitem.h" +#include "lineitem.h" +#include "imageitem.h" +#include "textitem.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include + +Label::Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer, QString customer_id, QString _article_no, QString _group ) + : TokenProvider( _printer ) +{ + m_sequence = false; + m_printer = _printer; + + setCustomerNo( customer_id ); + setArticleNo( _article_no ); + setGroup( _group ); + setLabelName( labelname.right( labelname.length() - labelname.findRev( "/" ) - 1 ) ); + + d = _def; + + load( device ); +} + +Label::Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer ) + : TokenProvider( _printer ) +{ + m_sequence = false; + m_printer = _printer; + + setLabelName( labelname.right( labelname.length() - labelname.findRev( "/" ) - 1 ) ); + + d = _def; + + load( device ); +} + +Label::~Label() +{ +} + +void Label::epcl( QTextStream* stream ) +{ + *stream << EPCLUtils::header(); + + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + if( drawThisItem( item ) ) + item->drawEPcl( stream ); + + *stream << EPCLUtils::footer(); +} + +void Label::ipl( QTextStream* stream ) +{ + IPLUtils utils; + *stream << utils.header(); + + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + if( drawThisItem( item ) ) + item->drawIpl( stream, &utils ); + + *stream << utils.footer(); +} + + +void Label::zpl( QTextStream* stream ) +{ + *stream << ZPLUtils::header(); + + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + if( drawThisItem( item ) ) + item->drawZpl( stream ); + + *stream << ZPLUtils::footer(); +} + +void Label::InitBarcodes() +{ + bool firstbarcode = true; + + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + { + if( item->rtti() == eRtti_Barcode ) + { + /* + TODO: I am not sure wether this should be done + if( !drawThisItem( item ) ) + continue; + */ + + BarcodeItem* bc = static_cast(item); + bc->setIndex( index() ); + setBarcodeValue( bc ); + bc->updateBarcode(); + + if( firstbarcode ) + { + // set some values of the first barcode + firstbarcode = false; + + m_sequence = bc->sequenceEnabled() || m_sequence; + setBarcodeNo( bc->parsedValue() ); + setEncodingTypeName( bc->type() ); + } + } + } + + updateDone(); +} + +void Label::draw( QPainter* painter, int x, int y ) +{ + QSize label( (int)d->getMeasurements().width( painter->device() ), + (int)d->getMeasurements().height( painter->device() ) ); + + InitBarcodes(); + + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + if( drawThisItem( item ) ) + { + // add x and y to clip coordinates + // as clip has its top left corner + // at (0,0) + QRect clip( item->boundingRect() ); + if( x + clip.x() < x ) + clip.setX( 0 ); + + if( y + clip.y() < y ) + clip.setY( 0 ); + + if( clip.x() + clip.width() > label.width() ) + clip.setWidth( label.width() - clip.x() ); + + if( clip.y() + clip.height() > label.height() ) + clip.setHeight( label.height() - clip.y() ); + + painter->save(); + painter->translate( x,y ); + painter->setClipRect( clip, QPainter::CoordPainter ); + item->draw( painter ); + painter->restore(); + } +} + +void Label::setBarcodeValue( Barkode* barcode ) +{ + // use the same i18n() for static as in BarcodeSettingsDlg + if( barcode->databaseMode().lower() != "static" && barcode->databaseMode().lower() != i18n("Static") ) + { + QString encoding_type = getTypeFromCaption( barcode->databaseMode() ); + QString mode = getModeFromCaption( barcode->databaseMode() ); + + QSqlQuery query( "select barcode_no, encoding_type from " TABLE_BASIC + " where article_no = '" + articleNo() + "'" ); + while ( query.next() ) + { + barcode->setValue( query.value(0).toString() ); + barcode->setType( query.value(1).toString() ); + } + + if( mode.lower() != "main" ) + { + QSqlQuery query1( "select barcode_no from " TABLE_CUSTOMER_TEXT " where customer_no ='"+ mode + + "' and article_no='" + articleNo() + "'" ); + while ( query1.next() ) + { + if( !query1.value(0).toString().isEmpty() ) + { + barcode->setValue( query.value(0).toString() ); + barcode->setType( encoding_type ); + } + } + } + } +} + +void Label::load( QIODevice* device ) +{ + if( !device ) return; + + if( !device->isOpen() ) + device->open( IO_ReadOnly ); + + QDomDocument doc( "KBarcodeLabel" ); + doc.setContent( device ); + + bool kbarcode18; + QString description; + Definition* definition = NULL; + readXMLHeader( &doc, description, kbarcode18, &definition ); + delete definition; + + readDocumentItems( &m_list, &doc, NULL, kbarcode18 ); + m_list.setAutoDelete( true ); + + // sort the list by z index + m_list.sort(); + + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + { + // set the paint device for all items + item->setPaintDevice( m_printer ); + item->setTokenProvider( this ); + } + + device->close(); +} + +void Label::getXLabel( double x, double y, double width, double height, QPainter* painter, int mode, QString value ) +{ + painter->save(); + if( mode == LABEL_X ) { + painter->setPen( QPen( Qt::black, 5) ); + painter->drawLine( (int)x, (int)y, int(x+width), int(y+height) ); + painter->drawLine( (int)x, int(y+height), int(x+width), (int)y ); + } else if( mode == ARTICLE_GROUP_NO ) { + painter->setPen( QPen( QPen::black, 1 ) ); + QFont f( "helvetica", 15 ); + int w = 0; + do { + f.setPointSize( f.pointSize() - 1 ); + painter->setFont( f ); + w = painter->fontMetrics().width( value ); + } while( w > width && f.pointSize() > 0 ); + + painter->drawText( int(x + (width-w)/2), int(y + (height-f.pointSize())/2), value); + } + + painter->restore(); + return; +} + +int Label::getId() const +{ + if( d ) + return d->getId(); + + return -1; +}; + +bool Label::drawThisItem( const DocumentItem* item ) +{ + QString script = item->visibilityScript(); + + // make things go faster if the script is just "true" + if( script.isEmpty() || script == "true" ) + return true; + + script = parse( script ); + + return jsParseToBool( script ); +} + +bool Label::update() +{ + DocumentItem* item; + for( item = m_list.first();item;item=m_list.next()) + if( !item->visibilityScript().isEmpty() && item->visibilityScript() != "true" ) + return true; + + return TokenProvider::update(); +} diff --git a/kbarcode/label.h b/kbarcode/label.h new file mode 100644 index 0000000..698b861 --- /dev/null +++ b/kbarcode/label.h @@ -0,0 +1,77 @@ +/*************************************************************************** + label.h - description + ------------------- + begin : Mon Apr 29 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef LABEL_H +#define LABEL_H + +#include +#include +#include "labelutils.h" +#include "xmlutils.h" +#include "definition.h" +#include "tokenprovider.h" + +class BarCode; +class Barkode; +class QDomDocument; +class QIODevice; +class QString; +class QPainter; +class QPaintDevice; +class QTextStream; +class KPrinter; +/** Creates a QPicture from the XML KBarcode file. If a SQL connections is available + * the data from the SQL tables will be used, too. + */ +class Label : private LabelUtils, private XMLUtils, public TokenProvider { + public: + Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer, QString customer_id, QString _article_no, QString _group = "" ); + Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer ); + ~Label(); + + void epcl( QTextStream* stream ); + void ipl( QTextStream* stream ); + void zpl( QTextStream* stream ); + + void draw( QPainter* painter,int x, int y ); + + int getId() const; + static void getXLabel( double x, double y, double width, double height, QPainter* painter, int mode, QString value = "" ); + + //void setPrinter( KPrinter* p ) { m_printer = p; } + + /** reimplemented from TokenProvider + * returns wether this label has to be regenerated everytime + */ + bool update(); + + private: + void load( QIODevice* device ); + void setBarcodeValue( Barkode* barcode ); + void InitBarcodes(); + bool drawThisItem( const DocumentItem* item ); + + protected: + DocumentItemList m_list; + + Definition* d; + QPaintDevice* m_printer; + + bool m_sequence; +}; + +#endif diff --git a/kbarcode/labeldefinitions.sql b/kbarcode/labeldefinitions.sql new file mode 100644 index 0000000..5f022a3 --- /dev/null +++ b/kbarcode/labeldefinitions.sql @@ -0,0 +1,1710 @@ +INSERT INTO label_def VALUES (1,'Avery A4','C2050 Video Spine','S',18.43,31.34,20.0,147.32,20.0,147.32,1,13, NULL, NULL ) +INSERT INTO label_def VALUES (2,'Avery A4','C2050 Video Face','S',8.72,24.99,46.57,78.74,46.57,81.28,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (3,'Avery A4','C2070 Transfer Film for Mouse Pad','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (4,'Avery A4','C2080 Transfer Film for Puzzle','S',20.0,26.0,170.0,245.0,170.0,245.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (5,'Avery A4','C2090 T-Shirt Transfer Set','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (6,'Avery A4','C2160 Avery Inkjet Label','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (7,'Avery A4','C2163 Avery Inkjet Label','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (8,'Avery A4','C2165 Large Labels','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (9,'Avery A4','C2166 Avery 3.5\" Disk Label (Face only)','S',33.6,31.9,52.0,70.0,59.27,76.2,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (10,'Avery A4','C2241 Avery Rectangle Sticker','S',37.38,26.26,31.75,76.2,38.1,81.28,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (11,'Avery A4','C2243 Avery Small Round Sticker','S',27.85,22.05,38.1,38.1,50.8,42.6,4,5, NULL, NULL ) +INSERT INTO label_def VALUES (12,'Avery A4','C2244 Avery Big Round Sticker','S',33.81,29.66,71.95,71.95,78.72,78.74,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (13,'Avery A4','C2246 Avery Full Page Sticker','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (14,'Avery A4','C2265 Disk Labels','S',21.43,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (15,'Avery A4','C2341 Embossed Cards A5 (Cover)','S',20.0,168.5,170.0,108.5,170.0,108.5,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (16,'Avery A4','C2341 Embossed Cards A5 (Inside)','S',0.0,148.5,210.0,148.5,210.0,148.5,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (17,'Avery A4','C2342 Embossed cards A6 (Coverl)','S',14.0,119.0,120.5,77.0,148.5,77.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (18,'Avery A4','C2342 Embossed Cards A6 (Inside)','S',0.0,105.0,148.5,105.0,148.5,105.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (19,'Avery A4','C2351 Avery A5 Greeting Card','S',0.0,0.0,210.0,148.5,210.0,148.5,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (20,'Avery A4','C2352 Avery A6 Greeting Card','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (21,'Avery A4','C2353 Avery Postcard','S',31.75,31.75,110.4,146.5,123.1,146.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (22,'Avery A4','C2354 Avery Biz Card','S',34.27,22.5,50.8,80.37,59.22,85.13,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (23,'Avery A4','C2355 Avery Note Cards','S',25.4,22.45,120.72,82.55,125.48,82.55,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (24,'Avery A4','C2356 Avery Full Page Card','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (25,'Avery A4','C2357 Compliment Cards','S',0.0,0.0,99.0,210.0,99.0,210.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (26,'Avery A4','C2361 Greeting Cards (A6)','S',0.0,0.0,148.0,105.0,148.0,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (27,'Avery A4','C2364 Marbled Business Cards','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (28,'Avery A4','C2365 Marbled Business Cards','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (29,'Avery A4','C2366 Marbled Business Cards','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (30,'Avery A4','C2367 Marbled Business Cards','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (31,'Avery A4','C2370 A4 Coated Paper -110gsm','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (32,'Avery A4','C2371 A4 Coated Paper -160gsm','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (33,'Avery A4','C2374 Marbled Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (34,'Avery A4','C2375 Marbled Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (35,'Avery A4','C2376 Marbled Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (36,'Avery A4','C2377 Marbled Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (37,'Avery A4','C2378 A4 Colour Laser Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (38,'Avery A4','C2379 A4 Bright White','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (39,'Avery A4','C2410 Avery Self-Laminating Card','S',30.5,107.0,50.0,81.5,93.0,81.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (40,'Avery A4','C2420 Avery Self-Laminating Bookmark','S',16.0,30.0,178.0,38.0,178.0,89.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (41,'Avery A4','C2546 Windows Decals','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (42,'Avery A4','C2547 Fantastic Plastic','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (43,'Avery A4','C2651 Avery Inkjet Mini Label','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (44,'Avery A4','C6353 Photo Quality Gloss 4 x 6 Cards','S',0.0,0.0,101.6,152.4,101.6,152.4,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (45,'Avery A4','C9146 Photo Quality Label (Full Page)','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (46,'Avery A4','C9151 Photo Quality Label','S',28.5,15.0,40.0,30.0,50.0,37.5,5,5, NULL, NULL ) +INSERT INTO label_def VALUES (47,'Avery A4','C9169 Photo Quality Label (4 per page)','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (48,'Avery A4','C9312 Clean Edge(TM) Business Card','S',31.5,17.0,54.0,85.0,60.0,91.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (49,'Avery A4','C9351 Photo Quality Gloss A5 Greeting Card','S',0.0,0.0,210.0,148.5,210.0,148.5,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (50,'Avery A4','C9352 Greeting Cards Glossy A6','S',25.4,22.45,120.72,82.55,125.48,82.55,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (51,'Avery A4','C9353 Photo Quality Gloss Postcards','S',31.75,31.75,110.4,146.5,123.1,146.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (52,'Avery A4','C9354 Photo Quality Gloss Business Cards','S',34.27,22.25,50.8,80.4,59.22,85.13,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (53,'Avery A4','C9355 Post Cards','S',36.0,31.0,105.0,148.0,120.0,148.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (54,'Avery A4','C9356 Photo Quality A4 Card Sheet','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (55,'Avery A4','C9362 Business Cards Glossy','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (56,'Avery A4','C9372 Photo Paper Glossy 9 x 13','S',12.5,17.5,90.0,129.5,95.0,132.5,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (57,'Avery A4','C9373 Photo Gloss Paper','S',24.25,30.0,100.0,150.0,148.5,150.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (58,'Avery A4','C9374 Photo Quality Glossy Inkjet Card','S',17.5,15.0,129.5,180.0,132.5,180.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (59,'Avery A4','C9405 Avery T-Shirt Transfer Sheets','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (60,'Avery A4','C9406 Avery T-Shirt Transfer Sheets','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (61,'Avery A4','C9430 Photo Quality Glossy A4 Inkjet Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (62,'Avery A4','C9431 Photo Quality Glossy Paper - 160gsm','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (63,'Avery A4','C9433 Inkjet Glossy Double Sided Paper','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (64,'Avery A4','C9434 Photo Cards Glossy','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (65,'Avery A4','C9612 CD-R Business Card','S',23.75,15.0,56.0,84.0,64.5,96.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (66,'Avery A4','C9660 Full Face CD/DVD Labels','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (67,'Avery A4','COPT210 Copier Transparency','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (68,'Avery A4','IJT310 Inkjet Transparency - 90microns','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (69,'Avery A4','IJT311 Inkjet Transparency - 120 microns','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (70,'Avery A4','J40063 Address','S',23.45,55.45,38.1,99.1,63.5,99.1,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (71,'Avery A4','J40065 Parcel','S',40.4,5.9,67.7,99.1,67.7,99.1,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (72,'Avery A4','J400DK 3.5\" Diskette - Face Only','S',48.25,35.0,52.0,70.0,52.0,70.0,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (73,'Avery A4','J400SL 35mm Slide','S',17.94,13.0,11.11,46.0,33.84,46.0,4,4, NULL, NULL ) +INSERT INTO label_def VALUES (74,'Avery A4','J400VF Video Face','S',15.15,66.9,46.4,76.2,71.8,76.2,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (75,'Avery A4','J400VS Video Spine','S',21.2,32.5,17.0,145.0,29.7,145.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (76,'Avery A4','J8156 Address','S',14.1,6.46,17.8,58.0,17.8,69.54,3,15, NULL, NULL ) +INSERT INTO label_def VALUES (77,'Avery A4','J8157 Address','S',14.0,6.46,24.3,64.0,24.3,66.54,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (78,'Avery A4','J8158 Address','S',14.0,6.46,26.7,64.0,26.7,66.54,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (79,'Avery A4','J8159 Address','S',13.06,6.46,33.86,64.0,33.86,66.54,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (80,'Avery A4','J8160 Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (81,'Avery A4','J8161 Address','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (82,'Avery A4','J8162 Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (83,'Avery A4','J8163 Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (84,'Avery A4','J8164 Address','S',4.57,7.21,71.97,63.5,71.97,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (85,'Avery A4','J8165 Parcel','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (86,'Avery A4','J8166 Parcel','S',8.81,4.67,93.13,99.06,93.13,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (87,'Avery A4','J8167 Shipping','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (88,'Avery A4','J8168 Shipping','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (89,'Avery A4','J8169 Parcel','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (90,'Avery A4','J8170 Collect/Filing','S',16.5,38.0,11.0,134.0,11.0,134.0,1,24, NULL, NULL ) +INSERT INTO label_def VALUES (91,'Avery A4','J8171 Lever Arch Labels - White','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (92,'Avery A4','J8173 Address','S',6.0,4.67,57.0,99.06,57.0,101.6,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (93,'Avery A4','J8359 Address','S',13.06,6.46,33.86,64.0,33.86,66.54,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (94,'Avery A4','J8360 Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (95,'Avery A4','J8361 Address','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (96,'Avery A4','J8362 Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (97,'Avery A4','J8363 Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (98,'Avery A4','J8364 Address','S',4.57,7.21,71.97,63.5,71.97,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (99,'Avery A4','J8365 Parcel','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (100,'Avery A4','J8366 Parcel','S',8.81,4.67,93.13,99.06,93.13,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (101,'Avery A4','J8367 Shipping','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (102,'Avery A4','J8368 Shipping','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (103,'Avery A4','J8369 Parcel','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (104,'Avery A4','J8371 Lever Arch','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (105,'Avery A4','J8414 Clean Edge (TM) Business Card','S',21.5,15.0,50.8,87.0,50.8,93.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (106,'Avery A4','J8415 Greeting Cards Maxi (A6)','S',27.0,40.5,156.0,108.0,156.0,108.0,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (107,'Avery A4','J8423 Name Card','S',31.0,25.0,43.75,160.0,63.75,160.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (108,'Avery A4','J8431 CD Case Insert - Cover','S',44.5,27.5,121.0,121.0,121.0,121.0,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (109,'Avery A4','J8432 CD Case Insert - Tray','S',22.5,29.5,117.0,151.0,135.0,151.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (110,'Avery A4','J8433 CD Envelope','S',24.5,43.0,124.0,124.0,124.0,124.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (111,'Avery A4','J8434 Inkjet CD Inserts - Cover Section','S',24.0,59.5,121.0,121.0,121.0,121.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (112,'Avery A4','J8434 Inkjet CD Inserts - Tray Section','S',155.0,29.5,118.0,151.0,118.0,151.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (113,'Avery A4','J8435 CD Case Insert Cover Section','S',24.0,59.5,121.0,121.0,121.0,121.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (114,'Avery A4','J8435 CD Case Insert Tray Section','S',155.0,29.5,118.0,151.0,118.0,151.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (115,'Avery A4','J8436 CD Case Spine Labels','S',16.43,47.85,5.5,114.3,5.5,114.3,1,48, NULL, NULL ) +INSERT INTO label_def VALUES (116,'Avery A4','J8440 Zip(TM) Disk Card Insert - Panels','S',56.5,46.5,97.0,98.5,97.0,105.5,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (117,'Avery A4','J8560 Clear Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (118,'Avery A4','J8562 Clear Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (119,'Avery A4','J8563 Clear Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (120,'Avery A4','J8565 Clear Parcel','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (121,'Avery A4','J8567 Clear A4 Labels','S',6.5,5.2,284.0,199.6,284.0,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (122,'Avery A4','J8570 Full Face CD/DVD Labels - Clear Inkjet','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (123,'Avery A4','J8587 Inkjet Transparencies','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (124,'Avery A4','J8612 CD-R Business Card','S',23.75,15.0,56.0,84.0,64.5,96.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (125,'Avery A4','J8651 Mini Address','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (126,'Avery A4','J8654 Miini Address','S',21.43,9.75,25.4,45.72,25.4,48.26,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (127,'Avery A4','J8655 Audio Cassette','S',22.5,14.73,42.0,89.0,42.0,91.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (128,'Avery A4','J8656 35 mm Slide','S',15.95,6.0,11.11,46.0,12.7,50.67,4,21, NULL, NULL ) +INSERT INTO label_def VALUES (129,'Avery A4','J8657 35 mm Slides/Small Items','S',60.4,31.33,11.11,46.0,12.7,50.67,3,14, NULL, NULL ) +INSERT INTO label_def VALUES (130,'Avery A4','J8658 Mini Labels - Removable','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (131,'Avery A4','J8659 Mini Labels - Removable','S',13.43,4.67,10.0,17.78,10.0,20.32,10,27, NULL, NULL ) +INSERT INTO label_def VALUES (132,'Avery A4','J8666 3.5\" Diskette - Face Only','S',18.5,23.35,52.0,70.0,52.0,93.3,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (133,'Avery A4','J8667 Mini Disk Label - Face','S',13.5,9.25,52.0,35.5,54.5,39.0,5,5, NULL, NULL ) +INSERT INTO label_def VALUES (134,'Avery A4','J8667 Mini Disk Label - Spine','S',13.5,5.75,52.0,3.5,54.5,39.0,6,5, NULL, NULL ) +INSERT INTO label_def VALUES (135,'Avery A4','J8668 Labels for Zip (TM.) Disk','S',21.0,14.0,51.0,59.0,51.0,61.5,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (136,'Avery A4','J8671 Video Face','S',9.3,27.53,46.4,76.2,46.4,78.74,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (137,'Avery A4','J8674 Video Spine','S',13.04,32.61,16.93,144.78,16.93,144.78,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (138,'Avery A4','J8676 Full Face CD/DVD Labels','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (139,'Avery A4','J8701 Lever Arch','S',9.0,24.5,192.0,62.0,192.0,62.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (140,'Avery A4','J8702 Lever Arch','S',9.0,12.0,192.0,39.0,192.0,39.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (141,'Avery A4','J8766 3.5\" Diskette - Face Only','S',18.5,23.35,52.0,70.0,52.0,93.3,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (142,'Avery A4','J8770 Full Face CD/DVD Labels','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (143,'Avery A4','J8771 Video Face','S',9.3,27.53,46.4,76.2,46.4,78.74,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (144,'Avery A4','J8774 Video Spine','S',13.04,32.61,16.93,144.78,16.93,144.78,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (145,'Avery A4','J8776 Full Face CD/DVD Labels - Holographic','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (146,'Avery A4','J8777 Full Face CD/DVD Labels - Silver','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (147,'Avery A4','J8778 Full Face CD/DVD Labels - Gold','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (148,'Avery A4','J8867 Printable Magnets - Full Sheet','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (149,'Avery A4','J8871 Printable Magnets','S',22.5,24.5,28.0,78.0,28.0,83.0,2,9, NULL, NULL ) +INSERT INTO label_def VALUES (150,'Avery A4','J8875 Printable Magnets','S',8.5,5.0,140.0,50.0,140.0,50.0,4,2, NULL, NULL ) +INSERT INTO label_def VALUES (151,'Avery A4','J9124 Inkjet Labels Glossy','S',18.43,16.0,127.0,178.0,133.0,178.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (152,'Avery A4','L30063 Address','S',23.45,55.45,38.1,99.1,63.5,99.1,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (153,'Avery A4','L30065 Parcel','S',40.4,5.9,67.7,99.1,67.7,99.1,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (154,'Avery A4','L300DK 3.5\" Diskette - Face Only','S',48.25,35.0,52.0,70.0,52.0,70.0,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (155,'Avery A4','L300SL 35mm Slide','S',17.94,13.0,11.11,46.0,33.84,46.0,4,4, NULL, NULL ) +INSERT INTO label_def VALUES (156,'Avery A4','L300VF Video Face','S',15.15,66.9,46.4,76.2,71.8,76.2,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (157,'Avery A4','L300VS Video Spine','S',21.2,32.5,17.0,145.0,29.7,145.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (158,'Avery A4','L6008 Silver Heavy Duty Labels','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (159,'Avery A4','L6009 Silver Heavy Duty Labels','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (160,'Avery A4','L6011 Silver Heavy Duty Labels','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (161,'Avery A4','L6012 Silver Heavy Duty Labels','S',21.43,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (162,'Avery A4','L6112 Anti Tamper Labels','S',13.43,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (163,'Avery A4','L6113 Anti Tamper Labels','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (164,'Avery A4','L6114 Anti Tamper Labels','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (165,'Avery A4','L7051 Heavy Duty Labels Mini','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (166,'Avery A4','L7060 White Heavy Duty Labels','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (167,'Avery A4','L7063 White Heavy Duty Labels','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (168,'Avery A4','L7067 White Heavy Duty Labels','S',1.0,0.5,295.0,209.0,295.0,209.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (169,'Avery A4','L7068 White Heavy Duty Labels','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (170,'Avery A4','L7069 White Heavy Duty Labels','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (171,'Avery A4','L7156 Address','S',14.1,6.46,17.8,58.0,17.8,69.54,3,15, NULL, NULL ) +INSERT INTO label_def VALUES (172,'Avery A4','L7157 Address','S',14.0,6.46,24.3,64.0,24.3,66.54,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (173,'Avery A4','L7158 Address','S',14.0,6.46,26.7,64.0,26.7,66.54,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (174,'Avery A4','L7159 Address','S',13.06,6.46,33.86,64.0,33.86,66.54,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (175,'Avery A4','L7160 Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (176,'Avery A4','L7161 Address','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (177,'Avery A4','L7162 Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (178,'Avery A4','L7163 Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (179,'Avery A4','L7164 Address','S',4.57,7.21,71.97,63.5,71.97,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (180,'Avery A4','L7165 Parcel','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (181,'Avery A4','L7166 Parcel','S',8.81,4.67,93.13,99.06,93.13,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (182,'Avery A4','L7167 Shipping','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (183,'Avery A4','L7168 Shipping','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (184,'Avery A4','L7169 Parcel','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (185,'Avery A4','L7170 Eurofolio','S',16.5,38.0,11.0,134.0,11.0,134.0,1,24, NULL, NULL ) +INSERT INTO label_def VALUES (186,'Avery A4','L7171 Lever Arch - White','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (187,'Avery A4','L7171B Lever Arch Labels - Blue','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (188,'Avery A4','L7171G Lever Arch Labels - Green','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (189,'Avery A4','L7171R Lever Arch Labels - Red','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (190,'Avery A4','L7172 Ring Binder','S',13.5,3.73,30.0,100.0,30.0,102.54,2,9, NULL, NULL ) +INSERT INTO label_def VALUES (191,'Avery A4','L7173 Shipping','S',6.0,4.67,57.0,99.06,57.0,101.6,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (192,'Avery A4','L7176 Labels for 60mm Box File','S',19.15,5.0,41.0,100.0,43.54,100.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (193,'Avery A4','L7177 Address','S',21.44,4.67,42.33,99.06,42.33,101.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (194,'Avery A4','L7178 Labels for 40mm Box File','S',18.0,54.5,29.0,101.0,29.0,101.0,1,9, NULL, NULL ) +INSERT INTO label_def VALUES (195,'Avery A4','L7179 Labels for 25mm Box File','S',22.76,49.5,17.0,111.0,19.54,111.0,1,13, NULL, NULL ) +INSERT INTO label_def VALUES (196,'Avery A4','L7263 Fluorescent Yellow Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (197,'Avery A4','L7363 Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (198,'Avery A4','L7400 Suspended Files (Cupboard)','S',23.1,79.25,6.3,138.5,6.3,138.5,1,26, NULL, NULL ) +INSERT INTO label_def VALUES (199,'Avery A4','L7408 Suspended Files (Drawer)','S',23.1,10.0,6.3,277.0,6.3,277.0,1,26, NULL, NULL ) +INSERT INTO label_def VALUES (200,'Avery A4','L7409 Suspension Tab Card Inserts','S',21.0,19.5,15.0,57.0,15.0,57.0,3,17, NULL, NULL ) +INSERT INTO label_def VALUES (201,'Avery A4','L7410-5 IndexMaker 5 part - Labels','S',46.9,25.4,12.7,55.02,21.17,104.19,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (202,'Avery A4','L7410-5 IndexMaker 5 part - Contents Sheet','S',4.75,105.0,57.5,92.0,57.5,92.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (203,'Avery A4','L7410-6 IndexMaker 6 part - Labels','S',49.02,30.48,12.7,44.93,16.93,104.11,2,12, NULL, NULL ) +INSERT INTO label_def VALUES (204,'Avery A4','L7410-6 IndexMaker 6 part - Contents Sheet','S',5.0,105.0,47.5,92.0,47.5,92.0,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (205,'Avery A4','L7410-10 IndexMaker 10 part - Labels','S',46.9,19.91,12.7,25.4,21.17,48.26,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (206,'Avery A4','L7410-10 IndexMaker 10 part - Contents Sheet','S',4.25,105.0,28.85,92.0,28.85,92.0,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (207,'Avery A4','L7410-12 IndexMaker 12 part - Labels','S',49.02,25.42,12.7,22.0,16.93,45.72,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (208,'Avery A4','L7410-12 IndexMaker 12 part - Contents Sheet','S',5.1,105.0,23.9,92.0,23.9,92.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (209,'Avery A4','L7411-5 ReadyIndex 1-5 Index - Contents Sheet','S',4.33,109.5,57.67,100.0,57.67,100.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (210,'Avery A4','L7411-6 ReadyIndex 1-6 Index - Contents Sheet','S',4.5,109.5,48.0,100.0,48.0,100.0,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (211,'Avery A4','L7411-10 ReadyIndex 1-10 Index - Contents Sheet','S',4.25,109.5,28.85,100.0,28.85,100.0,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (212,'Avery A4','L7411-12 ReadyIndex 1-12 Index - Contents Sheet','S',5.1,109.5,23.9,100.0,23.9,100.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (213,'Avery A4','L7411-15 ReadyIndex 1-15 Index - Contents Sheet','S',18.0,109.5,17.4,100.0,17.4,100.0,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (214,'Avery A4','L7411-20 ReadyIndex 1-20 Index - Contents Sheet','S',15.0,109.5,13.35,100.0,13.35,100.0,1,20, NULL, NULL ) +INSERT INTO label_def VALUES (215,'Avery A4','L7411-31 ReadyIndex 1-31 Index - Contents Sheet','S',15.0,109.5,8.61,100.0,8.61,100.0,1,31, NULL, NULL ) +INSERT INTO label_def VALUES (216,'Avery A4','L7411-AZ ReadyIndex A-Z Index - Contents Sheet','S',15.0,109.5,13.35,100.0,13.35,100.0,1,20, NULL, NULL ) +INSERT INTO label_def VALUES (217,'Avery A4','L7411-JD ReadyIndex Jan-Dec Index - Contents Sheet','S',4.5,109.5,24.0,100.0,24.0,100.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (218,'Avery A4','L7412-5 Insertable Tab Dividers - 5 Tabs','S',47.3,25.4,12.7,55.0,21.15,105.0,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (219,'Avery A4','L7412-6 Insertable Tab Dividers - 6 Tabs','S',47.3,25.4,12.7,47.0,21.15,104.2,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (220,'Avery A4','L7412-8 Insertable Tab Dividers - 8 Tabs','S',47.3,25.4,12.7,43.0,21.15,104.2,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (221,'Avery A4','L7412-10 Insertable Tab Dividers - 10 Tabs','S',47.3,19.8,12.7,25.4,21.15,48.2,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (222,'Avery A4','L7412-12 Insertable Tab Dividers - 12 Tabs','S',47.3,19.8,12.7,25.4,21.15,48.2,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (223,'Avery A4','L7413 Business Card','S',21.5,15.0,50.8,90.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (224,'Avery A4','L7414 Business Card','S',18.5,15.0,52.0,90.0,52.0,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (225,'Avery A4','L7415 Business Card','S',18.5,15.0,52.0,90.0,52.0,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (226,'Avery A4','L7416-5 IndexMaker 5 part (Unpunched) - Labels','S',46.9,25.4,12.7,55.02,21.17,104.18,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (227,'Avery A4','L7416-5 IndexMaker 5 part (Unpunched) - Contents Sheet','S',4.33,105.0,57.67,92.0,57.67,92.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (228,'Avery A4','L7416-6 IndexMaker 6 part - Extra Wide - Labels','S',49.02,30.48,12.7,44.93,16.93,104.11,2,12, NULL, NULL ) +INSERT INTO label_def VALUES (229,'Avery A4','L7416-6 IndexMaker 6 part - Extra Wide - Contents Sheet','S',4.5,105.0,48.0,92.0,48.0,92.0,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (230,'Avery A4','L7416-10 IndexMaker 10 part (Unpunched) - Labels','S',46.9,19.91,12.7,25.4,21.17,48.26,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (231,'Avery A4','L7416-10 IndexMaker 10 part (Unpunched) - Contents Sheet','S',4.25,105.0,28.85,92.0,28.85,92.0,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (232,'Avery A4','L7416-12 IndexMaker 12 part - Extra Wide - Labels','S',49.02,25.42,12.7,22.0,16.93,45.72,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (233,'Avery A4','L7416-12 IndexMaker 12 part - Extra Wide - Contents Sheet','S',4.5,105.0,24.0,92.0,24.0,92.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (234,'Avery A4','L7417 Business Card','S',13.5,15.0,54.0,90.0,54.0,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (235,'Avery A4','L7418 Name Badge','S',38.5,19.0,55.0,86.0,55.0,86.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (236,'Avery A4','L7419 Business Card','S',13.5,15.0,54.0,90.0,54.0,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (237,'Avery A4','L7420-5 Direct Print Dividers','S',10.0,192.0,55.4,13.0,55.4,13.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (238,'Avery A4','L7420-6 Direct Print Dividers','S',10.0,192.0,46.22,13.0,46.22,13.0,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (239,'Avery A4','L7420-8 Direct Print Dividers','S',10.0,192.0,34.64,13.0,34.64,13.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (240,'Avery A4','L7421 Post Card','S',7.71,9.13,97.29,139.37,97.29,139.37,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (241,'Avery A4','L7422 Suspension Tab Card Inserts','S',58.0,19.0,6.0,173.0,12.0,173.0,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (242,'Avery A4','L7423 Delegate Card - Embossed','S',10.38,11.5,53.5,187.0,74.25,187.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (243,'Avery A4','L7424 Lever Arch Labels','S',9.0,30.43,192.0,59.0,192.0,59.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (244,'Avery A4','L7425 Lever Arch Labels','S',9.0,12.43,192.0,34.0,192.0,34.0,8,1, NULL, NULL ) +INSERT INTO label_def VALUES (245,'Avery A4','L7426 Note Card','S',8.28,0.0,139.37,105.0,139.37,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (246,'Avery A4','L7451-5 ReadyIndex 5 Index (Unnumbered) - Contents','S',4.33,109.5,57.67,100.0,57.67,100.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (247,'Avery A4','L7451-10 ReadyIndex 10 Index (Unnumbered) - Contents','S',4.25,109.5,28.85,100.0,28.85,100.0,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (248,'Avery A4','L7551 Clear Mini Address','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (249,'Avery A4','L7552 Clear Mini','S',46.9,25.4,12.7,55.02,21.17,104.18,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (250,'Avery A4','L7553 Clear Mini','S',49.02,25.42,12.7,22.0,16.93,45.72,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (251,'Avery A4','L7560 Clear Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (252,'Avery A4','L7562 Clear Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (253,'Avery A4','L7563 Clear Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (254,'Avery A4','L7565 Clear Parcel','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (255,'Avery A4','L7567 Clear A4 Labels','S',6.5,5.2,284.0,199.6,284.0,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (256,'Avery A4','L7568 Clear A5 Labels','S',4.98,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (257,'Avery A4','L7587 Laser Transparencies','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (258,'Avery A4','L7630 Circular','S',14.75,5.25,63.5,63.5,68.0,68.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (259,'Avery A4','L7650 Circular','S',14.75,5.25,63.5,63.5,68.0,68.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (260,'Avery A4','L7651 Mini Address','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (261,'Avery A4','L7651/PF Mini Address','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (262,'Avery A4','L7651/YF Mini Address','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (263,'Avery A4','L7652 Miini Address','S',12.99,9.75,16.93,45.72,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (264,'Avery A4','L7653 Mini','S',49.02,25.42,12.7,22.0,16.93,45.72,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (265,'Avery A4','L7654 Miini Address','S',21.43,9.75,25.4,45.72,25.4,48.26,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (266,'Avery A4','L7655 Audio Cassette','S',22.5,14.73,42.0,89.0,42.0,91.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (267,'Avery A4','L7656 35 mm Slide','S',15.95,6.0,11.11,46.0,12.7,50.67,4,21, NULL, NULL ) +INSERT INTO label_def VALUES (268,'Avery A4','L7657 Mini Labels - Removable - Laser','S',13.43,4.67,10.0,17.78,10.0,20.32,10,27, NULL, NULL ) +INSERT INTO label_def VALUES (269,'Avery A4','L7658 Mini Labels - Removable - Laser','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (270,'Avery A4','L7663 5.25\" Diskette','S',13.48,45.31,33.76,119.38,33.76,119.38,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (271,'Avery A4','L7664 3.5\" Diskette - Wraparound','S',4.57,17.93,71.97,70.0,71.97,104.14,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (272,'Avery A4','L7665 Mini Data Cartridge','S',21.6,22.0,21.15,72.0,21.15,94.0,2,12, NULL, NULL ) +INSERT INTO label_def VALUES (273,'Avery A4','L7666 3.5\" Diskette - Face Only','S',18.5,23.35,52.0,70.0,52.0,93.3,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (274,'Avery A4','L7667 Standard Data Cartridge','S',15.26,38.5,29.61,133.0,29.61,133.0,1,9, NULL, NULL ) +INSERT INTO label_def VALUES (275,'Avery A4','L7668 Labels for Zip(TM) Disk','S',21.0,14.0,51.0,59.0,51.0,61.5,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (276,'Avery A4','L7669 Labels for SuperDisk (TM )','S',23.5,39.0,61.0,54.0,63.0,78.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (277,'Avery A4','L7670 Circular - Fluorescent Yellow','S',14.75,5.25,63.5,63.5,68.0,68.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (278,'Avery A4','L7671 Video Face','S',9.3,27.53,46.4,76.2,46.4,78.74,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (279,'Avery A4','L7674 Video Spine','S',13.04,32.61,16.93,144.78,16.93,144.78,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (280,'Avery A4','L7675 4mm Data Cartridge','S',26.0,10.25,35.0,61.5,35.0,64.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (281,'Avery A4','L7676 Full Face CD/DVD Labels - Black & White','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (282,'Avery A4','L7680 Mini Address - Gold','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (283,'Avery A4','L7701 Lever Arch','S',9.0,24.5,192.0,62.0,192.0,62.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (284,'Avery A4','L7702 Lever Arch','S',9.0,12.0,192.0,39.0,192.0,39.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (285,'Avery A4','L7760 Full Face CD/DVD Labels - Colour Laser','S',21.5,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (286,'Avery A4','L7765 Presentation/Photo - Glossy Colour Laser','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (287,'Avery A4','L7767 Presentation/Photo - Glossy Colour Laser','S',1.0,0.5,295.0,209.0,295.0,209.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (288,'Avery A4','L7768 Presentation/Photo - Glossy Colour Laser','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (289,'Avery A4','L7769 Presentation/Photo - Glossy Colour Laser','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (290,'Avery A4','L7901 Organizer Page','S',0.0,0.0,170.0,95.0,170.0,95.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (291,'Avery A4','L7902 Organizer Page (A5)','S',0.0,0.0,210.0,148.5,210.0,148.5,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (292,'Avery A4','L7905 Compliment Slip','S',9.0,0.0,93.0,210.0,93.0,210.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (293,'Avery A4','LPT110 Laser/Copier Transparency - 100micron','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (294,'Avery A4','LPT111 Laser/Copier Transparency - 100micron','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (295,'Avery A4/Asia','C2412 Laminated Cards large','S',18.0,18.5,85.0,123.0,85.0,137.0,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (296,'Avery A4/Asia','C2413 Laminated Cards','S',20.5,107.0,60.0,91.0,98.0,91.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (297,'Avery A4/Asia','C2414 Laminated Cards','S',18.5,107.0,50.0,81.5,70.0,81.5,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (298,'Avery A4/Asia','C24412 Laminated Cards large','S',24.0,12.5,85.0,123.0,85.0,123.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (299,'Avery A4/Asia','C25446 A5 Sheet','S',0.0,0.0,210.0,148.0,210.0,148.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (300,'Avery A4/Asia','C25447 A5 Sheet','S',0.0,0.0,210.0,148.0,210.0,148.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (301,'Avery A4/Asia','C2546 Windows Decals','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (302,'Avery A4/Asia','C2547 Fantastic Plastic','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (303,'Avery A4/Asia','C91131 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (304,'Avery A4/Asia','C91149 Business Cards','S',25.0,15.0,55.0,91.0,64.0,99.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (305,'Avery A4/Asia','C9167 A4 Sheet','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (306,'Avery A4/Asia','C9169 Glossy Photo Quality Labels','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (307,'Avery A4/Asia','C9356 Photo Quality A4 Card Sheet','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (308,'Avery A4/Asia','J21013 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (309,'Avery A4/Asia','J21015 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (310,'Avery A4/Asia','J21016 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (311,'Avery A4/Asia','J21031 Business Cards','S',25.0,15.0,55.0,91.0,64.0,99.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (312,'Avery A4/Asia','J21033 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (313,'Avery A4/Asia','J21131 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (314,'Avery A4/Asia','J21141 Greeting Cards','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (315,'Avery A4/Asia','J21149 Business Cards','S',25.0,15.0,55.0,91.0,64.0,99.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (316,'Avery A4/Asia','J2356 A4 Sheet','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (317,'Avery A4/Asia','J8359 Address','S',13.06,6.46,33.86,64.0,33.86,66.54,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (318,'Avery A4/Asia','J8360 Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (319,'Avery A4/Asia','J8361 Address','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (320,'Avery A4/Asia','J8362 Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (321,'Avery A4/Asia','J8363 Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (322,'Avery A4/Asia','J8365 Address','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (323,'Avery A4/Asia','J8367 Shipping A4','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (324,'Avery A4/Asia','J8368 Shipping A5','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (325,'Avery A4/Asia','J8369 Parcel','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (326,'Avery A4/Asia','J8371 Lever Arch','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (327,'Avery A4/Asia','J8751 Mini Address','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (328,'Avery A4/Asia','J8756 35 mm Slide','S',15.95,6.0,11.11,46.0,12.7,50.67,4,21, NULL, NULL ) +INSERT INTO label_def VALUES (329,'Avery A4/Asia','J8766 3.5\" Diskette','S',18.5,23.35,52.0,70.0,52.0,93.3,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (330,'Avery A4/Asia','J8771 Video Face','S',9.3,27.53,46.4,76.2,46.4,78.74,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (331,'Avery A4/Asia','J8774 Video Spine','S',13.04,32.61,16.93,144.78,16.93,144.78,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (332,'Avery A4/Asia','J88911 Address','S',25.0,10.0,48.0,89.0,48.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (333,'Avery A4/Asia','J88915 Address','S',21.5,19.3,42.3,83.8,42.3,87.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (334,'Avery A4/Asia','J88919 Address','S',21.2,18.6,42.3,86.4,42.3,86.4,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (335,'Avery A4/Asia','J88923 Address','S',0.0,0.0,42.43,70.0,42.43,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (336,'Avery A4/Asia','J88927 Address','S',21.2,0.0,42.3,70.0,42.3,70.0,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (337,'Avery A4/Asia','J88935 Address','S',12.7,0.0,33.9,70.0,33.9,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (338,'Avery A4/Asia','L7159 Address','S',13.06,6.46,33.86,64.0,33.86,66.54,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (339,'Avery A4/Asia','L7160 Address','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (340,'Avery A4/Asia','L7161 Address','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (341,'Avery A4/Asia','L7162 Address','S',13.02,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (342,'Avery A4/Asia','L7163 Address','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (343,'Avery A4/Asia','L7164 Address','S',4.57,7.21,71.97,63.5,71.97,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (344,'Avery A4/Asia','L7165 Parcel','S',13.04,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (345,'Avery A4/Asia','L7166 Parcel','S',8.81,4.67,93.13,99.06,93.13,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (346,'Avery A4/Asia','L7167 Shipping','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (347,'Avery A4/Asia','L7168 Shipping','S',4.97,5.2,143.53,199.6,143.53,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (348,'Avery A4/Asia','L7169 Parcel','S',4.63,9.5,99.1,139.0,101.64,139.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (349,'Avery A4/Asia','L7170 Eurofolio','S',16.5,38.0,11.0,134.0,11.0,134.0,1,24, NULL, NULL ) +INSERT INTO label_def VALUES (350,'Avery A4/Asia','L7171 Lever Arch','S',5.0,28.5,200.0,60.0,200.0,60.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (351,'Avery A4/Asia','L7172 Ring Binder','S',13.5,3.73,30.0,100.0,30.0,102.54,2,9, NULL, NULL ) +INSERT INTO label_def VALUES (352,'Avery A4/Asia','L7173 Address','S',6.0,4.67,57.0,99.06,57.0,101.6,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (353,'Avery A4/Asia','L7651 Mini Adress','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (354,'Avery A4/Asia','L7656 35 mm Slide','S',15.95,6.0,11.11,46.0,12.7,50.67,4,21, NULL, NULL ) +INSERT INTO label_def VALUES (355,'Avery A4/Asia','L7664 3.5\" Diskette - Wraparound','S',4.57,17.93,71.97,70.0,71.97,104.14,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (356,'Avery A4/Asia','L7665 Mini Data Cartridge','S',21.6,22.0,21.15,72.0,21.15,94.0,2,12, NULL, NULL ) +INSERT INTO label_def VALUES (357,'Avery A4/Asia','L7666 3.5\" Diskette','S',18.5,23.35,52.0,70.0,52.0,93.3,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (358,'Avery A4/Asia','L7667 Standard Data Cartridge','S',15.26,38.5,29.61,133.0,29.61,133.0,1,9, NULL, NULL ) +INSERT INTO label_def VALUES (359,'Avery A4/Asia','L7668 Labels for Zip(TM) Disk','S',21.0,14.0,51.0,59.0,51.0,61.5,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (360,'Avery A4/Asia','L7671 Video Face','S',9.3,27.53,46.4,76.2,46.4,78.74,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (361,'Avery A4/Asia','L7674 Video Spine','S',13.04,32.61,16.93,144.78,16.93,144.78,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (362,'Avery A4/Asia','L78382 Address','S',21.2,18.6,42.3,86.4,42.3,86.4,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (363,'Avery A4/Asia','L78383 Address','S',0.0,0.0,42.43,70.0,42.43,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (364,'Avery A4/Asia','L78384 Address','S',21.2,0.0,42.3,70.0,42.3,70.0,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (365,'Avery A4/Asia','L78386 Address','S',12.7,0.0,33.9,70.0,33.9,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (366,'Avery A4/Asia','L78387 Address','S',21.2,18.6,50.8,86.4,50.8,86.4,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (367,'Avery A4/Asia','L78388 Address','S',8.8,8.4,25.4,48.3,25.4,48.3,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (368,'Avery A4/Asia','M21131 Business Cards','S',11.0,14.0,55.0,91.0,55.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (369,'Avery A4/Asia','M8167 A4 Sheet','S',3.98,5.2,289.05,199.6,289.05,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (370,'Avery A4/Asia','M88173 Address','S',23.3,7.1,44.5,96.5,44.5,99.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (371,'Avery A4/Asia','M88175 Address','S',20.0,20.4,42.3,83.8,42.3,87.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (372,'Avery A4/Asia','M88177 Address','S',25.0,10.0,48.0,89.0,48.0,91.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (373,'Avery A4/Asia','M88179 Address','S',23.0,20.0,42.0,84.0,42.0,86.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (374,'Avery A4/Asia','M88183 Address','S',21.5,19.3,42.3,83.8,42.3,87.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (375,'Avery A4/Asia','M88185 Address','S',21.5,0.0,42.3,70.0,42.3,70.0,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (376,'Avery A4/Asia','M88187 Address','S',22.5,20.0,42.0,84.0,42.0,86.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (377,'Avery A4/Asia','M88315 Address','S',23.5,7.0,33.9,64.0,33.9,64.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (378,'Avery A4/Asia','P78204 Address','S',0.0,0.0,74.25,42.0,74.25,42.0,5,4, NULL, NULL ) +INSERT INTO label_def VALUES (379,'Avery A4/Asia','P78261 Address','S',10.5,10.0,69.0,38.0,69.0,38.0,5,4, NULL, NULL ) +INSERT INTO label_def VALUES (380,'Avery A4/Asia','P78270 Address','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (381,'Avery A4/Asia','P78275 Address','S',22.5,20.0,42.0,85.0,42.0,85.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (382,'Avery Letter Size','5167 Return Address','S',12.7,7.14,12.7,44.45,12.7,52.4,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (383,'Avery Letter Size','5267 Return Address','S',12.7,7.14,12.7,44.45,12.7,52.4,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (384,'Avery Letter Size','5160 Address','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (385,'Avery Letter Size','5260 Address','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (386,'Avery Letter Size','5960 Address','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (387,'Avery Letter Size','5159 Address','S',6.35,3.96,38.1,101.6,38.1,106.38,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (388,'Avery Letter Size','5161 Address','S',12.7,3.96,25.4,101.6,25.4,106.36,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (389,'Avery Letter Size','5261 Address','S',12.7,3.96,25.4,101.6,25.4,106.36,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (390,'Avery Letter Size','5961 Address','S',12.7,3.96,25.4,101.6,25.4,106.36,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (391,'Avery Letter Size','5162 Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (392,'Avery Letter Size','5262 Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (393,'Avery Letter Size','5922 Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (394,'Avery Letter Size','5962 Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (395,'Avery Letter Size','5163 Address / Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (396,'Avery Letter Size','5263 Address / Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (397,'Avery Letter Size','5963 Address / Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (398,'Avery Letter Size','5164 Address / Shipping','S',12.7,3.96,84.67,101.6,84.67,106.36,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (399,'Avery Letter Size','5264 Address / Shipping','S',12.7,3.96,84.67,101.6,84.67,106.36,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (400,'Avery Letter Size','5168 Shipping','S',12.7,12.7,127.0,88.9,127.0,101.6,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (401,'Avery Letter Size','5667 Clear Return Address','S',12.7,7.62,12.7,44.45,12.7,52.07,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (402,'Avery Letter Size','5660 Clear Address','S',12.7,0.0,25.4,71.96,25.4,71.97,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (403,'Avery Letter Size','5930 Clear Address','S',12.7,0.0,25.4,71.96,25.4,71.97,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (404,'Avery Letter Size','5661 Clear Address','S',12.7,0.0,25.4,107.95,25.4,107.95,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (405,'Avery Letter Size','5662 Clear Address','S',21.21,0.0,33.86,107.95,33.86,107.95,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (406,'Avery Letter Size','5663 Clear Address','S',12.7,0.0,50.8,107.95,50.8,107.95,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (407,'Avery Letter Size','5664 Clear Address / Shipping','S',12.7,0.0,84.66,107.95,84.67,107.95,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (408,'Avery Letter Size','5165 Full Sheet','S',0.0,0.0,279.4,215.9,0.0,0.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (409,'Avery Letter Size','5265 Full Sheet','S',0.0,0.0,279.4,215.9,0.0,0.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (410,'Avery Letter Size','5266 File Folder-Assorted','S',12.7,13.49,13.74,87.33,17.15,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (411,'Avery Letter Size','5066 File Folder-Red','S',12.7,13.49,13.74,87.33,17.15,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (412,'Avery Letter Size','5166 File Folder-Orange','S',15.88,13.49,13.74,87.33,16.93,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (413,'Avery Letter Size','5366 File Folder-White','S',12.7,13.49,16.92,87.33,16.92,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (414,'Avery Letter Size','5666 File Folder-Purple','S',15.88,13.49,13.74,87.33,16.93,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (415,'Avery Letter Size','5766 File Folder-Blue','S',12.7,13.49,13.74,87.33,17.15,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (416,'Avery Letter Size','5866 File Folder-Green','S',12.7,13.49,13.74,87.33,17.15,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (417,'Avery Letter Size','5966 File Folder-Yellow','S',12.7,13.49,13.74,87.33,17.15,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (418,'Avery Letter Size','5293 Round','S',12.7,11.13,41.28,50.8,42.34,50.8,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (419,'Avery Letter Size','5294 Round','S',12.7,6.35,63.5,69.85,63.5,69.85,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (420,'Avery Letter Size','5196 3-1/2\" Diskette - White','S',12.7,3.18,69.85,69.85,76.2,69.85,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (421,'Avery Letter Size','5096 3-1/2\" Diskette - Red','S',38.1,3.18,44.45,69.85,76.2,69.85,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (422,'Avery Letter Size','5896 3-1/2\" Diskette - Blue','S',38.1,3.18,44.45,69.85,76.2,69.85,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (423,'Avery Letter Size','5197 5-1/4 Diskette - White','S',25.4,3.96,38.1,101.6,38.1,106.36,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (424,'Avery Letter Size','5198 Audio Cassette','S',12.7,12.7,42.34,88.9,42.33,101.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (425,'Avery Letter Size','5199 Video Cassette Face','S',23.29,27.15,46.56,77.8,46.57,83.82,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (426,'Avery Letter Size','5199 Video Cassette Spine','S',12.7,34.14,16.93,147.65,16.93,147.65,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (427,'Avery Letter Size','5925 White Laser Labels for Zip Disks (bottom spine)','S',87.88,60.33,7.14,95.25,83.82,95.25,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (428,'Avery Letter Size','5925 White Laser Labels for Zip Disks (face)','S',16.69,32.26,50.8,59.56,84.12,91.82,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (429,'Avery Letter Size','5925 White Laser Labels for Zip Disks (top spine)','S',73.66,60.33,7.14,95.25,83.82,95.25,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (430,'Avery Letter Size','5931 White CD/DVD Labels for Lasers (face)','S',17.46,49.21,117.48,117.48,127.0,0.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (431,'Avery Letter Size','5931 White CD/DVD Labels for Lasers (spines)','S',18.64,12.55,119.08,5.56,123.06,11.91,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (432,'Avery Letter Size','5970 Fluorescent Laser - Magenta','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (433,'Avery Letter Size','5971 Fluorescent Laser - Green','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (434,'Avery Letter Size','5972 Fluorescent Laser - Yellow','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (435,'Avery Letter Size','5975 Fluorescent Laser - Full Sheet Assorted','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (436,'Avery Letter Size','5979 Fluorescent Laser - Assorted','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (437,'Avery Letter Size','5980 Pastel Laser - Blue','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (438,'Avery Letter Size','5997 Videotape Face','S',23.29,27.15,46.56,77.8,46.57,83.82,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (439,'Avery Letter Size','5997 Videotape Spine','S',12.7,34.14,16.93,147.65,16.93,147.65,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (440,'Avery Letter Size','5998 Audio Tape','S',12.7,12.7,42.34,88.9,42.33,101.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (441,'Avery Letter Size','5395 Name Badge - White','S',14.82,17.48,59.26,85.73,63.5,95.25,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (442,'Avery Letter Size','5095 Name Badge - Red','S',20.65,22.23,51.32,77.79,63.5,95.25,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (443,'Avery Letter Size','5895 Name Badge - Blue','S',20.64,22.23,51.32,77.79,63.5,95.25,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (444,'Avery Letter Size','5371 Business Card - White','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (445,'Avery Letter Size','5871 Laser Business Card','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (446,'Avery Letter Size','5376 Business Card - Ivory','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (447,'Avery Letter Size','5377 Business Card - Gray','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (448,'Avery Letter Size','5911 Business Card','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (449,'Avery Letter Size','5383 Name Tag Kit','S',29.63,19.05,55.03,88.9,55.03,88.9,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (450,'Avery Letter Size','5390 Name Tag Refill','S',29.63,19.05,55.03,88.9,55.03,88.9,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (451,'Avery Letter Size','5883 Name Tag Kit - Blue','S',36.51,25.4,42.86,76.2,55.56,88.9,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (452,'Avery Letter Size','5384 Name Tag Kit','S',25.4,6.35,76.2,101.6,76.2,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (453,'Avery Letter Size','5392 Name Tag Refill','S',25.4,6.35,76.2,101.6,76.2,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (454,'Avery Letter Size','5385 Rotary Card - Small','S',29.63,6.35,55.03,101.6,55.03,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (455,'Avery Letter Size','5386 Rotary Card - Large','S',25.4,44.45,76.2,127.0,76.2,127.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (456,'Avery Letter Size','5388 Index Card','S',25.4,44.45,76.2,127.0,76.2,127.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (457,'Avery Letter Size','5389 Post Card','S',38.1,31.75,101.6,152.4,101.6,152.4,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (458,'Avery Letter Size','5305 Laser Tent Cards Med.','S',22.23,9.53,107.95,196.85,127.0,215.9,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (459,'Avery Letter Size','5309 Laser Tent Cards Large','S',28.58,9.53,158.75,260.35,177.8,279.4,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (460,'Avery Letter Size','5315 Laser Note Cards','S',0.0,0.0,215.9,139.7,0.0,139.7,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (461,'Avery Letter Size','5361 Laminated ID Cards','S',21.17,109.54,50.8,82.55,93.13,82.55,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (462,'Avery Letter Size','5361 Laminated ID Cards-Single Card','S',21.17,109.54,50.8,82.55,50.8,82.55,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (463,'Avery Letter Size','5362 Laminated Name Badges','S',21.17,109.54,50.8,82.55,93.13,82.55,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (464,'Avery Letter Size','5362 Laminated N. Badges-Single Card','S',21.17,109.54,50.8,82.55,50.8,82.55,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (465,'Avery Letter Size','5364 Laminated Rotary Index Cards','S',20.64,109.54,52.39,98.43,93.13,98.43,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (466,'Avery Letter Size','5364 Laminated Rotary Index-Single Card','S',20.64,109.54,52.39,98.43,52.4,98.43,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (467,'Avery Letter Size','74520 Name Badge Inserts - 3\" x 4\"','S',25.4,6.35,76.2,101.6,76.2,0.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (468,'Avery Letter Size','74540 Name Badge Inserts - 3\" x 4\"','S',25.4,6.35,76.2,101.6,76.2,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (469,'Avery Letter Size','74541 Name Badge Inserts - 3\" x 4\"','S',25.4,6.35,76.2,101.6,76.2,101.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (470,'Avery Letter Size','74550 Name Badge Inserts - 2 1/4\" x 3 1/2\"','S',26.99,9.53,56.36,88.9,56.36,0.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (471,'Avery Letter Size','74552 Name Badge Inserts - 2\" x 3\"','S',14.29,31.75,50.01,76.2,50.01,76.2,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (472,'Avery Letter Size','74558 Name Badge Inserts - 2\" x 3\"','S',15.9,31.75,50.01,76.2,50.01,76.2,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (473,'Avery Letter Size','74650 Name Badge Inserts - 2 1/4\" x 3 1/2\"','S',24.61,9.53,56.36,88.9,56.36,0.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (474,'Avery Letter Size','74651 Name Badge Inserts - 2 1/4\" x 3 1/2\"','S',26.99,9.53,56.36,88.9,56.36,0.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (475,'Avery Letter Size','8160 Ink Jet Address','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (476,'Avery Letter Size','8460 Ink Jet Address','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (477,'Avery Letter Size','8461 Ink Jet Address','S',12.7,3.96,25.4,101.6,25.4,106.38,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (478,'Avery Letter Size','8161 Ink Jet Address','S',12.7,3.96,25.4,101.6,25.4,106.36,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (479,'Avery Letter Size','8162 Ink Jet Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (480,'Avery Letter Size','8462 Ink Jet Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (481,'Avery Letter Size','8163 Ink Jet Address / Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (482,'Avery Letter Size','8463 Ink Jet Address / Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (483,'Avery Letter Size','8464 Ink Jet Address / Shipping','S',12.7,3.96,84.67,101.6,84.67,106.36,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (484,'Avery Letter Size','8923 Ink Jet Address / Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (485,'Avery Letter Size','8164 Ink Jet Address / Shipping','S',12.7,3.96,84.67,101.6,84.67,106.36,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (486,'Avery Letter Size','8165 Ink Jet Full Sheet','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (487,'Avery Letter Size','8465 Ink Jet Full Sheet','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (488,'Avery Letter Size','8166 Ink Jet File Folder-Assorted','S',12.7,13.49,13.74,87.33,17.15,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (489,'Avery Letter Size','8366 Ink Jet File Folder-White','S',12.7,13.49,16.94,87.33,16.94,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (490,'Avery Letter Size','8167 Ink Jet Return Address','S',12.7,7.14,12.7,44.45,12.7,52.4,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (491,'Avery Letter Size','8196 Ink Jet 3-1/2\" Diskette','S',12.7,3.18,69.85,69.85,76.2,69.85,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (492,'Avery Letter Size','8250 Ink Jet Label for Color Printing','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (493,'Avery Letter Size','8252 Ink Jet Label for Color Printing','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (494,'Avery Letter Size','8253 Ink Jet Label for Color Printing','S',12.7,4.32,50.8,101.6,50.8,105.66,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (495,'Avery Letter Size','8254 Ink Jet Label for Color Printing','S',12.7,3.96,84.67,101.6,84.67,106.36,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (496,'Avery Letter Size','8255 Ink Jet Label for Color Printing ','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (497,'Avery Letter Size','8257 Ink Jet Return Address for Color Printing','S',15.88,9.53,19.05,57.15,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (498,'Avery Letter Size','8309 Tent Card Large','S',31.75,12.7,152.4,254.0,177.8,279.4,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (499,'Avery Letter Size','8315 Ink Jet Note Cards','S',0.0,0.0,215.9,139.7,0.0,139.7,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (500,'Avery Letter Size','8316 Ink Jet Greeting Card (Portrait)*','S',0.0,0.0,139.7,215.9,139.7,215.9,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (501,'Avery Letter Size','8316 Ink Jet Greeting Card (Landscape)*','S',0.0,0.0,215.9,139.7,215.9,139.7,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (502,'Avery Letter Size','8324 Ink Jet Brochures','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (503,'Avery Letter Size','8371 Ink Jet Business Card','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (504,'Avery Letter Size','8385 Rotary Card - Small','S',29.63,6.35,55.04,101.6,55.04,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (505,'Avery Letter Size','8387 Ink Jet Postcard - 4-up','S',0.0,0.0,107.95,139.7,107.95,139.7,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (506,'Avery Letter Size','8388 Index Card','S',25.4,44.45,76.2,127.0,76.2,127.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (507,'Avery Letter Size','8871 Clean Edge Business Cards (IJ)','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (508,'Avery Letter Size','8376 Ink Jet Business Card - Ivory','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (509,'Avery Letter Size','8377 Ink Jet Business Card - Gray','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (510,'Avery Letter Size','8660 Ink Jet Clear Address','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (511,'Avery Letter Size','8662 Ink Jet Clear Address','S',21.17,3.96,33.87,101.6,33.87,106.36,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (512,'Avery Letter Size','8663 Ink Jet Clear Address/Shipping','S',12.7,3.96,50.8,101.6,50.8,106.36,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (513,'Avery Letter Size','8665 Ink Jet Clear Full Sheet','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (514,'Avery Letter Size','8667 Ink Jet Clear Address Labels','S',12.7,7.14,12.7,44.45,12.7,52.4,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (515,'Avery Letter Size','8925 White Inkjet Labels for Zip Disks (bottom spine)','S',87.88,60.33,7.14,95.25,83.82,95.25,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (516,'Avery Letter Size','8925 White Inkjet Labels for Zip Disks (face)','S',16.69,32.26,50.8,59.56,84.12,91.82,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (517,'Avery Letter Size','8925 White Inkjet Labels for Zip Disks (top spine)','S',73.66,60.33,7.14,95.25,83.82,95.25,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (518,'Avery Letter Size','8931 White CD/DVD Jewel Case Insert (spines)','S',15.88,33.34,117.48,6.35,117.48,142.88,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (519,'Avery Letter Size','8931 White CD/DVD Jewel Case Inserts (cover)','S',142.88,47.63,120.65,120.65,120.65,120.65,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (520,'Avery Letter Size','8931 White CD/DVD Jewel Case Inserts (tray)','S',15.88,39.69,117.48,136.53,117.48,136.53,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (521,'Avery Letter Size','8931 White CD/DVD Labels for Inkjet Printers','S',17.46,49.21,117.48,117.48,127.0,0.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (522,'Avery Letter Size','11161 Ready Index ExtraWide 5 Tab','S',15.88,127.0,47.63,76.2,50.8,76.2,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (523,'Avery Letter Size','11163 Ready Index ExtraWide 8 Tab','S',22.23,127.0,28.58,76.2,30.96,76.2,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (524,'Avery Letter Size','11165 Ready Index ExtraWide 10 Tab','S',15.88,127.0,22.23,76.2,25.4,76.2,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (525,'Avery Letter Size','11526 Direct Print Custom Dividers 5 Tab Single Set','S',6.35,12.7,12.7,44.45,12.7,52.39,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (526,'Avery Letter Size','11527 Direct Print Custom Dividers 8 Tab Single Set','S',6.35,12.7,12.7,28.58,12.7,32.2,8,1, NULL, NULL ) +INSERT INTO label_def VALUES (527,'Avery Letter Size','11171 Easy Edit Ready Index - 5 Tabs','S',15.88,127.0,47.63,76.2,50.8,76.2,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (528,'Avery Letter Size','11172 Easy Edit Ready Index - 8 Tabs','S',22.1,127.0,28.58,76.2,30.86,76.2,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (529,'Avery Letter Size','11173 Easy Edit Ready Index - 10 Tabs','S',15.88,127.0,22.23,76.2,25.4,76.2,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (530,'Avery Letter Size','11251 Clear Label/Index Maker Presentation Kit 5 Tab','S',12.7,7.62,12.7,44.45,12.7,52.07,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (531,'Avery Letter Size','11251 Clear Label/Index Maker Spine Label 1/4\" or 5/16\"','S',50.8,9.83,6.35,92.08,6.35,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (532,'Avery Letter Size','11251 Clear Label/Index Maker Spine Label 3/8\" or 1/2\"','S',88.9,9.83,9.53,92.08,9.53,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (533,'Avery Letter Size','11251 Clear Label/Index Maker Spine Label 5/8\" or 3/4\"','S',133.35,9.83,15.88,92.08,15.88,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (534,'Avery Letter Size','11251 Clear Label/Index Maker Spine Label 1\" or Larger','S',190.5,9.83,25.4,92.08,25.4,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (535,'Avery Letter Size','11253 Clear Label/Index Maker Narrow 5 Tab','S',12.7,7.62,6.35,44.45,12.7,52.07,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (536,'Avery Letter Size','11253 Clear Label/Index Maker Spine Label 1/4\" or 5/16\"','S',50.8,9.83,6.35,92.08,6.35,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (537,'Avery Letter Size','11253 Clear Label/Index Maker Spine Label 3/8\" or 1/2\"','S',88.9,9.83,9.53,92.08,9.53,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (538,'Avery Letter Size','11253 Clear Label/Index Maker Spine Label 5/8\" or 3/4\"','S',133.35,9.83,15.88,92.08,15.88,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (539,'Avery Letter Size','11253 Clear Label/Index Maker Spine Label 1\" or Larger','S',190.5,9.83,25.4,92.08,25.4,104.14,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (540,'Avery Letter Size','11260 Ready Index Landscape - 5 Tabs','S',30.48,35.56,29.97,83.31,35.56,83.31,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (541,'Avery Letter Size','11261 Ready Index Landscape - 8 Tabs','S',30.48,33.02,17.02,88.9,22.1,88.9,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (542,'Avery Letter Size','12260 Ready Index Landscape - 5 Tabs','S',30.48,35.56,29.97,83.31,35.56,83.31,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (543,'Avery Letter Size','12261 Ready Index Landscape - 8 Tabs','S',30.48,33.02,17.02,88.9,22.1,88.9,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (544,'Avery Letter Size','Index Maker 3 Tab','S',12.7,12.7,12.7,79.38,12.7,111.13,2,20, NULL, NULL ) +INSERT INTO label_def VALUES (545,'Avery Letter Size','Index Maker 5 Tab','S',12.7,7.62,12.7,44.45,12.7,52.07,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (546,'Avery Letter Size','Index Maker 8 Tab','S',12.7,12.7,12.7,28.58,12.7,53.98,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (547,'Avery Letter Size','Hidden Tab 5 Tab','S',15.88,127.0,47.63,76.2,50.8,76.2,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (548,'Avery Letter Size','Hidden Tab 8 Tab','S',22.23,127.0,28.58,76.2,30.96,76.2,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (549,'Avery Letter Size','Hidden Tab 10 Tab','S',15.88,127.0,22.23,76.2,25.4,76.2,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (550,'Avery Letter Size','Prof. Ready Index Spine Insert 1\"','S',25.4,19.05,15.88,241.3,15.88,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (551,'Avery Letter Size','Prof. Ready Index Spine Insert 1 1/2\"','S',50.8,19.05,22.23,241.3,22.23,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (552,'Avery Letter Size','Prof. Ready Index Spine Insert 2\"','S',87.31,19.05,31.75,241.3,31.75,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (553,'Avery Letter Size','Prof. Ready Index Spine Insert 3\"','S',134.94,19.05,50.8,241.3,50.8,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (554,'Avery Letter Size','Ready Index 5 Tab','S',15.88,127.0,47.63,76.2,50.8,76.2,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (555,'Avery Letter Size','Ready Index 8 Tab','S',22.23,127.0,28.58,76.2,30.96,76.2,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (556,'Avery Letter Size','Ready Index 10 Tab','S',15.88,127.0,22.23,76.2,25.4,76.2,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (557,'Avery Letter Size','Ready Index 12 Tab','S',12.7,127.0,21.27,76.2,21.27,76.2,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (558,'Avery Letter Size','Ready Index 15 Tab','S',23.81,127.0,11.91,76.2,15.88,76.2,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (559,'Avery Letter Size','WorkSaver Divider 5 Tabs','S',29.63,57.15,8.47,50.8,8.47,50.8,2,26, NULL, NULL ) +INSERT INTO label_def VALUES (560,'Avery Letter Size','WorkSaver Divider 8 Tabs','S',29.63,69.85,8.47,38.1,8.47,38.1,2,26, NULL, NULL ) +INSERT INTO label_def VALUES (561,'Avery Letter Size','WorkSaver Inserts 1/3 Cut','S',25.4,19.05,12.7,177.8,12.7,177.8,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (562,'Avery Letter Size','WorkSaver Inserts 1/5 Cut','S',25.4,6.35,12.7,101.6,12.7,101.6,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (563,'Avery Letter Size','Self Adhesive Index Tab 1\"','S',12.7,25.4,8.64,50.8,8.64,50.8,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (564,'Avery Letter Size','Self Adhesive Index Tab 1 1/2\"','S',12.7,12.7,8.64,76.2,8.64,76.2,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (565,'Avery Letter Size','Self Adhesive Index Tab 2\"','S',12.7,3.18,8.64,101.6,8.64,101.6,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (566,'Avery Letter Size','Protect n Tab - 5 Tab','S',19.05,136.53,16.54,53.98,16.54,53.98,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (567,'Avery Letter Size','Protect n Tab - 8 Tab','S',7.94,152.4,16.54,34.93,16.54,34.93,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (568,'Avery Letter Size','TitleFrames Asst.Spines Insert 1\"','S',25.4,19.05,15.88,241.3,15.88,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (569,'Avery Letter Size','TitleFrames Asst.Spines Insert 1 1/2\"','S',50.8,19.05,22.23,241.3,22.23,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (570,'Avery Letter Size','TitleFrames Asst.Spines Insert 2\"','S',87.31,19.05,31.75,241.3,31.75,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (571,'Avery Letter Size','TitleFrames Asst. Spines Insert 3\"','S',134.94,19.05,50.8,241.3,50.8,241.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (572,'Avery Letter Size','TitleFrames Cover - 1\"','S',12.7,12.7,254.0,190.5,254.0,190.5,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (573,'Avery Letter Size','TitleFrames Spine - 1\"','S',36.53,12.7,15.88,254.0,25.4,254.0,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (574,'Avery Letter Size','TitleFrames Cover - 1 1/2\"','S',12.7,12.7,254.0,190.5,254.0,190.5,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (575,'Avery Letter Size','TitleFrames Spine - 1 1/2\"','S',39.7,12.7,22.23,254.0,38.1,254.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (576,'Avery Letter Size','2160 Addressing','S',12.7,20.57,25.4,66.8,25.4,66.8,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (577,'Avery Letter Size','2162 Addressing','S',12.7,3.18,33.87,101.6,33.87,101.6,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (578,'Avery Letter Size','2163 Address/Shipping','S',12.7,3.18,50.8,101.6,50.8,101.6,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (579,'Avery Letter Size','2164 Shipping','S',21.43,3.18,84.14,101.6,127.0,101.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (580,'Avery Letter Size','2180 File Folder-Assorted','S',12.7,10.29,13.74,87.38,17.15,87.38,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (581,'Avery Letter Size','2181 File Folder-White','S',12.7,10.29,16.92,87.38,17.15,87.38,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (582,'Avery Letter Size','2186 3.5\" Diskette-White','S',12.7,19.05,50.8,69.85,50.8,69.85,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (583,'Avery Letter Size','6490 Remove Em 3.5\" Diskette-Face Only Labels','S',12.7,3.18,50.8,68.26,50.8,70.66,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (584,'Avery Letter Size','6466 Remove Em File Folder Labels','S',12.7,13.49,16.94,87.33,16.94,101.6,2,15, NULL, NULL ) +INSERT INTO label_def VALUES (585,'Avery Letter Size','6460 Remove Em Address Labels','S',12.7,4.78,25.4,66.68,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (586,'Avery Letter Size','6464 Remove Em Shipping Labels','S',12.7,3.96,84.66,101.6,84.67,106.36,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (587,'Avery Letter Size','6465 Removable Laser - Full Sheet','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (588,'Avery Letter Size','6467 Removable Laser - Small Multi-Purpose','S',12.7,7.14,12.7,44.45,12.7,52.4,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (589,'Avery Letter Size','6503 Remove em white laser 8 1/2\" x 11\"','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (590,'Avery Letter Size','5824 CD-Recordable Labels','S',12.7,50.8,114.3,114.3,139.7,114.3,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (591,'Avery Letter Size','5836 MtgCreator Portfolio Label','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (592,'Avery Letter Size','5836 MtgCreator Divider 5 Tab','S',12.7,7.62,12.7,44.45,12.7,52.07,4,20, NULL, NULL ) +INSERT INTO label_def VALUES (593,'Avery Letter Size','3111 Square Stickers','S',31.75,7.95,63.5,63.5,76.2,68.26,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (594,'Avery Letter Size','3112 Small Round Stickers','S',19.05,12.7,38.1,38.1,50.8,50.8,4,5, NULL, NULL ) +INSERT INTO label_def VALUES (595,'Avery Letter Size','3114 Full Page Stickers','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (596,'Avery Letter Size','3248 Glossy Photo Quality Postcard','S',31.75,31.75,101.6,152.4,114.3,152.4,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (597,'Avery Letter Size','3251 Feather Edge Greeting Card','S',0.0,0.0,139.7,215.9,139.7,215.9,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (598,'Avery Letter Size','3252 Vellum Overlay Greeting Card','S',0.0,0.0,139.7,215.9,139.7,215.9,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (599,'Avery Letter Size','3254 Glossy Photo Quality Print-to-the-Edge Greeting Card','S',15.88,20.64,123.83,174.63,123.83,174.63,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (600,'Avery Letter Size','3256 White Embossed Note Cards','S',12.7,12.7,114.3,82.55,139.7,107.95,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (601,'Avery Letter Size','3259 Ivory Embossed Note Card','S',12.7,12.7,114.3,82.55,139.7,107.95,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (602,'Avery Letter Size','3260 Ivory Embossed Half-Fold Card','S',19.05,19.05,101.6,177.8,139.7,177.8,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (603,'Avery Letter Size','3261 White Large Labels','S',28.58,9.53,31.75,95.25,38.1,101.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (604,'Avery Letter Size','3261 White Small Labels','S',28.58,9.53,31.75,60.33,38.1,68.26,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (605,'Avery Letter Size','3261 White Return Address Labels','S',15.88,9.53,19.05,57.15,25.4,69.85,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (606,'Avery Letter Size','3263 White Postcard','S',0.0,0.0,107.95,139.7,107.95,139.7,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (607,'Avery Letter Size','3265 White Half-Fold Card','S',0.0,0.0,139.7,215.9,139.7,215.9,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (608,'Avery Letter Size','3266 White Quarter-Fold Card','S',0.0,0.0,139.7,107.95,139.7,107.95,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (609,'Avery Letter Size','3268 White Note Card','S',0.0,0.0,139.7,107.95,139.7,107.95,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (610,'Avery Letter Size','3274 White Big Round Stickers','S',31.75,7.94,63.5,63.5,76.2,68.26,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (611,'Avery Letter Size','3274 White Small Round Stickers','S',19.05,12.7,38.1,38.1,50.8,50.8,4,5, NULL, NULL ) +INSERT INTO label_def VALUES (612,'Avery Letter Size','3274 White Square Stickers','S',31.75,7.94,63.5,63.5,76.2,68.26,3,3, NULL, NULL ) +INSERT INTO label_def VALUES (613,'Avery Letter Size','3269 Glossy Photo Quality Half-Fold Cards','S',0.0,0.0,139.7,215.9,139.7,215.9,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (614,'Avery Letter Size','8313 Glossy Photo Quality 4\" x 6\" Card','S',0.0,0.0,101.6,152.4,101.6,152.4,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (615,'Avery Letter Size','8314 Glossy Photo Quality 8-1/2\" x 11\" Card','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (616,'Avery Letter Size','8373 Glossy Photo Quality Business Card','S',19.05,12.7,50.8,88.9,63.5,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (617,'Avery Letter Size','8389 Glossy Photo Quality Postcard','S',31.75,31.75,101.6,152.4,114.3,152.4,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (618,'Avery Letter Size','8763 Glossy Photo Quality Labels','S',12.7,3.96,50.8,101.6,50.8,106.38,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (619,'Avery Letter Size','8769 Glossy Photo Quality Labels','S',28.58,9.53,31.75,95.25,38.1,101.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (620,'Avery Letter Size','3273 White Print-to-the-Edge Greeting Cards','S',15.88,20.64,123.83,174.63,123.83,174.63,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (621,'Avery Letter Size','3277 Textured Canvas for Ink Jet Printers','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (622,'Avery Letter Size','8317 Embossed Ink Jet Note Card - Ivory','S',12.7,12.7,114.3,82.55,139.7,107.95,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (623,'Avery Letter Size','8384 Photo Quality Brochures','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (624,'Avery Letter Size','53220 Glossy 4x6 Photo Paper','S',31.75,31.75,101.6,152.4,114.3,152.4,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (625,'Avery Letter Size','53221 Glossy 5x7 Photo Paper','S',6.35,20.65,123.83,174.63,128.59,174.63,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (626,'Avery Letter Size','5881 Color Laser Business Cards','S',19.05,12.7,50.8,88.9,63.5,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (627,'Avery Letter Size','5884 Glossy Color Laser Brochures','S',0.0,0.0,279.4,215.9,279.4,215.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (628,'Avery Letter Size','5889 Color Laser Postcards','S',31.75,31.75,101.6,152.4,114.3,152.4,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (629,'Avery Letter Size','8877 Ink Jet Business Card - Gray','S',12.7,19.05,50.8,88.9,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (630,'Avery Letter Size','6873 Color Laser Address Labels','S',28.58,9.53,50.8,95.25,57.15,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (631,'Avery Letter Size','6879 Color Laser Address Labels','S',28.58,9.53,31.75,95.25,38.1,101.6,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (632,'Avery Letter Size','4207 Price Marking','C',0.0,12.7,9.53,38.1,12.7,40.64,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (633,'Avery Letter Size','4144 Address','C',0.0,21.59,23.81,63.5,25.4,66.04,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (634,'Avery Letter Size','4021 Address','C',0.0,11.43,23.81,76.2,25.4,78.74,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (635,'Avery Letter Size','4145 Address','C',0.0,12.7,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (636,'Avery Letter Size','4013 Address','C',0.0,9.53,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (637,'Avery Letter Size','R-4013 Address','C',0.0,9.53,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (638,'Avery Letter Size','4030 Address','C',0.0,11.43,23.81,88.9,25.4,91.44,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (639,'Avery Letter Size','4031 Address','C',0.0,8.89,23.81,88.9,25.4,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (640,'Avery Letter Size','4029 Address','C',0.0,11.43,23.81,88.9,25.4,91.44,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (641,'Avery Letter Size','4060 Address','C',0.0,9.53,36.51,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (642,'Avery Letter Size','4065 Address','C',0.0,12.7,23.81,101.6,25.4,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (643,'Avery Letter Size','4143 Address','C',0.0,16.51,23.81,101.6,25.4,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (644,'Avery Letter Size','4066 Address','C',0.0,8.89,23.81,101.6,25.4,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (645,'Avery Letter Size','4146 Address','C',0.0,9.53,36.51,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (646,'Avery Letter Size','4014 Address','C',0.0,9.53,36.51,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (647,'Avery Letter Size','4032 Address','C',0.0,8.89,36.51,101.6,38.1,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (648,'Avery Letter Size','4033 Address','C',0.0,8.89,36.51,101.6,38.1,104.14,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (649,'Avery Letter Size','4022 Address','C',0.0,12.7,49.21,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (650,'Avery Letter Size','4162 Address-Clear','C',0.0,9.53,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (651,'Avery Letter Size','4601 Address-Clear','C',0.0,9.53,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (652,'Avery Letter Size','4161 Shipping-Red Border','C',0.0,9.53,74.61,101.6,76.2,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (653,'Avery Letter Size','4088 Shipping','C',0.0,9.53,74.61,107.95,76.2,107.95,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (654,'Avery Letter Size','4076 Shipping','C',0.0,9.53,74.61,127.0,76.2,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (655,'Avery Letter Size','4110 Shipping','C',0.0,9.53,74.61,146.05,76.2,146.05,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (656,'Avery Letter Size','4027 File Folder / Address','C',0.0,9.53,11.11,88.9,12.7,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (657,'Avery Letter Size','4255 File Folder','C',0.0,12.7,11.11,88.9,12.7,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (658,'Avery Letter Size','4266 File Folder-Assorted','C',0.0,12.7,11.11,88.9,12.7,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (659,'Avery Letter Size','4163 Piggyback','C',0.0,9.53,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (660,'Avery Letter Size','4160 Name Badge','C',0.0,9.53,61.91,88.9,63.5,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (661,'Avery Letter Size','4241 3-1/2\" Diskette','C',0.0,22.23,69.85,69.85,76.2,69.85,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (662,'Avery Letter Size','4166 Index Card','C',0.0,12.7,76.2,127.0,76.2,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (663,'Avery Letter Size','4167 Post Card','C',0.0,12.7,88.9,152.4,88.9,152.4,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (664,'Avery Letter Size','4037 Address','C',0.0,8.89,23.81,63.5,25.4,66.04,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (665,'Avery Letter Size','4020 Address','C',0.0,12.7,23.81,76.2,25.4,76.2,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (666,'Avery Letter Size','4109 Address','C',0.0,16.51,23.81,83.82,25.4,86.36,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (667,'Avery Letter Size','4018 Address - Removable','C',0.0,9.53,23.81,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (668,'Avery Letter Size','4062 Address','C',0.0,8.89,36.51,88.9,38.1,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (669,'Avery Letter Size','4035 Address','C',0.0,9.53,49.21,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (670,'Avery Letter Size','4052 Data Storage','C',0.0,9.53,46.04,98.43,50.8,98.43,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (671,'Avery Letter Size','4067 Address','C',0.0,8.89,23.81,101.6,25.4,104.14,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (672,'Avery Letter Size','4019 Address - Removable','C',0.0,9.53,36.51,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (673,'Avery Letter Size','4015 Address','C',0.0,12.7,23.81,127.0,25.4,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (674,'Avery Letter Size','4090 Address','C',0.0,12.7,49.21,127.0,50.8,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (675,'Avery Letter Size','4043 Shipping','C',0.0,12.7,77.79,139.7,84.67,139.7,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (676,'Avery Zweckform','2493 Inkjet-Photo-Papier blanko','S',12.5,17.5,90.0,129.5,95.0,132.5,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (677,'Avery Zweckform','2494 Inkjet-Photo-Papier blanko','S',24.25,30.0,100.0,150.0,148.5,150.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (678,'Avery Zweckform','2495 Inkjet-Photo-Papier blanko','S',17.5,15.0,129.5,180.0,132.5,180.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (679,'Avery Zweckform','32010 Visitenkarten blanko','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (680,'Avery Zweckform','32011 Visitenkarten blanko schnittgestanzt','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (681,'Avery Zweckform','32012 Visitenkarten blanko schnittgestanzt','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (682,'Avery Zweckform','32014 Inkjet-Visitenkarten blanko','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (683,'Avery Zweckform','32017 Doppel-Visitenkarten blanko','S',13.5,20.0,54.0,170.0,54.0,170.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (684,'Avery Zweckform','32020 Visitenkarten marmoriert','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (685,'Avery Zweckform','32021 Visitenkarten marmoriert','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (686,'Avery Zweckform','32022 Visitenkarten marmoriert','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (687,'Avery Zweckform','32023 Visitenkarten marmoriert','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (688,'Avery Zweckform','32029 Visitenkarten blanko Glossy','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (689,'Avery Zweckform','32030 Visitenkarten Blue Wave','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (690,'Avery Zweckform','32031 Visitenkarten Paradise','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (691,'Avery Zweckform','32032 Visitenkarten Sahara','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (692,'Avery Zweckform','32036 Visitenkarten Cosmic','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (693,'Avery Zweckform','32040 Visitenkarten blanko','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (694,'Avery Zweckform','32060 Inkjet Bütten-Papier Cream','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (695,'Avery Zweckform','32061 Inkjet Bütten-Papier Aqua','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (696,'Avery Zweckform','32062 Inkjet Bütten-Papier Jade','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (697,'Avery Zweckform','32063 Inkjet Bütten-Papier Sand','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (698,'Avery Zweckform','32064 Inkjet-Papier Leinenstruktur','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (699,'Avery Zweckform','32065 Inkjet-Papier Hammerschlag','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (700,'Avery Zweckform','32080 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (701,'Avery Zweckform','32081 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (702,'Avery Zweckform','32082 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (703,'Avery Zweckform','32083 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (704,'Avery Zweckform','32098 Urkunde marmoriert Text rot','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (705,'Avery Zweckform','32099 Urkunde marmoriert Text gold','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (706,'Avery Zweckform','32250 CD-Einleger blanko','S',24.0,29.5,249.0,151.0,249.0,151.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (707,'Avery Zweckform','32251 Inkjet-CD-Einleger','S',24.0,29.5,249.0,151.0,249.0,151.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (708,'Avery Zweckform','32252 Postkarte blanko','S',0.0,0.0,105.0,148.5,105.0,148.5,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (709,'Avery Zweckform','32253 Tischkarte blanko','S',25.0,38.5,80.0,110.0,80.0,110.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (710,'Avery Zweckform','32254 Karteikarte blanko','S',8.5,0.0,70.0,105.0,70.0,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (711,'Avery Zweckform','32255 Cassetten-Einleger blanko','S',27.0,23.75,156.0,101.0,156.0,101.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (712,'Avery Zweckform','32256 Video-Einleger blanko','S',10.0,19.5,190.0,258.0,190.0,258.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (713,'Avery Zweckform','32257 Tischkarte lang blanko','S',8.5,0.0,140.0,210.0,140.0,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (714,'Avery Zweckform','32258 Regalschilder','S',15.5,0.0,38.0,105.0,38.0,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (715,'Avery Zweckform','32286 Inkjet-Glückwunschkarten blanko','S',0.0,0.0,210.0,297.0,210.0,297.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (716,'Avery Zweckform','32287 Inkjet-Glückwunschkarten blanko','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (717,'Avery Zweckform','32288 Inkjet-Glückwunschkarten blanko','S',27.0,40.5,156.0,216.0,156.0,216.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (718,'Avery Zweckform','32289 Inkjet-Glückwunschkarten blanko','S',0.0,0.0,210.0,297.0,210.0,297.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (719,'Avery Zweckform','C9312 Glossy Visitenkarten schnittgestanzt','S',31.5,17.0,54.0,85.0,60.0,91.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (720,'Avery Zweckform','3415 Kreise','S',13.43,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (721,'Avery Zweckform','3416 Kreise','S',17.93,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (722,'Avery Zweckform','3418 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,296.86,200.0,296.86,200.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (723,'Avery Zweckform','3420 Inkjet+Laser+Kopier-Etiketten','S',4.78,0.0,16.9,70.0,16.9,70.0,3,17, NULL, NULL ) +INSERT INTO label_def VALUES (724,'Avery Zweckform','3421 Inkjet+Laser+Kopier-Etiketten','S',8.73,0.0,25.4,70.0,25.4,70.0,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (725,'Avery Zweckform','3422 Inkjet+Laser+Kopier-Etiketten','S',8.43,0.0,35.0,70.0,35.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (726,'Avery Zweckform','3423 Inkjet+Laser+Kopier-Etiketten','S',8.43,0.0,35.0,105.0,35.0,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (727,'Avery Zweckform','3424 Inkjet+Laser+Kopier-Etiketten','S',4.43,0.0,48.0,105.0,48.0,105.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (728,'Avery Zweckform','3425 Inkjet+Laser+Kopier-Etiketten','S',5.93,0.0,57.0,105.0,57.0,105.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (729,'Avery Zweckform','3426 Inkjet+Laser+Kopier-Etiketten','S',8.43,0.0,70.0,105.0,70.0,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (730,'Avery Zweckform','3427 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,74.2,105.0,74.2,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (731,'Avery Zweckform','3448 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (732,'Avery Zweckform','3449 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (733,'Avery Zweckform','3450 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (734,'Avery Zweckform','3451 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (735,'Avery Zweckform','3452 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,105.0,37.1,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (736,'Avery Zweckform','3453 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,105.0,37.1,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (737,'Avery Zweckform','3454 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,105.0,37.1,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (738,'Avery Zweckform','3455 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,105.0,37.1,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (739,'Avery Zweckform','3456 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (740,'Avery Zweckform','3457 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (741,'Avery Zweckform','3458 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (742,'Avery Zweckform','3459 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (743,'Avery Zweckform','3470 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (744,'Avery Zweckform','3471 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (745,'Avery Zweckform','3472 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (746,'Avery Zweckform','3473 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (747,'Avery Zweckform','3474 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (748,'Avery Zweckform','3475 Inkjet+Laser+Kopier-Etiketten','S',4.43,0.0,36.0,70.0,36.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (749,'Avery Zweckform','3477 Inkjet+Laser+Kopier-Etiketten','S',4.93,0.0,41.0,105.0,41.0,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (750,'Avery Zweckform','3478 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (751,'Avery Zweckform','3479 Inkjet+Laser+Kopier-Etiketten','S',4.43,0.0,32.0,70.0,32.0,70.0,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (752,'Avery Zweckform','3481 Inkjet+Laser+Kopier-Etiketten','S',4.93,0.0,41.0,70.0,41.0,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (753,'Avery Zweckform','3483 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (754,'Avery Zweckform','3484 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,37.1,105.0,37.1,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (755,'Avery Zweckform','3489 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,29.69,70.0,29.69,70.0,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (756,'Avery Zweckform','3490 Inkjet+Laser+Kopier-Etiketten','S',4.43,0.0,36.0,70.0,36.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (757,'Avery Zweckform','3651 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,29.69,52.5,29.69,52.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (758,'Avery Zweckform','3652 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,42.41,70.0,42.41,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (759,'Avery Zweckform','3653 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,42.41,105.0,42.41,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (760,'Avery Zweckform','3654 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (761,'Avery Zweckform','3655 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,148.43,210.0,148.43,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (762,'Avery Zweckform','3657 Inkjet+Laser+Kopier-Etiketten','S',21.43,8.0,25.4,48.5,25.4,48.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (763,'Avery Zweckform','3658 Inkjet+Laser+Kopier-Etiketten','S',13.23,8.1,33.8,64.6,33.8,64.6,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (764,'Avery Zweckform','3659 Inkjet+Laser+Kopier-Etiketten','S',21.53,8.0,42.3,97.0,42.3,97.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (765,'Avery Zweckform','3660 Inkjet+Laser+Kopier-Etiketten','S',13.03,8.0,67.7,97.0,67.7,97.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (766,'Avery Zweckform','3661 Inkjet+Laser+Kopier-Etiketten','S',13.03,0.0,67.7,70.0,67.7,70.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (767,'Avery Zweckform','3662 Ordnerrücken-Etiketten schmal','S',9.0,12.43,192.0,34.0,192.0,34.0,8,1, NULL, NULL ) +INSERT INTO label_def VALUES (768,'Avery Zweckform','3663 Ordnerrücken-Etiketten breit','S',9.0,30.43,192.0,59.0,192.0,59.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (769,'Avery Zweckform','3664 Inkjet+Laser+Kopier-Etiketten','S',13.23,0.0,33.8,70.0,33.8,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (770,'Avery Zweckform','3665 Inkjet+Laser+Kopier-Etiketten','S',13.23,0.0,33.8,105.0,33.8,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (771,'Avery Zweckform','3666 Inkjet+Laser+Kopier-Etiketten','S',10.63,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (772,'Avery Zweckform','3667 Inkjet+Laser+Kopier-Etiketten','S',13.23,8.0,16.9,48.5,16.9,48.5,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (773,'Avery Zweckform','3668 Inkjet+Laser+Kopier-Etiketten','S',0.0,0.0,21.2,52.5,21.2,52.5,4,14, NULL, NULL ) +INSERT INTO label_def VALUES (774,'Avery Zweckform','3669 Inkjet+Laser+Kopier-Etiketten','S',21.43,0.0,50.8,70.0,50.8,70.0,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (775,'Avery Zweckform','3674 Computer-Etiketten','S',1.22,14.36,14.5,25.4,16.93,27.94,3,12, NULL, NULL ) +INSERT INTO label_def VALUES (776,'Avery Zweckform','3675 Computer-Etiketten','S',1.2,15.63,23.0,38.1,25.4,40.64,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (777,'Avery Zweckform','3676 Computer-Etiketten','S',1.23,13.03,18.7,48.2,21.17,50.74,2,9, NULL, NULL ) +INSERT INTO label_def VALUES (778,'Avery Zweckform','3677 Computer-Etiketten für 3 5\" Disk.','S',1.19,19.25,69.6,71.5,71.97,71.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (779,'Avery Zweckform','3684 Computer-Etiketten für 3 5\" Disk.','S',1.19,19.25,69.6,71.5,71.97,71.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (780,'Avery Zweckform','3685 Computer-Etiketten für 3 5\" Disk.','S',1.19,19.25,69.6,71.5,71.97,71.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (781,'Avery Zweckform','3686 Computer-Etiketten für 3 5\" Disk.','S',1.19,19.25,69.6,71.5,71.97,71.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (782,'Avery Zweckform','3687 Computer-Etiketten für 3 5\" Disk.','S',1.19,19.25,69.6,71.5,71.97,71.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (783,'Avery Zweckform','3688 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (784,'Avery Zweckform','3689 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (785,'Avery Zweckform','3691 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (786,'Avery Zweckform','3692 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (787,'Avery Zweckform','3693 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (788,'Avery Zweckform','3694 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (789,'Avery Zweckform','3696 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (790,'Avery Zweckform','3697 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (791,'Avery Zweckform','3698 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (792,'Avery Zweckform','3699 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (793,'Avery Zweckform','4720 Transparente Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (794,'Avery Zweckform','4721 Transparente Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (795,'Avery Zweckform','4722 Transparente Etiketten','S',21.43,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (796,'Avery Zweckform','4723 Transparente Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (797,'Avery Zweckform','4730 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',13.43,4.67,10.0,17.78,10.0,20.32,10,27, NULL, NULL ) +INSERT INTO label_def VALUES (798,'Avery Zweckform','4731 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (799,'Avery Zweckform','4732 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',12.99,11.02,16.93,35.56,16.93,38.1,5,16, NULL, NULL ) +INSERT INTO label_def VALUES (800,'Avery Zweckform','4733 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (801,'Avery Zweckform','4734 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',0.0,0.0,148.43,210.0,148.43,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (802,'Avery Zweckform','4735 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (803,'Avery Zweckform','4736 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (804,'Avery Zweckform','4737 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (805,'Avery Zweckform','4738 Disketten-Etiketten Stick+Lift','S',21.43,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (806,'Avery Zweckform','4739 Disketten-Etiketten Stick+Lift','S',21.43,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (807,'Avery Zweckform','4740 Disketten-Etiketten Stick+Lift','S',12.97,25.0,67.73,70.0,67.73,90.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (808,'Avery Zweckform','4741 Disketten-Etiketten Stick+Lift','S',12.97,25.0,67.73,70.0,67.73,90.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (809,'Avery Zweckform','4742 Video-Etiketten Stick+Lift','S',8.72,24.99,46.57,78.74,46.57,81.28,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (810,'Avery Zweckform','4743 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',21.44,7.73,42.33,96.0,42.33,98.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (811,'Avery Zweckform','4744 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',21.43,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (812,'Avery Zweckform','4745 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',21.43,7.73,63.5,96.0,63.5,98.54,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (813,'Avery Zweckform','4746 Video-Etiketten Stick+Lift','S',18.43,31.34,20.0,147.32,20.0,147.32,1,13, NULL, NULL ) +INSERT INTO label_def VALUES (814,'Avery Zweckform','4747 Etiketten für ZIP-Disketten','S',23.43,13.96,50.0,59.0,50.0,61.54,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (815,'Avery Zweckform','4748 Ordnerrücken-Etiketten schmal','S',0.0,10.0,296.86,38.0,296.86,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (816,'Avery Zweckform','4749 Ordnerrücken-Etiketten schmal','S',0.0,10.0,296.86,38.0,296.86,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (817,'Avery Zweckform','4750 Ordnerrücken-Etiketten schmal','S',0.0,10.0,296.86,38.0,296.86,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (818,'Avery Zweckform','4751 Ordnerrücken-Etiketten schmal','S',0.0,10.0,296.86,38.0,296.86,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (819,'Avery Zweckform','4752 Ordnerrücken-Etiketten breit','S',0.0,13.5,296.86,61.0,296.86,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (820,'Avery Zweckform','4753 Ordnerrücken-Etiketten breit','S',0.0,13.5,296.86,61.0,296.86,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (821,'Avery Zweckform','4754 Ordnerrücken-Etiketten breit','S',0.0,13.5,296.86,61.0,296.86,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (822,'Avery Zweckform','4755 Ordnerrücken-Etiketten breit','S',0.0,13.5,296.86,61.0,296.86,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (823,'Avery Zweckform','4756 Hängeordner-Etiketten schmal','S',0.0,20.0,296.86,34.0,296.86,34.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (824,'Avery Zweckform','4757 Hängeordner-Etiketten breit','S',0.0,10.5,296.86,63.0,296.86,63.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (825,'Avery Zweckform','4758 Ordnerrücken-Etiketten schmal','S',0.0,10.0,296.86,38.0,296.86,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (826,'Avery Zweckform','4759 Ordnerrücken-Etiketten breit','S',0.0,13.5,296.86,61.0,296.86,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (827,'Avery Zweckform','4760 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (828,'Avery Zweckform','4761 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (829,'Avery Zweckform','4762 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (830,'Avery Zweckform','4763 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (831,'Avery Zweckform','4764 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (832,'Avery Zweckform','4765 Ordnerrücken-Etiketten schmal','S',9.0,15.43,192.0,38.0,192.0,38.0,7,1, NULL, NULL ) +INSERT INTO label_def VALUES (833,'Avery Zweckform','4766 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (834,'Avery Zweckform','4767 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (835,'Avery Zweckform','4768 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (836,'Avery Zweckform','4769 Ordnerrücken-Etiketten breit','S',9.0,26.43,192.0,61.0,192.0,61.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (837,'Avery Zweckform','4770 Transparente Etiketten','S',21.43,8.0,25.4,48.5,25.4,48.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (838,'Avery Zweckform','4771 Transparente Etiketten','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (839,'Avery Zweckform','4772 Transparente Etiketten','S',21.53,8.0,42.3,97.0,42.3,97.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (840,'Avery Zweckform','4773 Wetterfeste Etiketten','S',13.23,8.1,33.8,64.6,33.8,64.6,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (841,'Avery Zweckform','4774 Wetterfeste Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (842,'Avery Zweckform','4775 Wetterfeste Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (843,'Avery Zweckform','4776 Wetterfeste Etiketten','S',21.53,8.0,42.3,97.0,42.3,97.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (844,'Avery Zweckform','4777 Transparente Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (845,'Avery Zweckform','4780 Inkjet+Laser+Kopier-Etiketten','S',21.43,8.0,25.4,48.5,25.4,48.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (846,'Avery Zweckform','4781 Inkjet+Laser+Kopier-Etiketten','S',21.53,8.0,42.3,97.0,42.3,97.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (847,'Avery Zweckform','4782 Inkjet+Laser+Kopier-Etiketten','S',13.03,8.0,67.7,97.0,67.7,97.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (848,'Avery Zweckform','4784 Namens-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (849,'Avery Zweckform','4790 Inkjet-Etiketten rund','S',13.43,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (850,'Avery Zweckform','4791 Inkjet-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (851,'Avery Zweckform','4792 Inkjet-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (852,'Avery Zweckform','4793 Inkjet-Etiketten','S',21.44,7.73,42.33,96.0,42.33,98.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (853,'Avery Zweckform','4794 Inkjet-Etiketten','S',21.43,7.73,63.5,96.0,63.5,98.54,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (854,'Avery Zweckform','4795 Inkjet-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (855,'Avery Zweckform','4798 Disketten-Etiketten Photo-Qualität','S',21.43,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (856,'Avery Zweckform','4799 Inkjet-Etiketten oval','S',15.09,7.73,63.5,96.0,67.73,98.54,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (857,'Avery Zweckform','6002 Neon-Etiketten','S',17.93,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (858,'Avery Zweckform','6003 Neon-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (859,'Avery Zweckform','6004 Neon-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (860,'Avery Zweckform','6005 Neon-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (861,'Avery Zweckform','6006 Neon-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (862,'Avery Zweckform','6008 Typenschild-Etiketten','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (863,'Avery Zweckform','6009 Typenschild-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (864,'Avery Zweckform','6011 Typenschild-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (865,'Avery Zweckform','6012 Typenschild-Etiketten','S',21.43,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (866,'Avery Zweckform','6013 Typenschild-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (867,'Avery Zweckform','6014 Etiketten für CD-Hüllen','S',16.43,47.85,5.5,114.3,5.5,114.3,1,48, NULL, NULL ) +INSERT INTO label_def VALUES (868,'Avery Zweckform','6015 CD-Etiketten incl. Zentrierhilfe','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (869,'Avery Zweckform','6019 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',16.43,11.1,10.0,10.0,12.7,12.7,15,21, NULL, NULL ) +INSERT INTO label_def VALUES (870,'Avery Zweckform','6020 Dia-Etiketten Stick+Lift','S',12.91,14.83,8.47,43.18,8.47,45.72,4,32, NULL, NULL ) +INSERT INTO label_def VALUES (871,'Avery Zweckform','6021 Sichtreiter-Etiketten Stick+Lift','S',12.99,9.75,16.93,45.72,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (872,'Avery Zweckform','6022 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',12.91,7.21,8.47,63.5,8.47,66.04,3,32, NULL, NULL ) +INSERT INTO label_def VALUES (873,'Avery Zweckform','6023 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',15.08,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (874,'Avery Zweckform','6024 Inkjet+Laser+Kopier-Etiketten Stick+Lift ','S',10.87,7.21,42.33,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (875,'Avery Zweckform','6025 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',8.72,7.21,46.57,63.5,46.57,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (876,'Avery Zweckform','6026 Disketten-Etiketten Stick+Lift','S',21.43,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (877,'Avery Zweckform','6029 Disketten-Etiketten Stick+Lift','S',21.43,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (878,'Avery Zweckform','6030 Cassetten-Etiketten Stick+Lift','S',21.53,14.73,42.3,89.0,42.3,91.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (879,'Avery Zweckform','6031 Inkjet+Laser+Kopier-Etiketten Stick+Lift','S',12.99,7.73,16.93,96.0,16.93,98.54,2,16, NULL, NULL ) +INSERT INTO label_def VALUES (880,'Avery Zweckform','6036 Inkjet+Laser+Kopier-Etiketten','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (881,'Avery Zweckform','6037 Inkjet+Laser+Kopier-Etiketten','S',13.43,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (882,'Avery Zweckform','6038 Inkjet+Laser+Kopier-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (883,'Avery Zweckform','6039 Inkjet+Laser+Kopier-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (884,'Avery Zweckform','6040 Inkjet+Laser+Kopier-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (885,'Avery Zweckform','6041 Inkjet+Laser+Kopier-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (886,'Avery Zweckform','6043 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (887,'Avery Zweckform','6044 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (888,'Avery Zweckform','6045 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (889,'Avery Zweckform','6046 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (890,'Avery Zweckform','6047 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (891,'Avery Zweckform','6058 Ordnerrücken-Etiketten schmal','S',0.0,20.0,296.86,34.0,296.86,34.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (892,'Avery Zweckform','6059 Ordnerrücken-Etiketten breit','S',0.0,16.5,296.86,59.0,296.86,59.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (893,'Avery Zweckform','6060 Ordnerrücken-Etiketten schmal','S',9.0,12.43,192.0,34.0,192.0,34.0,8,1, NULL, NULL ) +INSERT INTO label_def VALUES (894,'Avery Zweckform','6061 Ordnerrücken-Etiketten breit','S',9.0,30.43,192.0,59.0,192.0,59.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (895,'Avery Zweckform','6074 Inkjet-Glossy-CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (896,'Avery Zweckform','6077 Inkjet-Glossy-Etiketten','S',13.56,19.32,88.9,127.0,93.98,131.23,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (897,'Avery Zweckform','6078 Inkjet-Glossy-Etiketten','S',18.43,16.0,127.0,178.0,133.0,178.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (898,'Avery Zweckform','6079 Inkjet-Glossy-Etiketten oval','S',10.87,7.21,42.33,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (899,'Avery Zweckform','6080 Inkjet-Glossy-Etiketten','S',23.55,7.21,46.57,63.5,50.8,66.04,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (900,'Avery Zweckform','6081 Inkjet-Glossy-Etiketten','S',15.09,13.56,63.5,88.9,67.73,93.98,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (901,'Avery Zweckform','6082 Inkjet-Glossy-CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (902,'Avery Zweckform','6083 Inkjet-Glossy-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (903,'Avery Zweckform','6090 Korrektur- und Abdeck-Etiketten','S',13.23,8.0,16.9,48.5,16.9,48.5,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (904,'Avery Zweckform','6091 Korrektur- und Abdeck-Etiketten','S',13.23,8.1,33.8,64.6,33.8,64.6,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (905,'Avery Zweckform','6092 Korrektur- und Abdeck-Etiketten','S',21.53,8.0,42.3,97.0,42.3,97.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (906,'Avery Zweckform','6093 Korrektur- und Abdeck-Etiketten','S',0.0,0.0,105.0,148.43,105.0,148.43,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (907,'Avery Zweckform','6094 Korrektur- und Abdeck-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (908,'Avery Zweckform','6102 Farbige Folien-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (909,'Avery Zweckform','6103 Farbige Folien-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (910,'Avery Zweckform','6104 Farbige Folien-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (911,'Avery Zweckform','6105 Farbige Folien-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (912,'Avery Zweckform','6106 Farbige Folien-Etiketten','S',21.44,7.73,42.33,96.0,42.33,98.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (913,'Avery Zweckform','6107 Farbige Folien-Etiketten','S',21.44,7.73,42.33,96.0,42.33,98.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (914,'Avery Zweckform','6108 Farbige Folien-Etiketten','S',0.0,0.0,74.22,210.0,74.22,210.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (915,'Avery Zweckform','6109 Farbige Folien-Etiketten','S',0.0,0.0,74.22,210.0,74.22,210.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (916,'Avery Zweckform','6110 Farbige Folien-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (917,'Avery Zweckform','6111 Farbige Folien-Etiketten','S',0.0,0.0,296.86,210.0,296.86,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (918,'Avery Zweckform','6112 Sicherheits-Etiketten','S',13.43,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (919,'Avery Zweckform','6113 Sicherheits-Etiketten','S',21.41,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (920,'Avery Zweckform','6114 Sicherheits-Etiketten','S',15.1,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (921,'Avery Zweckform','6115 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (922,'Avery Zweckform','6116 MiniDisc-Etiketten','S',13.5,5.75,52.0,35.5,54.5,35.5,5,5, NULL, NULL ) +INSERT INTO label_def VALUES (923,'Avery Zweckform','6117 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (924,'Avery Zweckform','6118 CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (925,'Avery Zweckform','L7767 Farblaser-Glossy-Etiketten','S',1.0,0.5,295.0,209.0,295.0,209.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (926,'Avery Zweckform','L7768 Farblaser-Glossy-Etiketten','S',5.0,5.2,143.5,199.6,143.5,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (927,'Avery Zweckform','L7769 Farblaser-Glossy-Etiketten','S',9.5,4.63,139.0,99.1,139.0,101.64,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (928,'Avery Zweckform','L7765 Farblaser-Glossy-Etiketten','S',13.04,4.67,67.7,99.1,67.7,101.64,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (929,'Avery Zweckform','C9660 SuperSize Inkjet-Glossy-CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (930,'Avery Zweckform','L7760 SuperSize Farblaser-Glossy-CD-Etiketten','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (931,'Avery Zweckform','J8776 Inkjet-Stardust-CD-Etiketten*','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (932,'Avery Zweckform','J8871 Inkjet-Magnet-Schilder**','S',22.43,24.5,28.0,78.0,28.0,78.0,2,9, NULL, NULL ) +INSERT INTO label_def VALUES (933,'Avery Zweckform','J8875 Inkjet-Magnet-Schilder**','S',5.0,8.43,50.0,140.0,50.0,140.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (934,'Avery Zweckform','J8867 Inkjet-Magnet-Schilder**','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (935,'Avery Zweckform','C2166 Etikett rechteckig','S',33.6,31.9,52.0,70.0,59.27,76.2,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (936,'Avery Zweckform','C2243 Etikett rund klein','S',27.85,22.05,38.1,38.1,50.8,42.6,4,5, NULL, NULL ) +INSERT INTO label_def VALUES (937,'Avery Zweckform','C2351 Glückwunschkarten A5','S',0.0,0.0,210.0,297.0,210.0,297.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (938,'Avery Zweckform','C2354 Visitenkarten bis zum Rand','S',34.27,22.5,50.8,80.37,59.22,85.13,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (939,'Avery Zweckform','C2355 Glückwunschkarten Standard','S',25.4,22.45,120.72,165.1,125.48,165.1,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (940,'Avery Zweckform','C2410 Clubkarten laminiert','S',30.5,107.0,50.0,81.5,93.0,81.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (941,'Avery Zweckform','C2651 Etikett rechteckig klein','S',10.9,4.67,21.17,38.1,21.17,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (942,'Avery Zweckform','C9405 T-Shirt Transferfolie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (943,'Avery Zweckform','C2547 Fantastic Plastic','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (944,'Avery Zweckform','C2070 Transfer-Folie für Mousepad','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (945,'Avery Zweckform','C2090 T-Shirt Transfer-Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (946,'Avery Zweckform','C2080 Transfer-Folie für Puzzles','S',20.0,26.0,170.0,245.0,170.0,245.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (947,'Avery Zweckform','J8416 Einladungskarten mit Klebeverschluss','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (948,'Avery Zweckform','C2546 Fensterbilder','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (949,'Avery Zweckform','C9660 CD-Etiketten glossy Super-Size','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (950,'Avery Zweckform','J8770 CD-Etiketten Super-Ssize','S',21.43,46.5,117.0,117.0,137.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (951,'Avery Zweckform','C2050 Video-Etiketten seitlich','S',18.43,31.34,20.0,147.32,20.0,147.32,1,13, NULL, NULL ) +INSERT INTO label_def VALUES (952,'Avery Zweckform','C2050 Video-Etiketten oben','S',8.72,24.99,46.57,78.74,46.57,81.28,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (953,'Avery Zweckform','J8666 Disketten-Etiketten','S',18.5,23.35,52.0,70.0,52.0,93.3,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (954,'Avery Zweckform','J9124 Photo-Etiketten 13 x 18','S',17.5,15.0,129.5,180.0,132.5,180.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (955,'Avery Zweckform','L7424 Ordner-Etiketten breit','S',9.0,30.43,192.0,59.0,192.0,59.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (956,'Avery Zweckform','L7425 Ordner-Etiketten schmal','S',9.0,12.43,192.0,34.0,192.0,34.0,8,1, NULL, NULL ) +INSERT INTO label_def VALUES (957,'Avery Zweckform','J8587 Inkjet-Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (958,'Avery Zweckform','L7587 Laser-Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (959,'Avery Zweckform','C9431 Photo-Papier glossy','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (960,'Avery Zweckform','C9434 Photo-Karton glossy','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (961,'Avery Zweckform','C9372 Photo-Papier glossy 9 x 13','S',12.5,17.5,90.0,129.5,95.0,132.5,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (962,'Avery Zweckform','C2371 Inkjet-Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (963,'Avery Zweckform','C2370 Inkjet-Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (964,'Avery Zweckform','C2374 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (965,'Avery Zweckform','C2375 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (966,'Avery Zweckform','C2376 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (967,'Avery Zweckform','C2377 Marmoriertes Papier','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (968,'Avery Zweckform','C9355 Postkarten Vorderseite','S',36.0,31.0,105.0,148.0,120.0,148.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (969,'Avery Zweckform','C9355 Postkarten Rückseite','S',36.0,31.0,105.0,148.0,120.0,148.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (970,'Avery Zweckform','J8435 CD-Einleger','S',24.0,29.5,249.0,151.0,249.0,151.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (971,'Avery Zweckform','C9362 Visitenkarten glossy','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (972,'Avery Zweckform','C2364 Marmorierte Visitenkarten','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (973,'Avery Zweckform','C2365 Marmorierte Visitenkarten','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (974,'Avery Zweckform','C2366 Marmorierte Visitenkarten','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (975,'Avery Zweckform','C2367 Marmorierte Visitenkarten','S',13.5,15.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (976,'Avery Zweckform','C9352 Glückwunschkarten A6 glossy','S',25.4,22.45,120.72,82.55,125.48,82.55,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (977,'Avery Zweckform','L7159 Laser-Etiketten','S',13.06,6.46,33.9,64.0,33.9,66.54,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (978,'Avery Zweckform','L7160 Laser-Etiketten','S',15.15,7.2,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (979,'Avery Zweckform','L7161 Laser-Etiketten','S',8.82,7.21,46.6,63.5,46.6,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (980,'Avery Zweckform','L7162 Laser-Etiketten','S',13.02,4.67,46.6,63.5,46.6,66.04,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (981,'Avery Zweckform','L7163 Laser-Etiketten','S',15.15,4.67,38.1,99.1,38.1,101.64,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (982,'Avery Zweckform','L7164 Laser-Etiketten','S',4.57,7.21,72.0,63.5,72.0,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (983,'Avery Zweckform','L7165 Laser-Etiketten','S',13.04,4.67,67.7,99.1,67.7,101.64,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (984,'Avery Zweckform','L7166 Laser-Etiketten','S',8.8,4.67,93.1,99.1,93.1,101.64,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (985,'Avery Zweckform','L7167 Laser-Etiketten','S',3.97,5.2,289.1,199.6,289.1,199.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (986,'Avery Zweckform','L7168 Laser-Etiketten','S',4.97,5.2,143.5,199.6,143.5,199.6,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (987,'Avery Zweckform','L7169 Laser-Etiketten','S',4.63,9.5,139.0,99.1,139.0,101.64,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (988,'Avery Zweckform','L7173 Laser-Etiketten','S',6.0,4.67,57.0,99.1,57.0,101.64,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (989,'Avery Zweckform','L7651 Laser-Etiketten','S',10.89,4.67,21.2,38.1,21.2,40.64,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (990,'Avery Zweckform','L7410-10 Etiketten Register - Etikettenbogen 10','S',46.9,19.91,12.7,25.4,21.17,48.26,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (991,'Avery Zweckform','L7410-10 Etiketten Register - Inhaltsblatt 10-t','S',4.25,110.0,28.85,100.0,28.85,100.0,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (992,'Avery Zweckform','L7410-12 Etiketten Register - Etikettenbogen 12','S',49.02,25.42,12.7,22.0,16.93,45.72,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (993,'Avery Zweckform','L7410-12 Etiketten Register - Inhaltsblatt 12-t','S',5.1,110.0,23.9,100.0,23.9,100.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (994,'Avery Zweckform','L7410-5 Etiketten Register - Etikettenbogen 5-t','S',46.9,25.4,12.7,55.02,21.17,104.19,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (995,'Avery Zweckform','L7410-5 Etiketten Register - Inhaltsblatt 5-tei','S',4.75,110.0,57.5,100.0,57.5,100.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (996,'Avery Zweckform','L7411-10 Zahlen Register - Inhaltsblatt 1-10','S',4.25,110.0,28.85,100.0,28.85,100.0,1,10, NULL, NULL ) +INSERT INTO label_def VALUES (997,'Avery Zweckform','L7411-12 Zahlen Register - Inhaltsblatt 1-12','S',5.1,110.0,23.9,100.0,23.9,100.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (998,'Avery Zweckform','L7411-15 Zahlen Register - Inhaltsblatt 1-15','S',0.0,110.0,19.8,100.0,19.8,100.0,1,15, NULL, NULL ) +INSERT INTO label_def VALUES (999,'Avery Zweckform','L7411-20 Zahlen Register - Inhaltsblatt 1-20','S',15.0,110.0,13.35,100.0,13.35,100.0,1,20, NULL, NULL ) +INSERT INTO label_def VALUES (1000,'Avery Zweckform','L7411-31 Zahlen Register - Inhaltsblatt 1-31','S',15.0,110.0,8.61,100.0,8.61,100.0,1,31, NULL, NULL ) +INSERT INTO label_def VALUES (1001,'Avery Zweckform','L7411-5 Zahlen Register - Inhaltsblatt 1-5','S',4.75,110.0,57.5,100.0,57.5,100.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (1002,'Avery Zweckform','L7411-AZ A-Z Register - Inhaltsblatt','S',15.0,110.0,13.35,100.0,13.35,100.0,1,20, NULL, NULL ) +INSERT INTO label_def VALUES (1003,'Avery Zweckform','L7411-JD Monats Register - Inhaltsblatt Jan - D','S',5.1,110.0,23.9,100.0,23.9,100.0,1,12, NULL, NULL ) +INSERT INTO label_def VALUES (1004,'Avery Zweckform','L7412-10 Einsteckschilder für Register 10-teilig','S',47.3,10.0,21.16,39.5,21.16,48.4,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1005,'Avery Zweckform','L7412-12 Einsteckschilder für Register 12-teilig','S',47.3,12.5,21.16,34.5,21.16,48.4,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1006,'Avery Zweckform','L7412-5 Einsteckschilder für Register 5-teilig','S',47.3,13.2,21.16,71.0,21.16,104.4,2,10, NULL, NULL ) +INSERT INTO label_def VALUES (1007,'Avery Zweckform','5129061 Trennstreifen ','S',0.0,0.0,105.0,240.0,105.0,240.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1008,'Avery Zweckform','3600 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1009,'Avery Zweckform','3601 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1010,'Avery Zweckform','3602 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1011,'Avery Zweckform','3603 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1012,'Avery Zweckform','3604 Computer-Etikett','C',0.0,16.9,14.5,25.4,16.93,27.94,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1013,'Avery Zweckform','3605 Computer-Etikett','C',0.0,14.4,14.5,40.6,16.93,43.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1014,'Avery Zweckform','3606 Computer-Etikett','C',0.0,14.3,18.7,48.2,21.17,50.74,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1015,'Avery Zweckform','3607 Computer-Etikett','C',0.0,16.9,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1016,'Avery Zweckform','3608 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1017,'Avery Zweckform','3609 Computer-Etikett','C',0.0,13.15,10.3,73.7,12.7,73.7,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1018,'Avery Zweckform','3610 Computer-Etikett','C',0.0,10.55,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1019,'Avery Zweckform','3611 Computer-Etikett','C',0.0,12.43,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1020,'Avery Zweckform','3612 Computer-Etikett','C',0.0,13.35,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1021,'Avery Zweckform','3613 Computer-Etikett','C',0.0,10.8,48.4,106.7,50.8,106.7,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1022,'Avery Zweckform','3614 Computer-Etikett','C',0.0,11.19,48.4,114.3,50.8,114.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1023,'Avery Zweckform','3615 Computer-Etikett','C',0.0,12.43,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1024,'Avery Zweckform','3617 Computer-Etikett','C',0.0,13.35,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1025,'Avery Zweckform','3620 Computer-Etikett','C',0.0,12.15,35.7,101.6,38.1,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1026,'Avery Zweckform','3621 Computer-Etikett','C',0.0,11.82,35.7,43.18,38.1,45.72,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1027,'Avery Zweckform','3623 Computer-Etikett','C',0.0,12.15,48.4,101.6,50.8,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1028,'Avery Zweckform','3633 Computer-Etikett','C',0.0,14.45,35.7,73.7,38.1,76.24,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1029,'Avery Zweckform','3634 Computer-Etikett schnittgestanzt','C',0.0,10.55,38.1,95.0,38.1,95.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1030,'Avery Zweckform','3635 Computer-Etikett','C',0.0,12.43,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1031,'Avery Zweckform','3643 Computer-Etikett','C',0.0,28.5,23.0,30.5,25.4,35.58,6,1, NULL, NULL ) +INSERT INTO label_def VALUES (1032,'Avery Zweckform','3645 Computer-Etikett','C',0.0,10.55,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1033,'Avery Zweckform','3646 Computer-Etikett','C',0.0,10.55,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1034,'Avery Zweckform','3647 Computer-Etikett','C',0.0,11.8,10.3,43.2,12.7,45.74,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1035,'Avery Zweckform','3648 Computer-Etikett ablösbar','C',0.0,10.55,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1036,'Avery Zweckform','3674 Computer-Etikett','C',0.0,16.9,14.5,25.4,16.93,27.94,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1037,'Avery Zweckform','3675 Computer-Etikett','C',0.0,16.9,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1038,'Avery Zweckform','3676 Computer-Etikett','C',0.0,14.3,18.7,48.2,21.17,50.74,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1039,'Avery Zweckform','5100 Computer-Etikett','C',0.0,13.15,10.3,73.7,12.7,73.7,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1040,'Avery Zweckform','5101 Computer-Etikett','C',0.0,10.55,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1041,'Avery Zweckform','5103 Computer-Etikett','C',0.0,12.43,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1042,'Avery Zweckform','5104 Computer-Etikett','C',0.0,13.35,10.3,101.6,12.7,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1043,'Avery Zweckform','5105 Computer-Etikett','C',0.0,13.35,23.0,101.6,25.4,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1044,'Avery Zweckform','5106 Computer-Etikett','C',0.0,13.35,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1045,'Avery Zweckform','5107 Computer-Etikett','C',0.0,13.35,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1046,'Avery Zweckform','5108 Computer-Etikett','C',0.0,10.8,35.7,106.7,38.1,106.7,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1047,'Avery Zweckform','5109 Computer-Etikett','C',0.0,10.8,48.4,106.7,50.8,106.7,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1048,'Avery Zweckform','5110 Computer-Etikett','C',0.0,11.19,48.4,114.3,50.8,114.3,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1049,'Avery Zweckform','5111 Computer-Etikett','C',0.0,11.5,23.0,127.0,25.4,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1050,'Avery Zweckform','5112 Computer-Etikett','C',0.0,11.5,35.7,127.0,38.1,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1051,'Avery Zweckform','5121 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1052,'Avery Zweckform','5122 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1053,'Avery Zweckform','5123 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1054,'Avery Zweckform','5124 Computer-Etikett','C',0.0,10.55,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1055,'Avery Zweckform','5130 Computer-Etikett','C',0.0,13.6,35.7,88.9,38.1,91.44,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1056,'Avery Zweckform','5131 Computer-Etikett','C',0.0,13.6,48.4,88.9,50.8,91.44,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1057,'Avery Zweckform','5132 Computer-Etikett','C',0.0,12.15,35.7,101.6,38.1,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1058,'Avery Zweckform','5133 Computer-Etikett','C',0.0,12.15,48.4,101.6,50.8,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1059,'Avery Zweckform','5137 Computer-Etikett','C',0.0,11.7,23.0,50.8,25.4,53.34,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1060,'Avery Zweckform','5140 Computer-Etikett','C',0.0,12.54,10.3,43.2,12.7,45.74,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1061,'Avery Zweckform','5141 Computer-Etikett','C',0.0,16.65,23.0,88.9,25.4,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1062,'Avery Zweckform','5142 Computer-Etikett','C',0.0,16.65,35.7,88.9,38.1,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1063,'Avery Zweckform','5143 Computer-Etikett','C',0.0,16.65,48.4,88.9,50.8,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1064,'Avery Zweckform','5145 Computer-Etikett','C',0.0,12.6,35.7,101.6,38.1,104.14,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1065,'Avery Zweckform','5146 Computer-Etikett','C',0.0,14.95,35.7,106.7,38.1,109.24,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1066,'Avery Zweckform','5147 Computer-Etikett','C',0.0,14.95,48.4,106.7,50.8,109.24,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1067,'Avery Zweckform','5160 Computer-Etikett','C',0.0,15.5,23.0,63.5,25.4,66.04,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1068,'Avery Zweckform','5161 Computer-Etikett','C',0.0,17.6,35.7,73.7,38.1,76.24,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1069,'Avery Zweckform','5162 Computer-Etikett','C',0.0,14.9,23.0,81.3,25.4,83.84,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1070,'Avery Zweckform','5163 Computer-Etikett','C',0.0,14.9,35.7,81.3,38.1,83.84,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1071,'Avery Zweckform','5164 Computer-Etikett','C',0.0,20.2,35.3,80.0,38.1,85.0,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1072,'Avery Zweckform','5170 Computer-Etikett','C',0.0,18.75,23.0,63.5,25.4,66.04,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1073,'Avery Zweckform','5171 Computer-Etikett','C',0.0,18.75,35.7,63.5,35.95,63.74,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1074,'Herlitz','083200/6 Adressetikett','C',1.0,9.0,35.7,89.0,38.0,89.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1075,'Herlitz','083200/6 Adressetikett','C',1.0,9.0,35.7,89.0,38.0,89.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1076,'Herlitz','083203/0 Adressetikett','C',1.0,11.0,48.4,89.0,50.8,89.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1077,'Herlitz','083204/8 Adressetikett','C',1.0,9.0,35.7,101.6,38.0,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1078,'Herlitz','083205/5 Diskettenetikett','C',3.0,18.5,69.6,70.0,76.2,70.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1079,'Herlitz','083207/1 Adressetikett','C',1.0,11.0,35.7,89.0,38.0,89.0,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1080,'Herlitz','083215/4 Diskettenetikett','S',21.4,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1081,'Herlitz','083216/2 CD-ROM-Etikett','S',16.0,46.5,117.0,117.0,148.0,117.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1082,'Herlitz','083217/0 Adressetikett','S',4.4,0.0,36.0,70.0,36.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1083,'Herlitz','083219/6 Adressetikett','S',21.4,7.7,50.8,96.0,50.8,98.5,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1084,'Herlitz','083220/4 Adressetikett Laser','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1085,'Herlitz','083221/2 Adressetikett Laser','S',0.0,0.0,42.4,105.0,42.4,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1086,'Herlitz','083222/0 Adressetikett Laser','S',0.0,0.0,42.4,70.0,42.4,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1087,'Herlitz','083224/6 Diskettenetikett Laser','S',8.5,0.0,70.0,70.0,70.0,70.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1088,'Herlitz','083230/3 Adressetikett Inkjet','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1089,'Herlitz','083231/1 Adressetikett Inkjet','S',0.0,0.0,42.4,105.0,42.4,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1090,'Herlitz','083234/5 Diskettenetikett Inkjet','S',8.5,0.0,70.0,70.0,70.0,70.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1091,'Herlitz','083240/2 Adressetik. Laser+InkJet','S',0.0,0.0,37.1,70.0,37.1,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1092,'Herlitz','083244/4 Diskettenetik.Laser+InkJet','S',8.5,0.0,70.0,70.0,70.0,70.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1093,'Herlitz','083250/1 Adressetiketten','S',10.76,7.7,42.3,96.0,42.3,98.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1094,'Herlitz','083251/9 Ordner-Etiketten 8 cm','S',13.21,10.0,61.0,190.0,61.0,190.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1095,'Herlitz','083252/7 Ordner-Etiketten 5 cm','S',17.21,10.0,38.0,190.0,38.0,190.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (1096,'Herlitz','083253/5 Neonetiketten','S',10.76,7.7,42.3,96.0,42.3,98.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1097,'Herlitz','083254/3 Transparente Etiketten','S',10.76,7.7,42.3,96.0,42.3,98.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1098,'Herlitz','083255/0 Diskettenetiketten','S',6.51,25.0,67.7,70.0,67.7,90.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1099,'Herlitz','83256/8a Videoetiketten 0','S',27.61,25.0,46.6,78.7,46.6,81.3,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1100,'Herlitz','83256/8b Videoetiketten 0','S',15.06,31.35,16.9,147.3,16.9,147.3,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1101,'Herlitz','083257/6 Diaetiketten','S',14.21,10.0,10.0,45.7,10.0,48.2,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1102,'Herlitz','083258/4 Farbdruck-Etiketten','S',10.76,7.7,42.3,96.0,42.3,98.6,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1103,'Herlitz','502041/7 Visitenkarten','S',14.0,14.0,54.0,85.0,54.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1104,'Herlitz','083271/7 Ordnerrückeneinsteckschilder','S',16.0,10.0,53.0,190.0,53.0,190.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (1105,'Herma','4097 Laser A4 Silberfolie','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1106,'Herma','4098 Laser A4 Silberfolie','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1107,'Herma','4099 Laser A4 Silberfolie','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1108,'Herma','4100 Laser A4 Goldfolie','S',13.03,7.21,16.93,30.48,16.93,33.02,6,16, NULL, NULL ) +INSERT INTO label_def VALUES (1109,'Herma','4101 Laser A4 Goldfolie','S',10.0,18.64,10.3,43.18,12.7,43.18,4,22, NULL, NULL ) +INSERT INTO label_def VALUES (1110,'Herma','4102 Laser A4 Goldfolie','S',8.8,8.4,25.4,48.3,25.4,48.3,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1111,'Herma','4103 Laser A4 Goldfolie','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1112,'Herma','4104 Laser A4 Goldfolie','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1113,'Herma','4105 Laser A4 Goldfolie Kreise 60 mm','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1114,'Herma','4106 Laser A4 Goldfolie oval','S',10.93,12.29,42.33,58.42,46.56,63.5,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1115,'Herma','4107 Laser A4 Goldfolie A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1116,'Herma','4108 Laser A4 Goldfolie','S',13.5,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (1117,'Herma','4109 Laser A4 Goldfolie oval','S',17.27,16.1,25.4,40.64,29.63,45.72,4,9, NULL, NULL ) +INSERT INTO label_def VALUES (1118,'Herma','4110 Laser A4 Silberfolie','S',13.03,7.21,16.93,30.48,16.93,33.02,6,16, NULL, NULL ) +INSERT INTO label_def VALUES (1119,'Herma','4111 Laser A4 Silberfolie','S',10.0,18.64,10.3,43.18,12.7,43.18,4,22, NULL, NULL ) +INSERT INTO label_def VALUES (1120,'Herma','4112 Laser A4 Silberfolie','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1121,'Herma','4113 Laser A4 Silberfolie','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1122,'Herma','4114 Laser A4 Silberfolie','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1123,'Herma','4115 Laser A4 Silberfolie Kreise 60 mm','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1124,'Herma','4116 Laser A4 Silberfolie oval','S',10.93,12.29,42.33,58.42,46.56,63.5,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1125,'Herma','4117 Laser A4 Silberfolie A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1126,'Herma','4118 Laser A4 Silberfolie','S',13.5,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (1127,'Herma','4119 Laser A4 Silberfolie','S',13.03,7.21,16.93,63.5,16.93,66.04,3,16, NULL, NULL ) +INSERT INTO label_def VALUES (1128,'Herma','4200 Laser/Inkjet A4 weiß','S',13.02,8.4,33.87,48.3,33.87,48.3,4,8, NULL, NULL ) +INSERT INTO label_def VALUES (1129,'Herma','4201 Laser/Inkjet A4 Sichtreiteretiketten weiß','S',13.06,9.75,16.93,45.72,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (1130,'Herma','4202 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',12.98,7.21,8.47,63.5,8.47,66.04,3,32, NULL, NULL ) +INSERT INTO label_def VALUES (1131,'Herma','4203 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1132,'Herma','4204 Laser/Inkjet A4 3 5\"-Disketten gelb','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1133,'Herma','4205 Laser/Inkjet A4 3 5\"-Disketten rot','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1134,'Herma','4206 Laser/Inkjet A4 3 5\"-Disketten blau','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1135,'Herma','4207 Laser/Inkjet A4 3 5\"-Disketten grün','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1136,'Herma','4208 Laser/Inkjet A4 Musik-Cassetten weiß','S',21.5,14.75,42.33,89.0,42.33,91.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1137,'Herma','4209 Laser/Inkjet A4 weiß z.B. für Regalbeschriftung ablösbar','S',13.06,7.73,16.93,96.0,16.93,98.54,2,16, NULL, NULL ) +INSERT INTO label_def VALUES (1138,'Herma','4210 Laser/Inkjet A4 weiß ablösbar','S',8.8,9.75,12.7,38.1,12.7,38.1,5,22, NULL, NULL ) +INSERT INTO label_def VALUES (1139,'Herma','4211 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',13.06,8.48,16.93,25.4,16.93,27.94,7,16, NULL, NULL ) +INSERT INTO label_def VALUES (1140,'Herma','4212 Laser/Inkjet A4 weiß ablösbar','S',10.7,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (1141,'Herma','4226 SuperPrint weiß deckend','S',13.06,8.48,16.93,48.26,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (1142,'Herma','4227 SuperPrint weiß deckend','S',13.03,8.1,33.87,64.6,33.87,64.6,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1143,'Herma','4228 SuperPrint weiß deckend','S',21.51,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1144,'Herma','4229 SuperPrint weiß deckend','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1145,'Herma','4230 SuperPrint weiß deckend','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1146,'Herma','4256 Laser/Inkjet A4 gelb','S',0.0,0.0,37.13,105.0,37.13,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1147,'Herma','4257 Laser/Inkjet A4 rot','S',0.0,0.0,37.13,105.0,37.13,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1148,'Herma','4258 Laser/Inkjet A4 blau','S',0.0,0.0,37.13,105.0,37.13,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1149,'Herma','4259 Laser/Inkjet A4 grün','S',0.0,0.0,37.13,105.0,37.13,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1150,'Herma','4262 Laser/Inkjet A4 weiß','S',13.03,8.1,33.87,64.6,33.87,64.6,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1151,'Herma','4263 Laser/Inkjet A4 weiß','S',13.03,0.0,33.87,70.0,33.87,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1152,'Herma','4264 Laser/Inkjet A4 weiß','S',13.03,0.0,33.87,105.0,33.87,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1153,'Herma','4265 Laser/Inkjet A4 weiß Ecken abgerundet','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1154,'Herma','4266 Laser/Inkjet A4 weiß Ecken abgerundet','S',4.5,7.21,72.0,63.5,72.0,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1155,'Herma','4267 Laser/Inkjet A4 weiß Ecken abgerundet','S',13.03,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1156,'Herma','4268 Laser/Inkjet A4 weiß Ecken abgerundet','S',6.0,4.67,57.0,99.06,57.0,101.6,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1157,'Herma','4269 Laser/Inkjet A4 weiß Ecken abgerundet','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1158,'Herma','4270 Laser/Inkjet A4 weiß','S',10.7,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (1159,'Herma','4271 Laser/Inkjet A4 weiß','S',13.06,8.48,16.93,48.26,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (1160,'Herma','4272 Laser/Inkjet A4 weiß','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1161,'Herma','4273 Laser/Inkjet A4 weiß','S',0.0,0.0,21.2,52.5,21.2,52.5,4,14, NULL, NULL ) +INSERT INTO label_def VALUES (1162,'Herma','4275 Laser/Inkjet A4 weiß','S',8.8,6.0,25.4,66.0,25.4,66.0,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (1163,'Herma','4278 Laser/Inkjet A4 3 5\"-Disketten weiß','S',21.5,0.0,50.8,70.0,50.8,70.0,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (1164,'Herma','4279 Laser/Inkjet A4 3 5\"-Disketten weiß','S',13.03,0.0,67.73,70.0,67.73,70.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1165,'Herma','4280 Laser/Inkjet A4 weiß','S',13.03,8.48,67.73,96.52,67.73,96.52,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1166,'Herma','4281 Laser/Inkjet A4 weiß','S',21.5,0.0,50.8,105.0,50.8,105.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1167,'Herma','4282 Laser/Inkjet A4 weiß A5','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1168,'Herma','4283 Laser/Inkjet A4 für schmale Ordner weiß','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1169,'Herma','4284 Laser/Inkjet A4 für breite Ordner weiß','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1170,'Herma','4290 Laser/Inkjet A4 für schmale Ordner weiß','S',12.5,9.0,34.0,192.0,34.0,192.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1171,'Herma','4291 Laser/Inkjet A4 für breite Ordner weiß','S',30.5,9.0,59.0,192.0,59.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1172,'Herma','4292 Laser/Inkjet A4 für schmale Ordner gelb','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1173,'Herma','4293 Laser/Inkjet A4 für schmale Ordner rot','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1174,'Herma','4294 Laser/Inkjet A4 für schmale Ordner blau','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1175,'Herma','4295 Laser/Inkjet A4 für schmale Ordner grün','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1176,'Herma','4296 Laser/Inkjet A4 für breite Ordner gelb','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1177,'Herma','4297 Laser/Inkjet A4 für breite Ordner rot','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1178,'Herma','4298 Laser/Inkjet A4 für breite Ordner blau','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1179,'Herma','4299 Laser/Inkjet A4 für breite Ordner grün','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1180,'Herma','4343 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',13.5,4.26,10.0,17.8,10.0,20.41,10,27, NULL, NULL ) +INSERT INTO label_def VALUES (1181,'Herma','4344 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',13.5,8.48,10.0,25.4,10.0,27.94,7,27, NULL, NULL ) +INSERT INTO label_def VALUES (1182,'Herma','4345 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',13.06,11.02,16.93,35.56,16.93,38.1,5,16, NULL, NULL ) +INSERT INTO label_def VALUES (1183,'Herma','4346 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1184,'Herma','4347 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1185,'Herma','4348 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',21.5,7.73,42.33,96.0,42.33,98.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1186,'Herma','4349 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1187,'Herma','4350 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',21.5,7.73,63.5,96.0,63.5,98.54,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1188,'Herma','4351 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1189,'Herma','4352 Laser/Inkjet A4 weiß ablösbar','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1190,'Herma','4353 Laser/Inkjet A4 3 5\"-Disketten weiß','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1191,'Herma','4354 Laser/Inkjet A4 3 5\"-Disketten farbig sortiert','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1192,'Herma','4355 Laser/Inkjet A4 3 5\"-Disketten weiß','S',13.04,25.0,67.73,70.0,67.73,90.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1193,'Herma','4356 Laser/Inkjet A4 3 5\"-Disketten farbig sortiert','S',13.04,25.0,67.73,70.0,67.73,90.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1194,'Herma','4357 Laser/Inkjet A4 weiß','S',21.5,8.0,25.4,48.5,25.4,48.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1195,'Herma','4358 Laser/Inkjet A4 Oval weiß ablösbar','S',10.93,7.21,42.33,63.5,46.57,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1196,'Herma','4359 Laser/Inkjet A4 weiß','S',13.03,8.48,67.73,96.52,67.73,96.52,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1197,'Herma','4360 Laser/Inkjet A4 weiß','S',4.5,0.0,36.0,70.0,36.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1198,'Herma','4361 Laser/Inkjet A4 weiß','S',4.13,0.0,41.25,70.0,41.25,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1199,'Herma','4362 Laser/Inkjet A4 weiß','S',4.13,0.0,41.25,105.0,41.25,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1200,'Herma','4363 Laser/Inkjet A4 weiß','S',4.5,0.0,48.0,105.0,48.0,105.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1201,'Herma','4364 Laser/Inkjet A4 weiß','S',4.5,0.0,144.0,105.0,144.0,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1202,'Herma','4366 Laser/Inkjet A4 gelb Ecken abgerundet','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1203,'Herma','4367 Laser/Inkjet A4 rot Ecken abgerundet','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1204,'Herma','4368 Laser/Inkjet A4 blau Ecken abgerundet','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1205,'Herma','4369 Laser/Inkjet A4 grün Ecken abgerundet','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1206,'Herma','4373 SuperPrint CD-Cover-Etikett/Einleger weiß','S',17.0,44.25,117.5,121.5,145.5,121.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1207,'Herma','4374 SuperPrint CD-Etikett transparente Folie','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1208,'Herma','4375 Laser/Inkjet A4 transparente Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1209,'Herma','4376 Laser/Inkjet A4 transparente Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1210,'Herma','4377 Laser A4 witterungsbeständig weiß','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1211,'Herma','4378 Laser A4 witterungsbeständig weiß','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1212,'Herma','4379 Laser A4 witterungsbeständig weiß','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1213,'Herma','4380 Laser/Inkjet A4 Oval weiß','S',17.27,16.1,25.4,40.64,29.63,45.72,4,9, NULL, NULL ) +INSERT INTO label_def VALUES (1214,'Herma','4385 Laser/Inkjet A4 Kreise 10 mm weiß ablösbar','S',16.5,11.1,10.0,10.0,12.7,12.7,15,21, NULL, NULL ) +INSERT INTO label_def VALUES (1215,'Herma','4386 Laser/Inkjet A4 Kreise 20 mm weiß ablösbar','S',14.53,16.11,20.0,20.0,22.54,22.54,8,12, NULL, NULL ) +INSERT INTO label_def VALUES (1216,'Herma','4387 Laser/Inkjet A4 Kreise 30 mm weiß','S',19.61,8.65,30.0,30.0,32.54,32.54,6,8, NULL, NULL ) +INSERT INTO label_def VALUES (1217,'Herma','4388 Laser/Inkjet A4 Tiefkühletiketten weiß','S',10.7,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (1218,'Herma','4389 Laser/Inkjet A4 Tiefkühletiketten weiß','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1219,'Herma','4392 Laser/Inkjet A4 weiß ablösbar','S',0.0,0.0,29.7,52.5,29.7,52.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1220,'Herma','4393 Laser/Inkjet A4 weiß ablösbar','S',4.13,0.0,41.25,105.0,41.25,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1221,'Herma','4394 Laser/Inkjet A4 weiß ablösbar','S',4.5,0.0,144.0,105.0,144.0,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1222,'Herma','4396 Laser/Inkjet A4 gelb A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1223,'Herma','4397 Laser/Inkjet A4 rot A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1224,'Herma','4398 Laser/Inkjet A4 blau A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1225,'Herma','4399 Laser/Inkjet A4 grün A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1226,'Herma','4401 Laser/Inkjet A4 gelb A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1227,'Herma','4402 Laser/Inkjet A4 rot A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1228,'Herma','4403 Laser/Inkjet A4 blau A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1229,'Herma','4404 Laser/Inkjet A4 grün A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1230,'Herma','4406 Laser/Inkjet A4 gelb','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1231,'Herma','4407 Laser/Inkjet A4 rot','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1232,'Herma','4408 Laser/Inkjet A4 blau','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1233,'Herma','4409 Laser/Inkjet A4 grün','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1234,'Herma','4414 Laser/Inkjet A4 weiß','S',4.5,0.0,36.0,70.0,36.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1235,'Herma','4415 Laser/Inkjet A4 weiß','S',4.13,0.0,41.25,70.0,41.25,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1236,'Herma','4416 Laser/Inkjet A4 weiß','S',4.13,0.0,41.25,105.0,41.25,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1237,'Herma','4417 Laser/Inkjet A4 weiß','S',4.5,0.0,48.0,105.0,48.0,105.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1238,'Herma','4418 Laser A4 Namensetiketten Acetatseide rot','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1239,'Herma','4419 Laser A4 Namensetiketten Acetatseide blau','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1240,'Herma','4421 Laser/Inkjet A4 gelb','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1241,'Herma','4422 Laser/Inkjet A4 rot','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1242,'Herma','4423 Laser/Inkjet A4 blau','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1243,'Herma','4424 Laser/Inkjet A4 grün','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1244,'Herma','4425 Laser/Inkjet A4 weiß','S',6.0,0.0,57.0,105.0,57.0,105.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1245,'Herma','4426 Laser/Inkjet A4 weiß','S',8.5,0.0,70.0,105.0,70.0,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1246,'Herma','4427 Laser/Inkjet A4 weiß','S',8.5,0.0,35.0,105.0,35.0,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1247,'Herma','4428 Laser/Inkjet A4 weiß A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1248,'Herma','4429 Laser/Inkjet A4 weiß','S',8.5,0.0,35.0,70.0,35.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1249,'Herma','4450 Laser/Inkjet A4 weiß','S',4.5,0.0,32.0,70.0,32.0,70.0,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1250,'Herma','4451 Laser/Inkjet A4 weiß','S',4.13,0.0,41.25,70.0,41.25,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1251,'Herma','4452 Laser/Inkjet A4 weiß','S',4.13,0.0,41.25,105.0,41.25,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1252,'Herma','4453 Laser/Inkjet A4 weiß','S',4.5,0.0,36.0,70.0,36.0,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1253,'Herma','4454 Laser/Inkjet A4 weiß','S',4.5,0.0,144.0,105.0,144.0,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1254,'Herma','4455 Laser/Inkjet A4 weiß','S',8.8,0.0,25.4,70.0,25.4,70.0,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (1255,'Herma','4456 Laser/Inkjet A4 weiß','S',0.0,0.0,29.7,70.0,29.7,70.0,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (1256,'Herma','4457 Laser/Inkjet A4 weiß','S',4.5,0.0,48.0,105.0,48.0,105.0,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1257,'Herma','4458 Laser/Inkjet A4 weiß','S',0.0,0.0,297.0,200.0,297.0,200.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1258,'Herma','4459 Laser/Inkjet A4 weiß','S',4.6,0.0,16.93,70.0,16.93,70.0,3,17, NULL, NULL ) +INSERT INTO label_def VALUES (1259,'Herma','4461 Laser/Inkjet A4 weiß','S',0.0,0.0,29.7,52.5,29.7,52.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1260,'Herma','4462 Laser/Inkjet A4 weiß','S',0.0,0.0,37.13,105.0,37.13,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1261,'Herma','4464 Laser/Inkjet A4 weiß','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1262,'Herma','4465 Laser A4 transparente Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1263,'Herma','4466 Laser/Inkjet A4 gelb','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1264,'Herma','4467 Laser/Inkjet A4 rot','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1265,'Herma','4468 Laser/Inkjet A4 blau','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1266,'Herma','4469 Laser/Inkjet A4 grün','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1267,'Herma','4470 Laser/Inkjet A4 weiß','S',0.0,0.0,74.25,105.0,74.25,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1268,'Herma','4471 SuperPrint CD-Etikett weiß','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1269,'Herma','4472 Laser/Inkjet A4 weiß Ecken abgerundet','S',8.8,24.99,139.7,78.74,139.7,81.28,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1270,'Herma','4473 Laser/Inkjet A4 weiß','S',5.0,0.0,41.0,70.0,41.0,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1271,'Herma','4474 Laser/Inkjet A4 weiß','S',21.5,8.0,25.4,48.5,25.4,48.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1272,'Herma','4475 Laser/Inkjet A4 weiß','S',5.0,0.0,41.0,105.0,41.0,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1273,'Herma','4476 Laser/Inkjet A4 Kreise 40 mm weiß','S',13.5,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (1274,'Herma','4477 Laser/Inkjet A4 Kreise 60 mm weiß','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1275,'Herma','4478 Laser/Inkjet A4 Kreise 85 mm weiß','S',11.0,15.0,85.0,85.0,95.0,95.0,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1276,'Herma','4479 Laser/Inkjet A4 weiß Ecken abgerundet','S',13.03,12.29,33.87,88.9,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1277,'Herma','4606 Laser/Inkjet A4 weiß','S',10.7,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (1278,'Herma','4607 Laser/Inkjet A4 weiß','S',13.06,8.48,16.93,48.26,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (1279,'Herma','4608 Laser/Inkjet A4 weiß','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1280,'Herma','4609 Laser/Inkjet A4 weiß','S',0.0,0.0,21.2,52.5,21.2,52.5,4,14, NULL, NULL ) +INSERT INTO label_def VALUES (1281,'Herma','4610 Laser/Inkjet A4 weiß','S',0.0,0.0,29.7,52.5,29.7,52.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1282,'Herma','4611 Laser/Inkjet A4 weiß','S',4.6,0.0,16.93,70.0,16.93,70.0,3,17, NULL, NULL ) +INSERT INTO label_def VALUES (1283,'Herma','4612 Laser/Inkjet A4 weiß','S',0.0,0.0,29.7,70.0,29.7,70.0,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (1284,'Herma','4613 Laser/Inkjet A4 weiß','S',8.8,6.0,25.4,66.0,25.4,66.0,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (1285,'Herma','4614 Laser/Inkjet A4 weiß','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1286,'Herma','4615 Laser/Inkjet A4 weiß','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1287,'Herma','4616 Laser/Inkjet A4 weiß','S',0.0,0.0,42.43,70.0,42.43,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1288,'Herma','4617 Laser/Inkjet A4 3 5\"-Disketten weiß','S',13.03,0.0,67.73,70.0,67.73,70.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1289,'Herma','4618 Laser/Inkjet A4 3 5\"-Disketten weiß','S',21.5,0.0,50.8,70.0,50.8,70.0,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (1290,'Herma','4619 Laser/Inkjet A4 weiß','S',13.03,8.48,33.87,96.52,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1291,'Herma','4620 Laser/Inkjet A4 weiß','S',0.0,0.0,37.13,105.0,37.13,105.0,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1292,'Herma','4623 Laser/Inkjet A4 weiß','S',21.51,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1293,'Herma','4624 Laser/Inkjet A4 weiß','S',13.03,8.48,67.73,96.52,67.73,96.52,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1294,'Herma','4625 Laser/Inkjet A4 weiß','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1295,'Herma','4626 Laser/Inkjet A4 weiß','S',0.0,0.0,74.25,105.0,74.25,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1296,'Herma','4627 Laser/Inkjet A4 weiß A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1297,'Herma','4628 Laser/Inkjet A4 weiß A5','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1298,'Herma','4629 Laser/Inkjet A4 weiß','S',21.5,0.0,50.8,105.0,50.8,105.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1299,'Herma','4631 Laser/Inkjet A4 weiß','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1300,'Herma','4649a SuperPrint MiniDisk weiß','S',12.5,15.0,52.0,36.0,55.0,36.0,5,5, NULL, NULL ) +INSERT INTO label_def VALUES (1301,'Herma','4649b SuperPrint MiniDisk-Hülle weiß','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1302,'Herma','4654 Laser/Inkjet A4 weiß','S',12.0,0.0,39.0,105.0,39.0,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1303,'Herma','4666 Laser/Inkjet A4 weiß Ecken abgerundet','S',8.8,12.29,46.56,88.9,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1304,'Herma','4667 Laser/Inkjet A4 weiß Ecken abgerundet','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1305,'Herma','4668 Laser/Inkjet A4 weiß','S',0.0,0.0,42.43,70.0,42.43,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1306,'Herma','4669 Laser/Inkjet A4 weiß','S',21.5,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1307,'Herma','4670 Laser/Inkjet A4 weiß','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1308,'Herma','4672 Laser/Inkjet A4 weiß','S',13.03,8.48,33.87,96.52,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1309,'Herma','4674 Laser/Inkjet A4 weiß','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1310,'Herma','4676 Laser/Inkjet A4 weiß A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1311,'Herma','4677 Laser/Inkjet A4 weiß Ecken abgerundet','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1312,'Herma','4678 Laser/Inkjet A4 weiß Ecken abgerundet','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1313,'Herma','4680 Laser A4 transparente Folie','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1314,'Herma','4681 Laser A4 transparente Folie','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1315,'Herma','4682 Laser A4 transparente Folie','S',21.5,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1316,'Herma','4683 Laser A4 transparente Folie A5','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1317,'Herma','4684 Laser A4 transparente Folie','S',0.0,0.0,29.7,52.5,29.7,52.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1318,'Herma','4685 Laser A4 transparente Folie','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1319,'Herma','4686 Laser A4 Kreise 40 mm transparent','S',13.5,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (1320,'Herma','4690 Laser A4 weiße Folie','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1321,'Herma','4691 Laser A4 weiße Folie','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1322,'Herma','4692 Laser A4 weiße Folie','S',21.5,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1323,'Herma','4693 Laser A4 weiße Folie A5','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1324,'Herma','4694 Laser A4 weiße Folie','S',0.0,0.0,29.7,52.5,29.7,52.5,4,10, NULL, NULL ) +INSERT INTO label_def VALUES (1325,'Herma','4695 Laser A4 weiße Folie','S',0.0,0.0,37.13,70.0,37.13,70.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1326,'Herma','4696 Laser A4 weiße Folie','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1327,'Herma','4697 Laser A4 weiße Folie','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1328,'Herma','4698 Laser A4 weiße Folie','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1329,'Herma','4810 InkPrint Special weiß','S',10.7,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (1330,'Herma','4811 InkPrint Special weiß','S',13.03,8.48,16.93,48.26,16.93,48.26,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (1331,'Herma','4812 InkPrint Special weiß','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1332,'Herma','4814 InkPrint Special weiß','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1333,'Herma','4815 InkPrint Special weiß','S',13.03,8.48,33.87,96.52,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1334,'Herma','4816 InkPrint Special weiß','S',21.5,8.48,42.3,96.52,42.3,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1335,'Herma','4817 InkPrint Special weiß','S',13.03,8.48,67.73,96.52,67.73,96.52,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1336,'Herma','4819 InkPrint Special weiß','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1337,'Herma','4820 InkPrint Special weiß','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1338,'Herma','4821 InkPrint Special 3 5\"-Disketten weiß','S',13.03,6.0,67.73,66.0,67.73,66.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1339,'Herma','4822 InkPrint Special weiß','S',13.03,8.48,33.87,96.52,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1340,'Herma','4823 InkPrint Special weiß','S',21.5,8.48,42.3,96.52,42.3,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1341,'Herma','4824 InkPrint Special weiß','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1342,'Herma','4825 InkPrint Special für schmale Ordner weiß','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1343,'Herma','4826 InkPrint Special für breite Ordner weiß','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1344,'Herma','4827 InkPrint Special Videocassette Rücken weiß','S',18.5,31.34,20.0,147.32,20.0,147.32,1,13, NULL, NULL ) +INSERT INTO label_def VALUES (1345,'Herma','4828 InkPrint Special Videocassette Front weiß','S',8.82,24.99,46.56,78.74,46.56,81.28,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1346,'Herma','4829 InkPrint Special Diabeschriftung weiß','S',12.98,14.83,8.47,43.18,8.47,45.72,4,32, NULL, NULL ) +INSERT INTO label_def VALUES (1347,'Herma','4830 InkPrint Special für schmale Ordner lang weiß','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1348,'Herma','4831 InkPrint Special für breite Ordner lang weiß','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1349,'Herma','4841 InkPrint Special transparente Folie','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1350,'Herma','4842 InkPrint Special transparente Folie','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1351,'Herma','4843 InkPrint Special transparente Folie','S',21.5,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1352,'Herma','4844 InkPrint Special transparente Folie A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1353,'Herma','4845 InkPrint Special transparente Folie','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1354,'Herma','4846 InkPrint Special transparente Folie','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1355,'Herma','4847 InkPrint Special transparente Folie','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1356,'Herma','4848 InkPrint Special CD-Etikett transparente Folie','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1357,'Herma','4851 InkPrint Special weiße Folie','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1358,'Herma','4852 InkPrint Special weiße Folie','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1359,'Herma','4853 InkPrint Special weiße Folie','S',21.5,8.48,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1360,'Herma','4854 InkPrint Special weiße Folie A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1361,'Herma','5051 Laser/Inkjet A4 weiß','S',8.8,8.48,25.4,48.26,25.4,48.26,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1362,'Herma','5052 Laser/Inkjet A4 weiß','S',0.0,0.0,21.2,52.5,21.2,52.5,4,14, NULL, NULL ) +INSERT INTO label_def VALUES (1363,'Herma','5053 Laser/Inkjet A4 weiß','S',13.03,6.0,33.87,66.0,33.87,66.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1364,'Herma','5054 Laser/Inkjet A4 weiß','S',0.0,0.0,42.43,70.0,42.43,70.0,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1365,'Herma','5055 Laser/Inkjet A4 3 5\"-Disketten weiß','S',21.5,0.0,50.8,70.0,50.8,70.0,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (1366,'Herma','5056 Laser/Inkjet A4 weiß','S',21.51,8.5,42.33,96.52,42.33,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1367,'Herma','5057 Laser/Inkjet A4 weiß','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1368,'Herma','5058 Laser/Inkjet A4 gelb','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1369,'Herma','5059 Laser/Inkjet A4 rot','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1370,'Herma','5060 Laser/Inkjet A4 blau','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1371,'Herma','5061 Laser/Inkjet A4 grün','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1372,'Herma','5062 Laser/Inkjet A4 weiß','S',0.0,0.0,74.25,105.0,74.25,105.0,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1373,'Herma','5063 Laser/Inkjet A4 weiß A6','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1374,'Herma','5064 Laser/Inkjet A4 weiß A5','S',0.0,0.0,148.5,210.0,148.5,210.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1375,'Herma','5065 Laser/Inkjet A4 weiß A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1376,'Herma','5066 Laser/Inkjet A4 Kreise 40 mm weiß','S',13.5,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (1377,'Herma','5067 Laser/Inkjet A4 Kreise 60 mm weiß','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1378,'Herma','5068 Laser/Inkjet A4 Kreise 85 mm weiß','S',11.0,15.0,85.0,85.0,95.0,95.0,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1379,'Herma','5069 Laser/Inkjet A4 Videocassette Rücken weiß','S',18.5,31.34,20.0,147.32,20.0,147.32,1,13, NULL, NULL ) +INSERT INTO label_def VALUES (1380,'Herma','5070 Laser/Inkjet A4 Videocassette Front weiß','S',8.82,24.99,46.56,78.74,46.56,81.28,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1381,'Herma','5071 Laser/Inkjet A4 Diabeschriftung weiß','S',12.98,14.83,8.47,43.18,8.47,45.72,4,32, NULL, NULL ) +INSERT INTO label_def VALUES (1382,'Herma','5072 Laser/Inkjet A4 Pfeile gelb','S',19.38,11.02,25.4,91.44,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1383,'Herma','5073 Laser/Inkjet A4 Pfeile rot','S',19.38,11.02,25.4,91.44,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1384,'Herma','5074 Laser/Inkjet A4 weiß Ecken abgerundet ablösbar','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1385,'Herma','5075 Laser/Inkjet A4 weiß Ecken abgerundet','S',13.03,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1386,'Herma','5076 Laser/Inkjet A4 weiß Ecken abgerundet','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1387,'Herma','5077 Laser/Inkjet A4 weiß Ecken abgerundet','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1388,'Herma','5078 Laser/Inkjet A4 CD-Box-Etiketten weiß','S',16.5,47.85,5.5,114.3,5.5,114.3,1,48, NULL, NULL ) +INSERT INTO label_def VALUES (1389,'Herma','5079 Laser/Inkjet A4 CD-Etikett weiß','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1390,'Herma','5080 Laser/Inkjet A4 weiß ablösbar','S',0.0,0.0,21.2,52.5,21.2,52.5,4,14, NULL, NULL ) +INSERT INTO label_def VALUES (1391,'Herma','5081 Laser/Inkjet A4 weiß ablösbar','S',0.0,0.0,42.43,105.0,42.43,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1392,'Herma','5082 Laser/Inkjet A4 weiß ablösbar','S',0.0,0.0,148.5,105.0,148.5,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1393,'Herma','5083 Laser/Inkjet A4 CD-Etikett gelb','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1394,'Herma','5084 Laser/Inkjet A4 CD-Etikett rot','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1395,'Herma','5085 Laser/Inkjet A4 CD-Etikett blau','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1396,'Herma','5086 Laser/Inkjet A4 CD-Etikett grün','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1397,'Herma','5087 Laser/Inkjet A4 ZIP-Disketten weiß','S',23.5,13.75,50.0,59.0,50.0,61.75,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (1398,'Herma','5088 Laser/Inkjet A4 für schmale Ordner farbig sort.','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1399,'Herma','5089 Laser/Inkjet A4 für breite Ordner farbig sort.','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1400,'Herma','5090 Laser/Inkjet A4 für schmale Ordner weiß','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1401,'Herma','5091 Laser/Inkjet A4 für schmale Ordner gelb','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1402,'Herma','5092 Laser/Inkjet A4 für schmale Ordner rot','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1403,'Herma','5093 Laser/Inkjet A4 für schmale Ordner blau','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1404,'Herma','5094 Laser/Inkjet A4 für schmale Ordner grün','S',15.5,9.0,38.0,192.0,38.0,192.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1405,'Herma','5095 Laser/Inkjet A4 für breite Ordner weiß','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1406,'Herma','5096 Laser/Inkjet A4 für breite Ordner gelb','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1407,'Herma','5097 Laser/Inkjet A4 für breite Ordner rot','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1408,'Herma','5098 Laser/Inkjet A4 für breite Ordner blau','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1409,'Herma','5099 Laser/Inkjet A4 für breite Ordner grün','S',26.5,9.0,61.0,192.0,61.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1410,'Herma','5123 Laser/Inkjet A4 für breite Ordner weiß','S',30.5,9.0,59.0,192.0,59.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1411,'Herma','5124 Laser/Inkjet A4 für breite Ordner gelb','S',30.5,9.0,59.0,192.0,59.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1412,'Herma','5125 Laser/Inkjet A4 für breite Ordner rot','S',30.5,9.0,59.0,192.0,59.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1413,'Herma','5126 Laser/Inkjet A4 für breite Ordner blau','S',30.5,9.0,59.0,192.0,59.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1414,'Herma','5127 Laser/Inkjet A4 für breite Ordner grün','S',30.5,9.0,59.0,192.0,59.0,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1415,'Herma','5128 Laser/Inkjet A4 für schmale Ordner lang farbig sort.','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1416,'Herma','5129 Laser/Inkjet A4 für breite Ordner lang farbig sort.','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1417,'Herma','5130 Laser/Inkjet A4 für schmale Ordner lang weiß','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1418,'Herma','5131 Laser/Inkjet A4 für schmale Ordner lang gelb','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1419,'Herma','5132 Laser/Inkjet A4 für schmale Ordner lang rot','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1420,'Herma','5133 Laser/Inkjet A4 für schmale Ordner lang blau','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1421,'Herma','5134 Laser/Inkjet A4 für schmale Ordner lang grün','S',0.0,10.0,297.0,38.0,297.0,38.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1422,'Herma','5135 Laser/Inkjet A4 für breite Ordner lang weiß','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1423,'Herma','5136 Laser/Inkjet A4 für breite Ordner lang gelb','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1424,'Herma','5137 Laser/Inkjet A4 für breite Ordner lang rot','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1425,'Herma','5138 Laser/Inkjet A4 für breite Ordner lang blau','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1426,'Herma','5139 Laser/Inkjet A4 für breite Ordner lang grün','S',0.0,13.5,297.0,61.0,297.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1427,'Herma','5140 Laser A4 neon-gelb','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1428,'Herma','5141 Laser A4 neon-orange','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1429,'Herma','5142 Laser A4 neon-pink','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1430,'Herma','5143 Laser A4 neon-grün','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1431,'Herma','5144 Laser A4 neon-gelb','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1432,'Herma','5145 Laser A4 neon-orange','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1433,'Herma','5146 Laser A4 neon-pink','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1434,'Herma','5147 Laser A4 neon-grün','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1435,'Herma','5148 Laser A4 neon-gelb A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1436,'Herma','5149 Laser A4 neon-orange A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1437,'Herma','5150 Laser A4 neon-pink A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1438,'Herma','5151 Laser A4 neon-grün A4','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1439,'Herma','5152 Laser A4 neon-gelb Kreise 60 mm','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1440,'Herma','5153 Laser A4 neon-orange Kreise 60 mm','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1441,'Herma','5154 Laser A4 neon-pink Kreise 60 mm','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1442,'Herma','5155 Laser A4 neon-grün Kreise 60 mm','S',18.0,8.0,60.0,60.0,67.0,67.0,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1443,'Herma','5158 Laser/Inkjet A4 für schmale Ordner lang weiß','S',0.0,20.0,297.0,34.0,297.0,34.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1444,'Herma','5159 Laser/Inkjet A4 für breite Ordner lang weiß','S',0.0,16.5,297.0,59.0,297.0,59.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1445,'Herma','5160 Laser/Inkjet A4 für schmale Ordner weiß','S',12.5,9.0,34.0,192.0,34.0,192.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1446,'Herma','5161 Laser/Inkjet A4 für schmale Ordner gelb','S',12.5,9.0,34.0,192.0,34.0,192.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1447,'Herma','5162 Laser/Inkjet A4 für schmale Ordner rot','S',12.5,9.0,34.0,192.0,34.0,192.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1448,'Herma','5163 Laser/Inkjet A4 für schmale Ordner blau','S',12.5,9.0,34.0,192.0,34.0,192.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1449,'Herma','5164 Laser/Inkjet A4 für schmale Ordner grün','S',12.5,9.0,34.0,192.0,34.0,192.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1450,'Herma','5165 Laser/Inkjet A4 für schmale Hängeordner weiß','S',0.0,20.0,297.0,34.0,297.0,34.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1451,'Herma','5166 Laser/Inkjet A4 für breite Hängeordner weiß','S',0.0,18.0,297.0,58.0,297.0,58.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1452,'Herma','5167 Laser/Inkjet A4 für breite Hängeordner weiß','S',0.0,10.5,297.0,63.0,297.0,63.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1453,'Herma','8600 Laser/Inkjet A5 Kreise 10 mm weiß ablösbar','S',12.1,11.1,10.0,10.0,12.7,12.7,15,10, NULL, NULL ) +INSERT INTO label_def VALUES (1454,'Herma','8601 Laser/Inkjet A5 Kreise 20 mm weiß ablösbar','S',6.75,14.5,20.0,20.0,23.0,23.0,8,6, NULL, NULL ) +INSERT INTO label_def VALUES (1455,'Herma','8602 Laser/Inkjet A5 Kreise 60 mm gelb ablösbar','S',10.75,8.0,60.0,60.0,67.0,67.0,3,2, NULL, NULL ) +INSERT INTO label_def VALUES (1456,'Herma','8603 Laser/Inkjet A5 weiß Ecken abgerundet ablösbar','S',10.5,7.21,8.5,12.7,8.5,15.24,13,15, NULL, NULL ) +INSERT INTO label_def VALUES (1457,'Herma','8604 Laser/Inkjet A5 weiß Ecken abgerundet ablösbar','S',14.25,4.57,10.0,17.8,10.0,20.34,10,12, NULL, NULL ) +INSERT INTO label_def VALUES (1458,'Herma','8605 Laser/Inkjet A5 weiß Ecken abgerundet ablösbar','S',15.0,8.48,16.93,25.4,16.93,27.94,7,7, NULL, NULL ) +INSERT INTO label_def VALUES (1459,'Herma','8606 Laser/Inkjet A5 Diabeschriftung weiß','S',14.25,9.75,10.0,45.72,10.0,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1460,'Herma','8607 Laser/Inkjet A5 Sichtreiteretiketten weiß','S',15.0,9.75,16.93,45.72,16.93,48.26,4,7, NULL, NULL ) +INSERT INTO label_def VALUES (1461,'Herma','8608 Laser/Inkjet A5 weiß Ecken abgerundet','S',15.0,7.21,29.63,63.5,29.63,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1462,'Herma','8609 Laser/Inkjet A5 weiß Ecken abgerundet','S',10.76,7.73,42.33,96.0,42.33,98.54,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1463,'Herma','8610 Laser/Inkjet A5 weiß Ecken abgerundet','S',10.75,7.73,63.5,96.0,63.5,98.54,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1464,'Herma','8611 Laser/Inkjet A5 3 5\"-Disketten farbig sortiert','S',6.52,25.0,67.73,70.0,67.73,90.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1465,'Herma','8612 Laser/Inkjet A5 Videoetiketten Front weiß','S',27.69,24.99,46.46,78.74,46.46,81.28,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1466,'Herma','8613 Laser/Inkjet A5 Videoetiketten Rücken weiß','S',15.0,31.34,16.93,147.32,16.93,147.32,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1467,'Herma','8614 Laser/Inkjet A5 Musik-Cassetten weiß','S',10.76,14.73,42.33,89.0,42.33,91.54,2,3, NULL, NULL ) +INSERT INTO label_def VALUES (1468,'Herma','8615 Laser/Inkjet A5 für schmale Ordner farbig sortiert','S',17.25,9.0,38.0,192.0,38.0,192.0,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (1469,'Herma','8616 Laser/Inkjet A5 für breite Ordner farbig sortiert','S',13.25,9.0,61.0,192.0,61.0,192.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1470,'Herma','8650 ColorPrint weiß Ecken abgerundet','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1471,'Herma','8651 ColorPrint weiß Ecken abgerundet','S',13.03,12.29,33.87,88.9,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1472,'Herma','8652 ColorPrint weiß Ecken abgerundet','S',8.82,12.29,46.56,88.9,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1473,'Herma','8653 ColorPrint weiß Ecken abgerundet','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1474,'Herma','8654 ColorPrint weiß Ecken abgerundet','S',8.8,7.73,139.7,96.0,139.7,98.54,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1475,'Herma','8655 ColorPrint weiß Ecken abgerundet','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1476,'Herma','8680 ColorPrint weiß Ecken abgerundet','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1477,'Herma','8681 ColorPrint weiß Ecken abgerundet','S',8.82,12.29,46.56,88.9,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1478,'Herma','8682 ColorPrint weiß Ecken abgerundet','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1479,'Herma','8800 InkPrint Special weiß Ecken abgerundet','S',13.03,17.37,33.87,53.34,33.87,60.96,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1480,'Herma','8801 InkPrint Special weiß Ecken abgerundet','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1481,'Herma','8802 InkPrint Special weiß Ecken abgerundet','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1482,'Herma','8803 InkPrint Special 3 5\"-Disketten weiß','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1483,'Herma','8804 InkPrint Special weiß Ecken abgerundet','S',13.03,12.29,33.87,88.9,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1484,'Herma','8805 InkPrint Special weiß Ecken abgerundet','S',8.8,12.29,46.57,88.9,46.57,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1485,'Herma','8806 InkPrint Special weiß Ecken abgerundet','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1486,'Herma','8807 InkPrint Special weiß z.B. Paketadresse ca. A6','S',8.8,7.73,139.7,96.0,139.7,98.54,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1487,'Herma','8808 InkPrint Special weiß Ecken abgerundet','S',13.03,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1488,'Herma','8809 InkPrint Special weiß Ecken abgerundet','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1489,'Herma','8810 InkPrint Special weiß Ecken abgerundet','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1490,'Herma','8811 InkPrint Special weiß ca. DIN A5','S',8.8,9.0,139.7,192.0,139.7,192.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1491,'Herma','8830 InkPrint Special weiß z.B. für Preisauszeichnung','S',13.03,8.48,8.47,25.4,8.47,27.94,7,32, NULL, NULL ) +INSERT INTO label_def VALUES (1492,'Herma','8831 InkPrint Special weiß quadratisch','S',8.8,16.1,25.4,25.4,25.4,30.48,6,11, NULL, NULL ) +INSERT INTO label_def VALUES (1493,'Herma','8832 InkPrint Special weiß z.B. für Preisauszeichnung','S',13.03,7.21,16.93,30.48,16.93,33.02,6,16, NULL, NULL ) +INSERT INTO label_def VALUES (1494,'Herma','8833 InkPrint Special weiß','S',10.7,9.75,21.2,38.1,21.2,38.1,5,13, NULL, NULL ) +INSERT INTO label_def VALUES (1495,'Herma','8834 InkPrint Special weiß','S',13.3,8.4,16.93,48.3,16.93,48.3,4,16, NULL, NULL ) +INSERT INTO label_def VALUES (1496,'Herma','8835 InkPrint Special weiß','S',8.8,8.4,25.4,48.3,25.4,48.3,4,11, NULL, NULL ) +INSERT INTO label_def VALUES (1497,'Herma','8836 InkPrint Special weiß Ecken abgerundet','S',13.03,17.37,33.87,53.34,33.87,60.96,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1498,'Herma','8837 InkPrint Special weiß Ecken abgerundet','S',8.8,7.21,25.4,63.5,25.4,66.04,3,11, NULL, NULL ) +INSERT INTO label_def VALUES (1499,'Herma','8838 InkPrint Special weiß Ecken abgerundet','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1500,'Herma','8839 InkPrint Special 3 5\"-Disketten weiß','S',21.5,25.0,50.8,70.0,50.8,90.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1501,'Herma','8840 InkPrint Special weiß Visitenkartenformat','S',21.5,18.64,50.8,83.82,50.8,88.9,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1502,'Herma','8841 InkPrint Special weiß Ecken abgerundet','S',13.03,12.29,33.87,88.9,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1503,'Herma','8842 InkPrint Special weiß Ecken abgerundet','S',8.82,12.29,46.56,88.9,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1504,'Herma','8843 InkPrint Special weiß z.B. für Regalbeschriftung','S',13.03,7.73,8.47,96.0,8.47,98.54,2,32, NULL, NULL ) +INSERT INTO label_def VALUES (1505,'Herma','8844 InkPrint Special weiß z.B. für Regalbeschriftung','S',13.03,7.73,16.93,96.0,16.93,98.54,2,16, NULL, NULL ) +INSERT INTO label_def VALUES (1506,'Herma','8845 InkPrint Special weiß Ecken abgerundet','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1507,'Herma','8846 InkPrint Special weiß','S',13.03,8.48,67.73,96.52,67.73,96.52,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1508,'Herma','8847 InkPrint Special weiß Paketadresse ca. A6','S',8.8,7.73,139.7,96.0,139.7,98.54,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1509,'Herma','8848 InkPrint Special weiß z.B. für Regalbeschriftung','S',13.03,9.0,8.47,192.0,8.47,192.0,1,32, NULL, NULL ) +INSERT INTO label_def VALUES (1510,'Herma','8849 InkPrint Special weiß z.B. für Regalbeschriftung','S',13.03,9.0,16.93,192.0,16.93,192.0,1,16, NULL, NULL ) +INSERT INTO label_def VALUES (1511,'Herma','8850 InkPrint Special weiß ca. DIN A5','S',8.8,9.0,139.7,192.0,139.7,192.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1512,'Herma','8851 InkPrint Special Kreise 32 mm weiß','S',18.2,12.8,32.0,32.0,38.1,38.1,5,7, NULL, NULL ) +INSERT INTO label_def VALUES (1513,'Herma','8852 InkPrint Special Kreise 63 5 mm weiß','S',15.16,7.21,63.5,63.5,67.73,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1514,'Herma','8853 InkPrint Special Oval weiß','S',10.92,12.29,42.33,58.42,46.56,63.5,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1515,'Herma','8854 InkPrint Special Oval weiß','S',15.15,13.56,63.5,88.9,67.73,93.98,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1516,'Herma','8855 InkPrint Special abgeschrägte Ecken weiß','S',13.03,12.29,67.73,88.9,67.73,96.52,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1517,'Herma','8856 InkPrint Special Registeretiketten weiß','S',10.92,16.1,42.3,25.4,46.56,30.48,6,6, NULL, NULL ) +INSERT INTO label_def VALUES (1518,'Herma','8857 InkPrint Special Sterne 63 5 mm weiß','S',15.16,7.21,63.5,63.5,67.73,66.04,3,4, NULL, NULL ) +INSERT INTO label_def VALUES (1519,'Herma','8858 InkPrint Special weiß Ecken abgerundet','S',8.82,7.21,46.56,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1520,'Herma','8859 InkPrint Special weiß Ecken abgerundet','S',13.03,4.67,33.87,99.06,33.87,101.6,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1521,'Herma','8860 InkPrint Special weiß Ecken abgerundet','S',15.15,4.67,38.1,99.06,38.1,101.6,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1522,'Herma','8861 InkPrint Special weiß Ecken abgerundet','S',6.0,4.67,57.0,99.06,57.0,101.6,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1523,'Herma','8862 InkPrint Special weiß Ecken abgerundet','S',13.03,4.67,67.73,99.06,67.73,101.6,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1524,'Herma','8863 InkPrint Special Kreise 40 mm weiß','S',13.5,16.0,40.0,40.0,46.0,46.0,4,6, NULL, NULL ) +INSERT INTO label_def VALUES (1525,'Herma','8864 InkPrint Special weiß Ecken abgerundet','S',21.5,9.75,21.17,45.72,21.17,48.26,4,12, NULL, NULL ) +INSERT INTO label_def VALUES (1526,'Herma','8865 InkPrint Special weiß Ecken abgerundet','S',15.15,7.21,29.63,63.5,29.63,66.04,3,9, NULL, NULL ) +INSERT INTO label_def VALUES (1527,'Herma','8866 InkPrint Special weiß Ecken abgerundet','S',21.5,7.73,42.33,96.0,42.33,98.54,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1528,'Herma','8867 InkPrint Special weiß Ecken abgerundet','S',21.5,7.73,63.5,96.0,63.5,98.54,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1529,'Herma','8868 InkPrint Special Sonderform weiß','S',10.93,7.21,42.33,63.5,46.57,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1530,'Herma','8869 InkPrint Special Oval weiß','S',10.93,7.21,42.33,63.5,46.57,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1531,'Herma','8870 InkPrint Special Oval weiß','S',15.15,7.73,63.5,96.0,67.73,98.54,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1532,'Herma','8887 InkPrint Special Glossy Paßfoto-Format Two-in-one','S',24.0,26.0,45.0,35.0,51.0,41.0,4,5, NULL, NULL ) +INSERT INTO label_def VALUES (1533,'Herma','8888 InkPrint Special Glossy CD-Cover-Etikett/Einleger Two-in-one','S',17.0,44.25,117.5,121.5,145.5,121.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1534,'Herma','8889 InkPrint Special Glossy Visitenkartenetikett Two-in-one','S',12.5,15.5,52.0,83.0,55.0,96.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1535,'Herma','8890 InkPrint Special Glossy-Qualität Ecken abgerundet','S',15.15,7.21,38.1,63.5,38.1,66.04,3,7, NULL, NULL ) +INSERT INTO label_def VALUES (1536,'Herma','8891 InkPrint Special Glossy-Qualität Ecken abgerundet','S',13.03,12.29,33.87,88.9,33.87,96.52,2,8, NULL, NULL ) +INSERT INTO label_def VALUES (1537,'Herma','8892 InkPrint Special Glossy-Qualität Ecken abgerundet','S',8.82,12.29,46.56,88.9,46.56,96.52,2,6, NULL, NULL ) +INSERT INTO label_def VALUES (1538,'Herma','8893 InkPrint Special Glossy-Qualität Ecken abgerundet','S',21.5,7.73,50.8,96.0,50.8,98.54,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1539,'Herma','8894 InkPrint Special Glossy-Qualität Ecken abgerundet','S',8.8,7.73,139.7,96.0,139.7,98.54,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1540,'Herma','8895 InkPrint Special Glossy-Qualität weiß','S',0.0,0.0,297.0,210.0,297.0,210.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1541,'Herma','8896 InkPrint Special Glossy Ecken abgerundet','S',23.64,7.21,46.56,63.5,50.79,66.04,3,5, NULL, NULL ) +INSERT INTO label_def VALUES (1542,'Herma','8897 InkPrint Special Glossy Ecken abgerundet','S',15.15,13.56,63.5,88.9,67.73,93.98,2,4, NULL, NULL ) +INSERT INTO label_def VALUES (1543,'Herma','8898 InkPrint Special Glossy Fotos 9x13 Two-in-one','S',19.32,13.56,127.0,88.9,131.23,93.98,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1544,'Herma','8899 InkPrint Special Glossy Fotos 13x18 Two-in-one','S',18.43,16.0,127.0,178.0,133.0,178.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1545,'Herma','8900 InkPrint Special Glossy CD-Etikett weiß','S',16.5,47.0,116.0,116.0,148.0,116.0,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1546,'Herma','8901 InkPrint Special Glossy oval','S',10.93,7.21,42.33,63.5,46.56,66.04,3,6, NULL, NULL ) +INSERT INTO label_def VALUES (1547,'Herma','8001 Endlosetiketten 1-bahnig','C',0.0,11.05,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1548,'Herma','8002 Endlosetiketten 3-bahnig Kennzeichnung','C',0.0,14.86,14.53,25.4,16.93,27.94,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1549,'Herma','8003 Endlosetiketten 2-bahnig Kennzeichnung','C',0.0,18.67,19.0,35.56,21.17,38.1,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1550,'Herma','8004 Endlosetiketten 2-bahnig Diabeschriftung','C',0.0,11.05,10.3,43.18,12.7,45.72,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1551,'Herma','8005 Endlosetiketten 2-bahnig Kennzeichnung','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1552,'Herma','8006 Endlosetiketten 2-bahnig Kennzeichnung','C',0.0,13.59,14.53,40.64,16.93,43.18,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1553,'Herma','8007 Endlosetiketten 2-bahnig Kennzeichnung','C',0.0,11.05,35.7,43.18,38.1,45.72,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1554,'Herma','8008 Endlosetiketten 1-bahnig 3 5\"-Diskette weiß','C',0.0,19.94,69.6,71.12,76.2,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1555,'Herma','8009 Endlosetiketten 1-bahnig Namensetiketten Acetatseide','C',0.0,17.0,23.0,70.0,25.4,70.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1556,'Herma','8010 Endlosetiketten 1-bahnig 3 5\"-Diskette weiß Front','C',0.0,14.44,48.4,71.12,50.8,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1557,'Herma','8011 Endlosetiketten 1-bahnig 3 5\"-Diskette gelb','C',0.0,17.0,69.6,71.12,76.2,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1558,'Herma','8012 Endlosetiketten 1-bahnig 3 5\"-Diskette rot','C',0.0,17.0,69.6,71.12,76.2,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1559,'Herma','8013 Endlosetiketten 1-bahnig 3 5\"-Diskette blau','C',0.0,17.0,69.6,71.12,76.2,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1560,'Herma','8014 Endlosetiketten 1-bahnig','C',0.0,15.71,35.7,68.58,38.1,68.58,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1561,'Herma','8015 Endlosetiketten 1-bahnig 3 5\"-Diskette grün','C',0.0,17.0,69.6,71.12,76.2,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1562,'Herma','8021 Endlosetiketten 2-bahnig gelb','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1563,'Herma','8022 Endlosetiketten 2-bahnig rot','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1564,'Herma','8036 Endlosetiketten 2-bahnig ablösbar','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1565,'Herma','8038 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1566,'Herma','8039 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.05,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1567,'Herma','8040 Endlosetiketten 1-bahnig','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1568,'Herma','8041 Endlosetiketten 1-bahnig gelb','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1569,'Herma','8042 Endlosetiketten 1-bahnig rot','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1570,'Herma','8043 Endlosetiketten 1-bahnig blau','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1571,'Herma','8045 Endlosetiketten 1-bahnig grün','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1572,'Herma','8050 Endlosetiketten 1-bahnig','C',0.0,11.05,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1573,'Herma','8051 Endlosetiketten 2-bahnig PE-Folie weiß','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1574,'Herma','8053 Endlosetiketten 2-bahnig PP-Folie weiß','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1575,'Herma','8055 Endlosetiketten 2-bahnig transparente Folie','C',0.0,16.13,23.0,38.1,25.4,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1576,'Herma','8060 Endlosetiketten 1-bahnig','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1577,'Herma','8061 Endlosetiketten 1-bahnig','C',0.0,11.05,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1578,'Herma','8066 Endlosetiketten 1-bahnig','C',0.0,11.7,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1579,'Herma','8067 Endlosetiketten 1-bahnig','C',0.0,9.16,35.7,106.68,38.1,106.68,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1580,'Herma','8068 Endlosetiketten 1-bahnig','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1581,'Herma','8069 Endlosetiketten 1-bahnig','C',0.0,9.16,48.4,106.68,50.8,106.68,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1582,'Herma','8070 Endlosetiketten 1-bahnig','C',0.0,11.62,48.4,111.76,50.8,111.76,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1583,'Herma','8071 Endlosetiketten 1-bahnig Videocassetten','C',0.0,11.34,19.0,147.32,25.4,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1584,'Herma','8072 Endlosetiketten 1-bahnig Querperforation weiß','C',0.0,11.0,99.2,147.32,101.6,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1585,'Herma','8073 Endlosetiketten 1-bahnig Querperforation gelb','C',0.0,11.0,99.2,147.32,101.6,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1586,'Herma','8074 Endlosetiketten 1-bahnig Querperforation rot','C',0.0,11.0,99.2,147.32,101.6,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1587,'Herma','8104 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.05,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1588,'Herma','8111 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1589,'Herma','8112 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.7,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1590,'Herma','8113 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1591,'Herma','8116 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.62,48.4,111.76,50.8,111.76,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1592,'Herma','8121 Endlosetiketten 1-bahnig gelb','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1593,'Herma','8122 Endlosetiketten 1-bahnig rot','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1594,'Herma','8123 Endlosetiketten 1-bahnig blau','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1595,'Herma','8125 Endlosetiketten 1-bahnig grün','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1596,'Herma','8130 Endlosetiketten 1-bahnig transparente Folie','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1597,'Herma','8135 Endlosetiketten 1-bahnig transparente Folie','C',0.0,11.0,73.8,147.32,76.2,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1598,'Herma','8140 Endlosetiketten 1-bahnig PP-Folie weiß','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1599,'Herma','8145 Endlosetiketten 1-bahnig PP-Folie weiß','C',0.0,11.0,73.8,147.32,76.2,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1600,'Herma','8150 Endlosetiketten 1-bahnig PE-Folie weiß','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1601,'Herma','8155 Endlosetiketten 1-bahnig PE-Folie weiß','C',0.0,11.0,73.8,147.32,76.2,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1602,'Herma','8158 Endlosetiketten 1-bahnig Kennzeichnung','C',0.0,13.17,10.3,73.66,12.7,73.66,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1603,'Herma','8160 Endlosetiketten 1-bahnig','C',0.0,11.05,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1604,'Herma','8161 Endlosetiketten 1-bahnig','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1605,'Herma','8162 Endlosetiketten 1-bahnig','C',0.0,11.7,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1606,'Herma','8163 Endlosetiketten 1-bahnig','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1607,'Herma','8164 Endlosetiketten 1-bahnig','C',0.0,11.7,23.0,101.6,25.4,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1608,'Herma','8166 Endlosetiketten 1-bahnig','C',0.0,11.62,48.4,111.76,50.8,111.76,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1609,'Herma','8167 Endlosetiketten 2-bahnig','C',0.0,17.13,35.7,101.6,38.1,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1610,'Herma','8168 Endlosetiketten 2-bahnig','C',0.0,22.13,48.4,101.6,50.8,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1611,'Herma','8169 Endlosetiketten 2-bahnig','C',0.0,12.13,23.0,101.6,25.4,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1612,'Herma','8170 Endlosetiketten 1-bahnig ablösbar','C',0.0,11.05,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1613,'Herma','8171 Endlosetiketten 1-bahnig ablösbar','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1614,'Herma','8172 Endlosetiketten 1-bahnig ablösbar','C',0.0,15.71,35.7,68.58,38.1,68.58,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1615,'Herma','8173 Endlosetiketten 1-bahn. Querperforation ablösbar','C',0.0,11.0,48.4,147.32,50.8,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1616,'Herma','8178 Endlosetiketten 1-bahnig schnittgestanzt','C',0.0,10.0,38.1,95.0,38.1,95.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1617,'Herma','8179 Endlosetiketten 1-bahnig schnittgestanzt','C',0.0,9.0,50.8,152.0,50.8,152.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1618,'Herma','8181 Endlosetiketten 1-bahnig gelb','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1619,'Herma','8182 Endlosetiketten 1-bahnig rot','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1620,'Herma','8183 Endlosetiketten 1-bahnig blau','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1621,'Herma','8185 Endlosetiketten 1-bahnig grün','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1622,'Herma','8187 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1623,'Herma','8189 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1624,'Herma','8200 Endlosetiketten 1-bahnig','C',0.0,10.63,23.0,78.74,25.4,78.74,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1625,'Herma','8201 Endlosetiketten 1-bahnig 3 5\"-Diskette Front','C',0.0,14.44,48.4,71.12,50.8,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1626,'Herma','8202 Endlosetiketten 1-bahnig Kennzeichnung','C',0.0,13.17,10.3,73.66,12.7,73.66,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1627,'Herma','8203 Endlosetiketten 1-bahnig','C',0.0,11.7,73.8,101.6,76.2,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1628,'Herma','8204 Endlosetiketten 1-bahnig','C',0.0,11.05,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1629,'Herma','8207 Endlosetiketten 1-bahnig','C',0.0,8.81,35.7,68.58,38.1,68.58,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1630,'Herma','8209 Endlosetiketten 1-bahnig','C',0.0,9.16,35.7,106.68,38.1,106.68,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1631,'Herma','8210 Endlosetiketten 1-bahnig','C',0.0,11.05,23.0,88.9,25.4,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1632,'Herma','8211 Endlosetiketten 1-bahnig','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1633,'Herma','8212 Endlosetiketten 1-bahnig','C',0.0,11.7,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1634,'Herma','8213 Endlosetiketten 1-bahnig','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1635,'Herma','8214 Endlosetiketten 1-bahnig','C',0.0,11.7,23.0,101.6,25.4,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1636,'Herma','8215 Endlosetiketten 1-bahnig','C',0.0,11.62,35.7,111.76,38.1,111.76,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1637,'Herma','8216 Endlosetiketten 1-bahnig','C',0.0,11.62,48.4,111.76,50.8,111.76,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1638,'Herma','8217 Endlosetiketten 1-bahnig','C',0.0,11.5,23.0,127.0,25.4,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1639,'Herma','8218 Endlosetiketten 1-bahnig','C',0.0,11.5,35.7,127.0,38.1,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1640,'Herma','8219 Endlosetiketten 1-bahnig','C',0.0,12.0,19.0,134.6,21.17,134.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1641,'Herma','8220 Endlosetiketten 2-bahnig','C',0.0,11.08,35.7,88.9,38.1,91.44,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1642,'Herma','8221 Endlosetiketten 2-bahnig','C',0.0,11.08,23.0,88.9,25.4,91.44,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1643,'Herma','8222 Endlosetiketten 2-bahnig','C',0.0,10.43,35.7,50.8,38.1,53.34,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1644,'Herma','8225 Endlosetiketten 2-bahnig','C',0.0,12.13,35.7,101.6,38.1,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1645,'Herma','8226 Endlosetiketten 2-bahnig','C',0.0,11.08,48.4,88.9,50.8,91.44,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1646,'Herma','8227 Endlosetiketten 2-bahnig','C',0.0,12.13,48.4,101.6,50.8,104.14,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1647,'Herma','8228 Endlosetiketten 2-bahnig','C',0.0,16.13,10.3,38.1,12.7,40.64,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1648,'Herma','8229 Endlosetiketten 2-bahnig','C',0.0,10.43,23.0,50.8,25.4,53.34,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1649,'Herma','8230 Endlosetiketten 3-bahnig','C',0.0,12.11,23.0,88.9,25.4,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1650,'Herma','8231 Endlosetiketten 3-bahnig','C',0.0,12.11,35.7,88.9,38.1,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1651,'Herma','8232 Endlosetiketten 3-bahnig','C',0.0,11.56,35.7,101.6,38.1,104.14,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1652,'Herma','8233 Endlosetiketten 3-bahnig','C',0.0,12.44,48.4,106.68,50.8,109.22,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1653,'Herma','8234 Endlosetiketten 3-bahnig','C',0.0,12.11,48.4,88.9,50.8,91.44,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1654,'Herma','8235 Endlosetiketten 3-bahnig','C',0.0,12.32,48.4,111.76,50.8,114.3,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1655,'Herma','8236 Endlosetiketten 3-bahnig mit Querperforation','C',0.0,12.09,35.7,68.58,38.1,71.12,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1656,'Herma','8237 Endlosetiketten 3-bahnig','C',0.0,12.44,35.7,106.68,38.1,109.22,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1657,'Herma','8238 Endlosetiketten 3-bahnig','C',0.0,11.56,48.4,101.6,50.8,104.14,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1658,'Herma','8240 Endlosetiketten 4-bahnig','C',0.0,10.87,35.7,73.66,38.1,76.2,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1659,'Herma','8241 Endlosetiketten 4-bahnig','C',0.0,12.13,23.0,81.28,25.4,83.82,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1660,'Herma','8242 Endlosetiketten 4-bahnig','C',0.0,12.13,35.7,81.28,38.1,83.82,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1661,'Herma','8243 Endlosetiketten 4-bahnig','C',0.0,12.13,48.4,81.28,50.8,83.82,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1662,'Herma','8245 Endlosetiketten 4-bahnig','C',0.0,12.09,23.0,50.8,25.4,53.34,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1663,'Herma','8246 Endlosetiketten 4-bahnig','C',0.0,12.09,35.7,50.8,38.1,53.34,4,1, NULL, NULL ) +INSERT INTO label_def VALUES (1664,'Herma','8261 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.05,35.7,88.9,38.1,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1665,'Herma','8262 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.7,35.7,101.6,38.1,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1666,'Herma','8263 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.7,48.4,101.6,50.8,101.6,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1667,'Herma','8264 Endlosetiketten 1-bahnig Recyclingpapier','C',0.0,11.05,48.4,88.9,50.8,88.9,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1668,'Herma','8265 Endlosetiketten 1-bahnig','C',0.0,11.5,48.4,127.0,50.8,127.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1669,'Herma','8266 Endlosetiketten 2-bahnig','C',0.0,11.73,48.4,127.0,50.8,129.54,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1670,'Herma','8267 Endlosetiketten 1-bahnig','C',0.0,10.63,35.7,78.74,38.1,78.74,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1671,'Herma','8269 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,12.09,150.0,210.82,152.4,210.82,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1672,'Herma','8290 Endlosetiketten 2-bahnig mit Querperforation','C',0.0,11.41,99.2,147.32,101.6,149.86,2,1, NULL, NULL ) +INSERT INTO label_def VALUES (1673,'Herma','8291 Endlosetiketten 1-bahnig 3 5\"-Diskette','C',0.0,19.94,69.6,71.12,76.2,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1674,'Herma','8292 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.0,99.2,147.32,101.6,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1675,'Herma','8293 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.0,48.4,147.32,50.8,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1676,'Herma','8294 Endlosetiketten 1-bahnig mit Querperforation','C',0.0,11.0,73.8,147.32,76.2,147.32,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1677,'Herma','8295 Endlosetiketten 8-bahnig','C',0.0,13.71,10.3,38.1,12.7,40.64,8,1, NULL, NULL ) +INSERT INTO label_def VALUES (1678,'Herma','8296 Endlosetiketten 1-bahnig','C',0.0,9.16,48.4,106.68,50.8,106.68,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1679,'Herma','8299 Endlosetiketten 1-bahnig 5 25\"-Diskette ablösbar','C',0.0,14.44,31.46,71.12,33.86,71.12,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1680,'Leitz','1680 Kartonrückenschilder breit','S',21.5,10.0,56.0,190.0,66.0,190.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1681,'Leitz','1681 Kartonrückenschilder schmal','S',16.0,10.0,31.0,190.0,39.0,190.0,1,7, NULL, NULL ) +INSERT INTO label_def VALUES (1682,'Leitz','1685 Papierrückenschilder selbstkl. breit','S',13.5,9.0,61.5,192.0,69.5,192.0,1,4, NULL, NULL ) +INSERT INTO label_def VALUES (1683,'Leitz','1686 Papierrückenschilder selbstkl. schmal','S',11.5,9.0,39.0,192.0,47.0,192.0,1,6, NULL, NULL ) +INSERT INTO label_def VALUES (1684,'Leitz','1687 Papierrückenschilder selbstkl. breit','S',6.0,12.5,285.0,61.5,285.0,61.5,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1685,'Leitz','1688 Papierrückenschilder selbstkl. schmal','S',6.0,6.0,285.0,39.0,285.0,39.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1686,'Leitz','6098 Papierrückenschilder selbstkl. breit','S',9.0,13.5,279.0,61.0,279.0,61.0,3,1, NULL, NULL ) +INSERT INTO label_def VALUES (1687,'Leitz','6099 Papierrückenschilder selbstkl. schmal','S',9.0,20.0,279.0,34.0,279.0,34.0,5,1, NULL, NULL ) +INSERT INTO label_def VALUES (1688,'Leitz','1900 Blanko-Schildchen','S',12.0,15.0,20.8,60.0,20.8,60.0,3,13, NULL, NULL ) +INSERT INTO label_def VALUES (1689,'Leitz','2466 Blanko-Schildchen','S',12.0,30.0,15.0,50.0,15.0,50.0,3,18, NULL, NULL ) +INSERT INTO label_def VALUES (1690,'Leitz','6010 Blanko-Schildchen','S',12.0,30.0,21.0,50.0,21.0,50.0,3,13, NULL, NULL ) +INSERT INTO label_def VALUES (1691,'Leitz','6643 Beschriftungsschilder selbstklebend ','S',12.0,32.0,39.0,73.0,39.0,73.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1692,'Sigel','DP001 Tischkarten blanko weiß','S',53.5,15.0,85.0,95.0,85.0,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1693,'Sigel','DP002 Tischkarten konturgestanzt','S',53.5,15.0,85.0,95.0,85.0,105.0,2,2, NULL, NULL ) +INSERT INTO label_def VALUES (1694,'Sigel','DE115 Design-Etiketten','S',23.6,19.8,21.2,54.0,25.4,58.2,3,10, NULL, NULL ) +INSERT INTO label_def VALUES (1695,'Sigel','DE141 Design-Etiketten','S',18.0,12.0,30.0,60.0,33.0,63.0,3,8, NULL, NULL ) +INSERT INTO label_def VALUES (1696,'Sigel','LP750 CD-Einleger','S',24.0,29.75,121.0,120.5,131.0,120.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1697,'Sigel','DD300 CD-Einleger','S',24.0,29.75,121.0,120.5,131.0,120.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1698,'Sigel','DD405 CD-Einleger','S',24.0,29.75,121.0,120.5,131.0,120.5,1,2, NULL, NULL ) +INSERT INTO label_def VALUES (1699,'Sigel','LP755 CD-Booklet','S',28.5,45.0,240.0,120.0,240.0,120.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1700,'Sigel','DD450 CD-Booklet','S',28.5,45.0,240.0,120.0,240.0,120.0,1,1, NULL, NULL ) +INSERT INTO label_def VALUES (1701,'Sigel','DP839/DP939 Design-Visitenkarten','S',10.0,15.0,55.0,85.0,55.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1702,'Sigel','DP835/DP935 Design-Visitenkarten gestanzt','S',11.0,15.0,55.0,85.0,55.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1703,'Sigel','DP836/DP936 Design-Visitenkarten','S',10.0,15.0,55.0,85.0,55.0,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1704,'Sigel','DP837/DP937 Design-Visitenkarten gestanzt m. abger. Ecken','S',6.0,15.0,55.0,85.0,56.5,95.0,2,5, NULL, NULL ) +INSERT INTO label_def VALUES (1705,'Sigel','DP838/DP938 Design-Klapp-Visitenkarten','S',10.0,20.0,55.0,170.0,55.0,170.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (1706,'Sigel','LP781 Regalschild','S',15.5,0.0,38.0,105.0,38.0,105.0,2,7, NULL, NULL ) +INSERT INTO label_def VALUES (1707,'Sigel','LP731 Ordner-Einsteckschild','S',28.5,10.0,30.0,190.0,30.0,190.0,1,8, NULL, NULL ) +INSERT INTO label_def VALUES (1708,'Sigel','LP734 Ordner-Einsteckschild','S',16.0,10.0,53.0,190.0,53.0,190.0,1,5, NULL, NULL ) +INSERT INTO label_def VALUES (1709,'Sigel','LP710 Postkarte bedruckt','S',0.0,30.75,99.0,148.5,99.0,148.5,1,3, NULL, NULL ) +INSERT INTO label_def VALUES (1710,'Sigel','LP711 Postkarte','S',0.0,0.0,148.5,99.0,148.5,99.0,2,2, NULL, NULL ) diff --git a/kbarcode/labeleditor.cpp b/kbarcode/labeleditor.cpp new file mode 100644 index 0000000..144d9a1 --- /dev/null +++ b/kbarcode/labeleditor.cpp @@ -0,0 +1,1192 @@ +/*************************************************************************** + labeleditor.cpp - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "labeleditor.h" + +#include "barcodecombo.h" +#include "barcodedialog.h" +#include "barcodeitem.h" +#include "barcodeprinterdlg.h" +#include "batchprinter.h" +#include "batchwizard.h" +#include "commands.h" +#include "configdialog.h" +#include "databasebrowser.h" +#include "documentitemdlg.h" +#include "kbarcode.h" +#include "kbarcodesettings.h" +#include "label.h" +#include "measurements.h" +#include "mimesources.h" +#include "multilineeditdlg.h" +#include "mycanvasitem.h" +#include "mycanvasview.h" +#include "newlabel.h" +#include "previewdialog.h" +#include "printersettings.h" +#include "printlabeldlg.h" +#include "rectitem.h" +#include "rectsettingsdlg.h" +#include "sqltables.h" +#include "tcanvasitem.h" +#include "tokendialog.h" +#include "tokenprovider.h" +#include "zplutils.h" +//NY34 +#include "textlineitem.h" +//NY34 + +// QT includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if QT_VERSION <= 0x030100 + #include +#endif + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tcanvasitem.h" +#include "rectitem.h" +#include "textitem.h" +#include "imageitem.h" +#include "barcodeitem.h" +#include "lineitem.h" + +#define STATUS_ID_SIZE 100 +#define STATUS_ID_TEMPLATE 101 +#define STATUS_ID_MOUSE 102 + +#define ID_LOCK_ITEM 8000 + +#define CANVAS_UPDATE_PERIOD 50 + +#define KBARCODE_UNDO_LIMIT 25 + +using namespace KABC; + +LabelEditor::LabelEditor( QWidget *parent, QString _filename, const char *name, WFlags f ) + : DCOPObject( "LabelEditor" ), + DSMainWindow( parent, name, f ) +{ + undoAct = + redoAct = NULL; + history = NULL; + + description = QString::null; + d = new Definition(); + m_token = new TokenProvider( KApplication::desktop() ); + + statusBar()->insertItem( "", STATUS_ID_TEMPLATE, 0, true ); + statusBar()->insertItem( "", STATUS_ID_SIZE, 0, true ); + statusBar()->insertItem( "", STATUS_ID_MOUSE, 2, true ); + statusBar()->setSizeGripEnabled( true ); + statusBar()->show(); + + c = new MyCanvas( this ); + c->setDoubleBuffering( true ); + c->setUpdatePeriod( CANVAS_UPDATE_PERIOD ); + + cv = new MyCanvasView( d, c, this ); + cv->setPosLabel( statusBar(), STATUS_ID_MOUSE ); + setCentralWidget( cv ); + + setupActions(); + setupContextMenu(); + setAutoSaveSettings( QString("Window") + name, true ); + + clearLabel(); + + loadConfig(); + show(); + +// if( isFirstStart() ) +// moveDockWindow( tools, Qt::DockLeft ); + + connect( cv, SIGNAL( doubleClickedItem(TCanvasItem*) ), this, SLOT( doubleClickedItem(TCanvasItem*) ) ); + connect( cv, SIGNAL( showContextMenu(QPoint) ), this, SLOT( showContextMenu(QPoint) ) ); + connect( cv, SIGNAL( movedSomething() ), this, SLOT( setEdited() ) ); + connect( KBarcodeSettings::getInstance(), SIGNAL( updateGrid( int ) ), cv, SLOT( updateGUI() ) ); + connect( kapp, SIGNAL( aboutToQuit() ), this, SLOT( saveConfig() ) ); + + connect( history, SIGNAL( commandExecuted() ), cv, SLOT( updateGUI() ) ); + connect( history, SIGNAL( commandExecuted() ), this, SLOT( setEdited() ) ); + + if( !_filename.isEmpty() ) + openUrl( _filename ); +} + +LabelEditor::~LabelEditor() +{ + delete m_token; + delete d; + delete history; +} + +void LabelEditor::loadConfig() +{ + KConfig* config = kapp->config(); + recentAct->loadEntries( config, "RecentFiles" ); + + gridAct->setChecked( config->readBoolEntry("gridenabled", false ) ); + toggleGrid(); +} + +void LabelEditor::saveConfig() +{ + KConfig* config = kapp->config(); + + recentAct->saveEntries( config, "RecentFiles" ); + + config->setGroup("LabelEditor"); + config->writeEntry("gridenabled", gridAct->isChecked() ); + + config->sync(); + + DSMainWindow::saveConfig(); +} + +void LabelEditor::createCommandHistory() +{ + KConfig* config = kapp->config(); + + if( undoAct && redoAct ) + { + undoAct->unplug( editMenu ); + undoAct->unplug( toolBar() ); + redoAct->unplug( editMenu ); + redoAct->unplug( toolBar() ); + actionCollection()->remove( undoAct ); + actionCollection()->remove( redoAct ); + } + + history = new KCommandHistory( actionCollection(), false ); + cv->setHistory( history ); + + config->setGroup("LabelEditor"); + history->setUndoLimit( KBARCODE_UNDO_LIMIT ); + history->setRedoLimit( KBARCODE_UNDO_LIMIT ); +} + +void LabelEditor::createCommandHistoryActions() +{ + undoAct = (KAction*)actionCollection()->action("edit_undo"); + redoAct = (KAction*)actionCollection()->action("edit_redo"); + + undoAct->plug( editMenu, 0 ); + redoAct->plug( editMenu, 1 ); + + undoAct->plug( toolBar(), 5 ); + redoAct->plug( toolBar(), 6 ); +} + +void LabelEditor::clearLabel() +{ + TCanvasItem* citem; + QCanvasItemList::Iterator it; + + description = QString::null; + + delete history; + createCommandHistory(); + createCommandHistoryActions(); + + connect( history, SIGNAL( commandExecuted() ), cv, SLOT( updateGUI() ) ); + connect( history, SIGNAL( commandExecuted() ), this, SLOT( setEdited() ) ); + + m_edited = false; + + QCanvasItemList list = c->allItems(); + it = list.begin(); + for (; it != list.end(); ++it) + { + citem = static_cast(*it); + citem->remRef(); + } + + updateInfo(); + c->update(); + cv->repaintContents(); +} + +bool LabelEditor::save() +{ + bool ret; + if( filename.isEmpty() ) + ret = saveas(); + else + ret = save( filename ); + + KURL url; + url.setPath( filename ); + recentAct->addURL( url ); + + updateInfo(); + + return ret; +} + +bool LabelEditor::saveas() +{ + QString name = KFileDialog::getSaveFileName ( NULL, "*.kbarcode", this ); + if(name.isEmpty()) + return false; + + if( name.right(9).lower() != ".kbarcode" ) + name += ".kbarcode"; + + return save( name ); +} + +bool LabelEditor::save( QString name ) +{ + if( QFile::exists( name ) ) + QFile::remove( name ); + + QFile f( name ); + if ( !f.open( IO_WriteOnly ) ) + return false; + + save( &f ); + + m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); + // maybe we should redraw all items on the canvas now. + // if there is a label with [filename], the filename might not + // get updated if the label gets saved with another filename. + + filename = name; + history->documentSaved(); + m_edited = false; + + enableActions(); + setCaption( filename, false ); + + return true; +} + +void LabelEditor::save( QIODevice* device ) +{ + + QDomDocument doc( "KBarcodeLabel" ); + QDomElement root = doc.createElement( "kbarcode" ); + doc.appendChild( root ); + + writeXMLHeader( &root, description, d ); + + QCanvasItemList list = c->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + { + TCanvasItem* item = static_cast(list[i]); + DocumentItem* ditem = item->item(); + + writeXMLDocumentItem( &root, &ditem ); + } + + QCString xml = doc.toCString(); + device->writeBlock( xml, xml.length() ); + device->close(); +} + +bool LabelEditor::open() +{ + QString name = KFileDialog::getOpenFileName ( NULL, "*.kbarcode", this, i18n("Select Label") ); + if(name.isEmpty()) return false; + + return openUrl( name ); +} + +bool LabelEditor::openUrl( const QString & url ) +{ + if( url.isEmpty() ) { + return open(); + } + + filename = url; + setCaption( filename, false ); + m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); + + QFile f( filename ); + if ( !f.open( IO_ReadOnly ) ) + return false; + + clearLabel(); + + QDomDocument doc( "KBarcodeLabel" ); + if ( !doc.setContent( &f ) ) { + f.close(); + return false; + } + f.close(); + + bool kbarcode18 = false; + delete d; + d = NULL; + + readXMLHeader( &doc, description, kbarcode18, &d ); + + if( !d || d->getId() == -1 ) + { + KMessageBox::error( this, QString( i18n("The file %1 cannot be loaded as the label definition is missing.") ).arg( filename ) ); + return false; + } + + cv->setDefinition( d ); + + DocumentItemList list; + readDocumentItems( &list, &doc, m_token, kbarcode18 ); + for( unsigned int i=0;isetItem( list.at( i ) ); + citem->addRef(); + } + list.clear(); + + KURL murl; + murl.setPath( filename ); + recentAct->addURL( murl ); + + enableActions(); + cv->repaintContents( true ); + + return true; +} + +bool LabelEditor::newLabel() +{ + NewLabel* nl = new NewLabel( this ); + if( nl->exec() != QDialog::Accepted ) { + delete nl; + return false; + } + + closeLabel(); + + if( !nl->empty() ) + { + d->setId( nl->labelId() ); + clearLabel(); + cv->setDefinition( d ); + } + + delete nl; + + filename = QString::null; + m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); + setCaption( filename, false ); + enableActions(); + + return true; +} + +void LabelEditor::setupActions() +{ + KAction* newAct = KStdAction::openNew( this, SLOT(startEditor()), actionCollection() ); + KAction* loadAct = KStdAction::open( this, SLOT(startLoadEditor()), actionCollection() ); + KAction* quitAct = KStdAction::quit(kapp, SLOT(quit()), actionCollection()); + KAction* closeAct = KStdAction::close( this, SLOT( close() ), actionCollection(), "close" ); + closeLabelAct = new KAction( i18n("Close &Label" ), 0, 0, this, SLOT( closeLabel() ), actionCollection() ); + + recentAct = new KRecentFilesAction( i18n("&Recent Files"), 0, this, SLOT( loadRecentEditor( const KURL& ) ) ); + + KAction* importPrintFileAct = new KAction( i18n("&Import and Print Batch File..."), BarIconSet( "fileprint" ), 0, this, SLOT( batchPrint() ), actionCollection() ); + + saveAct = KStdAction::save( this, SLOT( save() ), actionCollection(), "save" ); + saveAsAct = KStdAction::saveAs( this, SLOT( saveas() ), actionCollection(), "saveas" ); + descriptionAct = new KAction( i18n("&Change description..."), 0, 0, this, SLOT(changeDes()), actionCollection() ); + deleteAct = new KAction( i18n("&Delete Object"), QIconSet( BarIcon("editdelete") ), Key_Delete, cv, SLOT( deleteCurrent() ), actionCollection() ); + editPropAct = new KAction( i18n("&Properties..."), 0, 0, this, SLOT( doubleClickedCurrent() ), actionCollection() ); + printAct = KStdAction::print( this, SLOT( print() ), actionCollection(), "print" ); + bcpAct = new KAction( i18n("Print to &Barcode Printer..."), 0, 0, this, SLOT( printBCP() ), actionCollection() ); + imgAct = new KAction( i18n("Print to &Image..."), 0, 0, this, SLOT(printImage() ), actionCollection() ); + changeSizeAct = new KAction( i18n("&Change Label..."), 0, 0, this, SLOT( changeSize() ), actionCollection() ); + barcodeAct = new KAction( i18n("Insert &Barcode"), QIconSet( BarIcon("barcode") ), 0, this, SLOT( insertBarcode() ), actionCollection() ); + barcodeAct->setEnabled( Barkode::haveBarcode() ); + + pictureAct = new KAction( i18n("Insert &Picture"), QIconSet( BarIcon("inline_image") ), 0, this, SLOT( insertPicture() ), actionCollection() ); + textAct = new KAction( i18n("Insert &Text"), QIconSet( BarIcon("text") ), 0, this, SLOT( insertText() ), actionCollection() ); + textDataAct = new KAction( i18n("Insert &Data Field"), QIconSet( BarIcon("contents") ), 0, this, SLOT( insertDataText() ), actionCollection() ); + textLineAct = new KAction( i18n("Insert &Text Line"), QIconSet( BarIcon("text") ), 0, this, SLOT( insertTextLine() ), actionCollection() ); + lineAct = new KAction( i18n("Insert &Line"), QIconSet( BarIcon("kbarcodelinetool") ), 0, this, SLOT( insertLine() ), actionCollection() ); + rectAct = new KAction( i18n("Insert &Rectangle"), QIconSet( BarIcon("kbarcoderect") ), 0, this, SLOT( insertRect() ), actionCollection() ); + circleAct = new KAction( i18n("Insert &Ellipse"), QIconSet( BarIcon("kbarcodeellipse") ), 0, this, SLOT( insertCircle() ), actionCollection() ); + spellAct = KStdAction::spelling( this, SLOT(spellCheck()), actionCollection(), "spell" ); + gridAct = new KToggleAction( i18n("&Grid"), QIconSet( BarIcon("kbarcodegrid") ), 0, this, SLOT( toggleGrid() ), actionCollection() ); + previewAct = new KAction( i18n("&Preview..."), 0, 0, this, SLOT( preview() ), actionCollection() ); + sep = new KActionSeparator( this ); + cutAct = KStdAction::cut( this, SLOT( cut() ), actionCollection(), "cut" ); + copyAct = KStdAction::copy( this, SLOT( copy() ), actionCollection(), "copy" ); + pasteAct = KStdAction::paste( this, SLOT( paste() ), actionCollection(), "paste" ); + selectAllAct = KStdAction::selectAll( cv, SLOT( selectAll() ), actionCollection(), "select_all" ); + deSelectAllAct = KStdAction::deselect( cv, SLOT( deSelectAll() ), actionCollection(), "de_select_all" ); + addressBookAct = new KAction( i18n("Address&book"), QIconSet( BarIcon("kaddressbook") ), 0, this, SLOT( launchAddressBook() ), actionCollection() ); + KAction* singleBarcodeAct = new KAction(i18n("&Create Single Barcode..."), "", + 0, this, SLOT(startBarcodeGen()), + actionCollection(), "create" ); + singleBarcodeAct->setEnabled( Barkode::haveBarcode() ); + + newAct->plug( toolBar() ); + loadAct->plug( toolBar() ); + saveAct->plug( toolBar() ); + printAct->plug( toolBar() ); + sep->plug( toolBar() ); + cutAct->plug( toolBar() ); + copyAct->plug( toolBar() ); + pasteAct->plug( toolBar() ); + + tools = new KToolBar( this, this->leftDock(), true, "tools" ); + + barcodeAct->plug( tools ); + pictureAct->plug( tools ); + textAct->plug( tools ); + textDataAct->plug( tools ); + textLineAct->plug( tools ); + lineAct->plug( tools ); + rectAct->plug( tools ); + circleAct->plug( tools ); + (new KActionSeparator( this ))->plug( tools ); +// spellAct->plug( tools ); // KDE 3.2 + gridAct->plug( tools ); + + DSMainWindow::setupActions(); + connect( recentAct, SIGNAL( urlSelected( const KURL& ) ), this, SLOT( startLoadRecentEditor( const KURL& ) ) ); + + KPopupMenu* fileMenu = new KPopupMenu( this ); + editMenu = new KPopupMenu( this ); + KPopupMenu* viewMenu = new KPopupMenu( this ); + KPopupMenu* insMenu = new KPopupMenu( this ); + KPopupMenu* toolMenu = new KPopupMenu( this ); + KPopupMenu* barMenu = new KPopupMenu( this ); + + menuBar()->removeItemAt( 0 ); + menuBar()->insertItem( i18n("&File"), fileMenu, -1, 0 ); + menuBar()->insertItem( i18n("&Edit"), editMenu, -1, 1 ); + menuBar()->insertItem( i18n("&Insert"), insMenu, -1, 2 ); + menuBar()->insertItem( i18n("&View"), viewMenu, -1, 3 ); + menuBar()->insertItem( i18n("T&ools"), toolMenu, -1, 4 ); + menuBar()->insertItem( i18n("&Barcode"), barMenu, -1, 5 ); + + // Menubar + newAct->plug( fileMenu ); + loadAct->plug( fileMenu ); + recentAct->plug( fileMenu ); + saveAct->plug( fileMenu ); + saveAsAct->plug( fileMenu ); + sep->plug( fileMenu ); + printAct->plug( fileMenu ); + bcpAct->plug( fileMenu ); + imgAct->plug( fileMenu ); + sep->plug( fileMenu ); + closeLabelAct->plug( fileMenu ); + closeAct->plug( fileMenu ); + quitAct->plug( fileMenu ); + + sep->plug( editMenu ); + cutAct->plug( editMenu ); + copyAct->plug( editMenu ); + pasteAct->plug( editMenu ); + sep->plug( editMenu ); + selectAllAct->plug( editMenu ); + deSelectAllAct->plug( editMenu ); + sep->plug( editMenu ); + descriptionAct->plug( editMenu ); + changeSizeAct->plug( editMenu ); + sep->plug( editMenu ); + deleteAct->plug( editMenu ); + editPropAct->plug( editMenu ); + + barcodeAct->plug( insMenu ); + pictureAct->plug( insMenu ); + textAct->plug( insMenu ); + textDataAct->plug( insMenu ); + textLineAct->plug( insMenu ); + lineAct->plug( insMenu ); + rectAct->plug( insMenu ); + circleAct->plug( insMenu ); + +// spellAct->plug( toolMenu ); // KDE 3.2 + toolMenu->insertSeparator(); + addressBookAct->plug( toolMenu ); + + gridAct->plug( viewMenu ); + previewAct->plug( viewMenu ); + + singleBarcodeAct->plug( barMenu ); + importPrintFileAct->plug( barMenu ); + + enableActions(); +} + +void LabelEditor::setupContextMenu() +{ + m_mnuContext = new KPopupMenu( this ); + m_mnuContext->setCheckable( true ); + + KPopupMenu* orderMenu = new KPopupMenu( m_mnuContext ); + orderMenu->insertItem( i18n("&On Top"), this, SLOT( onTopCurrent() ) ); + orderMenu->insertItem( i18n("&Raise"), this, SLOT( raiseCurrent() ) ); + orderMenu->insertItem( i18n("&Lower"), this, SLOT( lowerCurrent() ) ); + orderMenu->insertItem( i18n("&To Background"), this, SLOT( backCurrent() ) ); + + KPopupMenu* centerMenu = new KPopupMenu( m_mnuContext ); + centerMenu->insertItem( i18n("Center &Horizontally"), this, SLOT( centerHorizontal() ) ); + centerMenu->insertItem( i18n("Center &Vertically"), this, SLOT( centerVertical() ) ); + + m_mnuContext->insertItem( i18n("&Order"), orderMenu ); + m_mnuContext->insertItem( i18n("&Center"), centerMenu ); + m_mnuContext->insertSeparator(); + m_mnuContext->insertItem( SmallIcon("editdelete"), i18n("&Delete"), cv, SLOT( deleteCurrent() ) ); + m_mnuContext->insertItem( i18n("&Protect Position and Size"), this, SLOT( lockItem() ), 0, ID_LOCK_ITEM ); + m_mnuContext->insertSeparator(); + m_mnuContext->insertItem( i18n("&Properties"), this, SLOT( doubleClickedCurrent() ) ); +} + +void LabelEditor::insertBarcode() +{ + NewBarcodeCommand* bc = new NewBarcodeCommand( cv, m_token ); + bc->execute(); + + BarcodeItem* bcode = static_cast((static_cast(bc->createdItem()))->item()); + if( !bcode ) + return; + + history->addCommand( bc, false ); +} + +void LabelEditor::insertPicture() +{ + NewPictureCommand* pc = new NewPictureCommand( cv ); + history->addCommand( pc, true ); + + TCanvasItem* item = pc->createdItem(); + doubleClickedItem( item ); +} + +void LabelEditor::insertText() +{ + insertText( "Some Text" ); +} + +void LabelEditor::insertDataText() +{ +// DocumentItemList list = cv->getAllItems(); +// QStringList vars = m_token->listUserVars( &list ); + + TokenDialog dlg( m_token, this, "dlg" ); + if( dlg.exec() == QDialog::Accepted ) + insertText( dlg.token() ); +} + +void LabelEditor::insertText( QString caption ) +{ + NewTextCommand* tc = new NewTextCommand( caption, cv, m_token ); + history->addCommand( tc, true ); +} + +//NY30 +void LabelEditor::insertTextLine() +{ + insertTextLine( "Some Plain Text" ); +} + +void LabelEditor::insertTextLine( QString caption ) +{ + NewTextLineCommand* tc = new NewTextLineCommand( caption, cv, m_token ); + history->addCommand( tc, true ); +} +//NY30 + +void LabelEditor::insertRect() +{ + NewRectCommand* rc = new NewRectCommand( cv ); + history->addCommand( rc, true ); +} + +void LabelEditor::insertCircle() +{ + NewRectCommand* rc = new NewRectCommand( cv, true ); + history->addCommand( rc, true ); +} + +void LabelEditor::insertLine() +{ + NewLineCommand* lc = new NewLineCommand( cv ); + history->addCommand( lc, true ); +} + +void LabelEditor::changeDes() +{ + QString tmp = QInputDialog::getText( i18n("Label Description"), + i18n("Please enter a description:"), QLineEdit::Normal, description ); + if( !tmp.isEmpty() ) + description = tmp; +} + +void LabelEditor::changeSize() +{ + NewLabel* nl = new NewLabel( this, "nl", true, true ); + nl->setLabelId( d->getId() ); + if( nl->exec() == QDialog::Rejected ) + { + delete nl; + return; + } + + d->setId( nl->labelId() ); + cv->setDefinition( d ); + + updateInfo(); + enableActions(); + // TODO: make sure that all items are redrawn. + // Otherwise barcodes might become invisible when changing the label + c->update(); + cv->repaint(); + delete nl; +} + +void LabelEditor::updateInfo() +{ + statusBar()->changeItem( i18n("Size: ") + QString("%1%2 x %3%4").arg( + d->getMeasurements().width() ).arg( Measurements::system() + ).arg( d->getMeasurements().height() ).arg( Measurements::system() ), STATUS_ID_SIZE ); + statusBar()->changeItem( i18n("Label Template: ") + d->getProducer() + " - " + d->getType(), STATUS_ID_TEMPLATE ); +} + +void LabelEditor::doubleClickedItem( TCanvasItem* item ) +{ + m_token->setCurrentDocumentItems( cv->getAllItems() ); + DocumentItemDlg dlg( m_token, item->item(), history, this ); + if( dlg.exec() == QDialog::Accepted ) + { + c->update(); + cv->repaintContents(); + } +} + +void LabelEditor::doubleClickedCurrent() +{ + if( cv->getActive() ) + doubleClickedItem( cv->getActive() ); +} + +void LabelEditor::showContextMenu( QPoint pos ) +{ + TCanvasItemList list = cv->getSelected(); + + m_mnuContext->setItemChecked( ID_LOCK_ITEM, (list[0])->item()->locked() ); + m_mnuContext->popup( pos ); +} + +void LabelEditor::lockItem() +{ + TCanvasItemList list = cv->getSelected(); + KMacroCommand* mc = new KMacroCommand( i18n("Protected Item") ); + + DocumentItem* item = NULL; + LockCommand* lc = NULL; + for( unsigned int i=0;iitem(); + lc = new LockCommand( !item->locked(), list[i] ); + lc->execute(); + mc->addCommand( lc ); + } + + history->addCommand( mc ); +} + +void LabelEditor::print() +{ + PrintLabelDlg pld( this, "pld" ); + if( pld.exec() != QDialog::Accepted ) + return; + + PrinterSettings::getInstance()->getData()->border = pld.border(); + + KPrinter* printer = PrinterSettings::getInstance()->setupPrinter( KURL( filename ), this ); + if( !printer ) + return; + + BatchPrinter batch( printer, this ); + batch.setMove( pld.position() ); + + batchPrint( &batch, pld.labels(), BatchPrinter::POSTSCRIPT ); + + delete printer; +} + +void LabelEditor::printBCP() +{ + BarcodePrinterDlg dlg(this); + if( dlg.exec() == QDialog::Accepted ) + { + QString name( dlg.printToFile() ? dlg.fileName() : dlg.deviceName() ); + + BatchPrinter batch( name, dlg.outputFormat(), this ); + batchPrint( &batch, 1, BatchPrinter::BCP ); + } +} + +void LabelEditor::printImage() +{ + KFileDialog fd( ":save_image", KImageIO::pattern( KImageIO::Writing ), this, "fd", true ); + fd.setMode( KFile::File ); + fd.setOperationMode( KFileDialog::Saving ); + if( fd.exec() == QDialog::Accepted ) { + QString path = fd.selectedURL().path(); + BatchPrinter batch( path, this ); + batchPrint( &batch, 1, BatchPrinter::IMAGE ); + } +} + +void LabelEditor::batchPrint( BatchPrinter* batch, int copies, int mode ) +{ + QBuffer buffer; + if( !buffer.open( IO_WriteOnly ) ) + return; + + save( &buffer ); + + batch->setBuffer( &buffer ); + batch->setSerial( QString::null, 1 ); + batch->setName( filename ); + batch->setDefinition( d ); + batch->setCustomer( QString::null ); + batch->setEvents( false ); + + QValueList* list = new QValueList; + BatchPrinter::data m_data; + m_data.number = copies; + m_data.article_no = QString::null; + m_data.group = QString::null; + list->append( m_data ); + + batch->setData( list ); + switch( mode ) + { + default: + case BatchPrinter::POSTSCRIPT: + batch->start(); + break; + case BatchPrinter::IMAGE: + batch->startImages(); + break; + case BatchPrinter::BCP: + batch->startBCP(); + break; + } +} + +void LabelEditor::spellCheck() +{ + KMacroCommand* sc = new KMacroCommand( i18n("Spellchecking") ); + QCanvasItemList list = c->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->rtti() == eRtti_Text ) { + TCanvasItem* item = (TCanvasItem*)list[i]; + TextItem* mytext = (TextItem*)item->item(); + QString text = mytext->text(); + bool nocheck = false; +// for( int z = 0; z < comboText->count(); z++ ) +// if( text == "[" + comboText->text(z) + "]" ) { +// nocheck = true; +// break; +// } + + if( !nocheck ) { + QString textbefore = text; + KSpell::modalCheck( text ); + if( text != textbefore ) { + TextChangeCommand* tc = new TextChangeCommand( mytext, text ); + tc->execute(); + sc->addCommand( tc ); + } + } + } + + history->addCommand( sc, false ); +} + +void LabelEditor::centerHorizontal() +{ + if( !cv->getActive() ) + return; + + TCanvasItem* item = cv->getActive(); + + MoveCommand* mv = new MoveCommand( int( ((d->getMeasurements().widthMM() * 1000.0 - item->item()->rectMM().width())/2 )) - item->item()->rectMM().x(), 0, item ); + history->addCommand( mv, true ); +} + +void LabelEditor::centerVertical() +{ + if( !cv->getActive() ) + return; + + TCanvasItem* item = cv->getActive(); + + MoveCommand* mv = new MoveCommand( 0, int( ((d->getMeasurements().heightMM() * 1000.0 - item->item()->rectMM().height())/2 ) - item->item()->rectMM().y() ), item ); + history->addCommand( mv, true ); +} + +void LabelEditor::raiseCurrent() +{ + if( !cv->getActive() ) + return; + + ChangeZCommand* czc = new ChangeZCommand( (int)cv->getActive()->z() + 1, cv->getActive() ); + history->addCommand( czc, true ); +} + +void LabelEditor::lowerCurrent() +{ + if( !cv->getActive() ) + return; + + ChangeZCommand* czc = new ChangeZCommand( (int)cv->getActive()->z() - 1, cv->getActive() ); + history->addCommand( czc, true ); +} + +void LabelEditor::onTopCurrent() +{ + if( !cv->getActive() ) + return; + + int z = 0; + + QCanvasItemList list = c->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->z() > z ) + z = (int)list[i]->z(); + + + ChangeZCommand* czc = new ChangeZCommand( z + 1, cv->getActive() ); + history->addCommand( czc, true ); +} + +void LabelEditor::backCurrent() +{ + if( !cv->getActive() ) + return; + + int z = 0; + + QCanvasItemList list = c->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->z() < z ) + z = (int)list[i]->z(); + + ChangeZCommand* czc = new ChangeZCommand( z - 1, cv->getActive() ); + history->addCommand( czc, true ); +} + +const QString LabelEditor::fileName() const +{ + return filename.right( filename.length() - filename.findRev( "/" ) - 1 ); +} + +void LabelEditor::preview() +{ + QBuffer buffer; + if( !buffer.open( IO_WriteOnly ) ) + return; + + save( &buffer ); + + // No need to delete pd as it has WDestructiveClose set! + PreviewDialog* pd = new PreviewDialog( &buffer, d, fileName(), this ); + pd->exec(); +} + +void LabelEditor::toggleGrid() +{ + c->setGrid( gridAct->isChecked() ); + cv->repaintContents(); +} + +void LabelEditor::cut() +{ + copy(); + cv->deleteCurrent(); +} + +void LabelEditor::copy() +{ + TCanvasItemList list = cv->getSelected(); + if( list.isEmpty() ) + return; + + DocumentItemList items; + for( unsigned int i=0;iitem() ); + + DocumentItemDrag* drag = new DocumentItemDrag(); + drag->setDocumentItem( &items ); +#if QT_VERSION >= 0x030100 + kapp->clipboard()->setData( drag, QClipboard::Clipboard ); +#else + kapp->clipboard()->setData( drag ); +#endif +} + +void LabelEditor::paste() +{ + QMimeSource* data = QApplication::clipboard()->data(); + if ( DocumentItemDrag::canDecode( data ) ) + DocumentItemDrag::decode( data, cv, m_token, history ); +} + +void LabelEditor::startEditor() +{ + if( isChanged() ) { + LabelEditor* lb = new LabelEditor( NULL, QString::null, "LabelEditorWindow" ); + lb->startupDlg( eCreateNewLabel, QString::null ); + } else + newLabel(); +} + +void LabelEditor::startBarcodeGen() +{ + new BarCodeDialog(); +} + +void LabelEditor::startLoadRecentEditor( const KURL& url ) +{ + if( !QFile::exists( url.path() ) ) { + KMessageBox::information( this, i18n("The file %1 does not exist.").arg( url.path() ) ); + recentAct->removeURL( url ); + return; + } + + if( isChanged() ) + new LabelEditor( 0, url.path(), "LabelEditorWindow" ); + else + openUrl( url.path() ); +} + +void LabelEditor::startLoadEditor() +{ + if( isChanged() ) { + LabelEditor* lb = new LabelEditor( 0, QString::null, "LabelEditorWindow" ); + lb->startupDlg( eLoadLabel, QString::null ); + } else + open(); +} + +void LabelEditor::batchPrint() +{ + new BatchWizard( NULL ); +} + +void LabelEditor::closeEvent( QCloseEvent* e ) +{ + if( !isChanged() ) { + saveConfig(); + e->accept(); + delete this; + return; + } + + int m = KMessageBox::warningYesNoCancel( this, + i18n("The document has been modified.

Do you want to save it ?
") ); + + if( m == KMessageBox::Cancel ) + e->ignore(); + else if( m == KMessageBox::No ) { + saveConfig(); + e->accept(); + delete this; + } else if( m == KMessageBox::Yes ) { + if( save() ) { + saveConfig(); + e->accept(); + delete this; + } + } +} + +bool LabelEditor::isChanged() +{ + if( !c->width() && !c->height() ) + return false; + + if( m_edited ) + return true; + + return false; +} + +bool LabelEditor::startupDlg( ELabelEditorMode mode, QString f ) +{ + if( mode == eCreateNewLabel && KBarcodeSettings::getInstance()->newDialog() ) + { + if(!newLabel()) { + close(); + return false; + } + } + else if( mode == eLoadLabel ) + { + if(!openUrl(f)) { + close(); + return false; + } + } + + return true; +} + +void LabelEditor::closeLabel() +{ + delete d; + d = new Definition(); + + m_edited = false; + + clearLabel(); + enableActions(); + + cv->setDefinition( d ); + + filename = QString::null; + setCaption( filename, false ); +} + +void LabelEditor::setEdited() +{ + setCaption( filename, true ); + m_edited = true; +} + +void LabelEditor::enableActions() +{ + editPropAct->setEnabled( cv->getActive() ); + deleteAct->setEnabled( cv->getActive() ); + + if( d->getId() == -1 ){ + // label closed + deleteAct->setEnabled( false ); + barcodeAct->setEnabled( false ); + pictureAct->setEnabled( false ); + textAct->setEnabled( false ); + textDataAct->setEnabled( false ); + textLineAct->setEnabled( false ); + rectAct->setEnabled( false ); + circleAct->setEnabled( false ); + lineAct->setEnabled( false ); + spellAct->setEnabled( false ); + gridAct->setEnabled( false ); + + saveAct->setEnabled( false ); + saveAsAct->setEnabled( false ); + printAct->setEnabled( false ); + bcpAct->setEnabled( false ); + imgAct->setEnabled( false ); + + previewAct->setEnabled( false ); + closeLabelAct->setEnabled( false ); + descriptionAct->setEnabled( false ); + + cutAct->setEnabled( false ); + copyAct->setEnabled( false ); + pasteAct->setEnabled( false ); + + selectAllAct->setEnabled( false ); + deSelectAllAct->setEnabled( false ); + } else { + deleteAct->setEnabled( true ); + barcodeAct->setEnabled( Barkode::haveBarcode() ); + pictureAct->setEnabled( true ); + textAct->setEnabled( true ); + textDataAct->setEnabled( true ); + textLineAct->setEnabled( true ); + rectAct->setEnabled( true ); + circleAct->setEnabled( true ); + lineAct->setEnabled( true ); + spellAct->setEnabled( true ); + gridAct->setEnabled( true ); + + saveAct->setEnabled( true ); + saveAsAct->setEnabled( true ); + printAct->setEnabled( true ); + bcpAct->setEnabled( true ); + imgAct->setEnabled( true ); + descriptionAct->setEnabled( true ); + + previewAct->setEnabled( true ); + closeLabelAct->setEnabled( true ); + + cutAct->setEnabled( true ); + copyAct->setEnabled( true ); + pasteAct->setEnabled( true ); + + selectAllAct->setEnabled( true ); + deSelectAllAct->setEnabled( true ); + } +} + +void LabelEditor::launchAddressBook() +{ + KRun::runCommand( "kaddressbook" ); +} + +#include "labeleditor.moc" diff --git a/kbarcode/labeleditor.h b/kbarcode/labeleditor.h new file mode 100644 index 0000000..9bd9b30 --- /dev/null +++ b/kbarcode/labeleditor.h @@ -0,0 +1,251 @@ +/*************************************************************************** + labeleditor.h - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef LABELEDITOR_H +#define LABELEDITOR_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "sqltables.h" +#include "labelutils.h" +#include "definition.h" +#include "dsmainwindow.h" +#include "xmlutils.h" +#include "editoriface.h" + +#include +#include +#include + +class BatchPrinter; +class KURL; +class KAction; +class KActionMenu; +class KActionSeparator; +class KToggleAction; +class KRecentFilesAction; +class KToolBarPopupAction; +class KListBox; +class KMenuBar; +class KPopupMenu; +class KRuler; +class KToolBar; +class KCommandHistory; +class MyCanvasText; +class MyCanvasRectangle; +class MyCanvasView; +class BarcodeItem; +class MyCanvas; +class QCanvasItemList; +class QCheckBox; +class KComboBox; +class QDockArea; +class QDockWindow; +class QGroupBox; +class QLabel; +class QImage; +class QHBoxLayout; +class QVBoxLayout; +class QPoint; +class QRect; +class QPaintDevice; +class QString; +class KPushButton; +class KPrinter; +class QCanvasItem; +class TCanvasItem; +class RectItem; +class LineItem; + +class TokenProvider; +/** The LabelEditor is a graphical, easy to use label designer. + * It provides all the function necessary to create colorful labels + * and save them. Labels can also be printed directly, but without database + * support. Use Batchprinting (LabelPrinter) for this. + */ +class LabelEditor : public DSMainWindow, public EditorIface, private LabelUtils, private XMLUtils { + Q_OBJECT + public: + enum ELabelEditorMode { + eCreateNewLabel, + eLoadLabel + }; + + LabelEditor( QWidget *parent=0, QString _filename = QString::null, + const char *name="labeleditor", WFlags f = WType_TopLevel | WDestructiveClose ); + ~LabelEditor(); + bool startupDlg( ELabelEditorMode mode, QString f = QString::null ); + + /** + * returns the filename of the currently loaded label. + */ + const QString fileName() const; + + public slots: + void print(); + void printBCP(); + void printImage(); + + private: + + /** Creates a KCommandHistory object which will be + * pointed to by history. + * Make sure to delete history by yourself when needed. + */ + void createCommandHistory(); + /** Create undo and redo actions and plug them into + * menus and toolbars. They have to be regenerated + * when ever createCommandHistory was called. + */ + void createCommandHistoryActions(); + + QString getCustomerName( int mode = 0, QString text = "" ); + void clearLabel(); + //void setupBarcode( BarcodeItem* bcode ); + void insertText( QString caption ); + //NY35 + void insertTextLine( QString caption ); + //NY35 + void setupActions(); + void enableActions(); + bool isChanged(); // if the current document has been changed + void batchPrint( BatchPrinter* batch, int copies, int mode ); + void setupContextMenu(); + + private slots: + void startEditor(); + bool open(); + bool openUrl( const QString & url ); + bool save(); + bool saveas(); + bool save( QString url ); + void save( QIODevice* device ); + bool newLabel(); + void insertBarcode(); + void insertPicture(); + void insertText(); + void insertDataText(); + //NY36 + void insertTextLine(); + //NY36 + void insertRect(); + void insertCircle(); + void insertLine(); + + void changeDes(); + void changeSize(); + void updateInfo(); + void doubleClickedItem( TCanvasItem* item ); + void showContextMenu( QPoint pos ); + void doubleClickedCurrent(); + void spellCheck(); + void centerVertical(); + void centerHorizontal(); + void raiseCurrent(); + void lowerCurrent(); + void onTopCurrent(); + void backCurrent(); + void preview(); + void toggleGrid(); + void cut(); + void copy(); + void paste(); + void startBarcodeGen(); + void saveConfig(); + void loadConfig(); + void startLoadRecentEditor( const KURL& url ); + void startLoadEditor(); + void batchPrint(); + void closeLabel(); + void setEdited(); + void launchAddressBook(); + void lockItem(); + + protected: + void closeEvent( QCloseEvent* e ); + + KCommandHistory* history; + + KAction* saveAct; + KAction* saveAsAct; + KAction* exportAct; + KAction* descriptionAct; + KAction* printAct; + KAction* bcpAct; + KAction* imgAct; + KAction* changeSizeAct; + KAction* deleteAct; + KAction* editPropAct; + KAction* barcodeAct; + KAction* rectAct; + KAction* circleAct; + KAction* lineAct; + KAction* pictureAct; + KAction* previewAct; + KAction* textAct; + KAction* textDataAct; + KAction* textLineAct; + KAction* spellAct; + KAction* cutAct; + KAction* copyAct; + KAction* pasteAct; + KAction* undoAct; + KAction* redoAct; + KAction* closeLabelAct; + KAction* addressBookAct; + KAction* selectAllAct; + KAction* deSelectAllAct; + + /** + * Undo/Redo actins get pluged into this menu + */ + KPopupMenu* editMenu; + KPopupMenu* exportMenu; + KPopupMenu* m_mnuContext; + + KToolBar* tools; + + KToggleAction* gridAct; + + KComboBox* comboScale; + + KRecentFilesAction* recentAct; + KActionSeparator* sep; + KToolBarPopupAction* listAct; + MyCanvas* c; + MyCanvasView* cv; + + Definition* d; + TokenProvider* m_token; + + // Label info's: + QString description; // description + QString filename; // current file + + KListBox* listFields; + KPushButton* buttonText; + + QVBoxLayout* pageLayout; + + QMap fields; + + bool m_edited; +}; + +#endif diff --git a/kbarcode/labelutils.cpp b/kbarcode/labelutils.cpp new file mode 100644 index 0000000..7325f3e --- /dev/null +++ b/kbarcode/labelutils.cpp @@ -0,0 +1,188 @@ +/*************************************************************************** + labelutils.cpp - description + ------------------- + begin : Sam Okt 26 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "labelutils.h" +#include "dsrichtext.h" + +// Qt includes +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include + +// own includes +#include "printersettings.h" + +#define CONVERSION_FACTOR 25.4000508001016 + +LabelUtils::LabelUtils() +{ +} + +LabelUtils::~LabelUtils() +{ } + +double LabelUtils::pixelToMm( double pixel, const QPaintDevice* device, int mode ) +{ + QPaintDeviceMetrics pdm( device ? device : KApplication::desktop() ); + if( mode == DpiX ) + return (pixel * CONVERSION_FACTOR) / (double)pdm.logicalDpiX(); + else + return (pixel * CONVERSION_FACTOR) / (double)pdm.logicalDpiY(); +} + +double LabelUtils::mmToPixel( double mm, const QPaintDevice* device, int mode ) +{ + if( !mm ) + return 0; + + // We don't get valid metrics from the printer - and we want a better resolution + // anyway (it's the PS driver that takes care of the printer resolution). + + QPaintDeviceMetrics pdm( device ? device : KApplication::desktop() ); + +// qDebug("DpiX=%i", pdm.logicalDpiX()); +// qDebug("DpiY=%i", pdm.logicalDpiY()); + if( mode == DpiX ) + return (mm / CONVERSION_FACTOR) * (double)pdm.logicalDpiX(); + else + return (mm / CONVERSION_FACTOR) * (double)pdm.logicalDpiY(); +} + +double LabelUtils::pixelToPixelX( double unit, const QPaintDevice* src, const QPaintDevice* dest ) +{ + QPaintDeviceMetrics p1( src ); + QPaintDeviceMetrics p2( dest ); + + return ( unit * (double)p2.logicalDpiX() ) / (double)p1.logicalDpiX(); +} + +double LabelUtils::pixelToPixelY( double unit, const QPaintDevice* src, const QPaintDevice* dest ) +{ + QPaintDeviceMetrics p1( src ); + QPaintDeviceMetrics p2( dest ); + + //return pixelToPixelX( unit, src, dest ); + return ( unit * (double)p2.logicalDpiY() ) / (double)p1.logicalDpiY(); +} + +const QString LabelUtils::getTypeFromCaption( const QString & cap ) +{ + // TODO: remove this function + QString search = cap.right( cap.length() - cap.find(":") - 1 ).lower().stripWhiteSpace(); + return search; +} + +const QString LabelUtils::getModeFromCaption( const QString & cap ) +{ + return cap.left( cap.find(":") ).lower().stripWhiteSpace(); +} + +QSize LabelUtils::stringSize( const QString & t ) +{ + QSimpleRichText srt( t, KApplication::font() ); + QSize s; + s.setWidth( srt.widthUsed() ); + s.setHeight( srt.height() ); + + return s; +} + +void LabelUtils::renderString( QPainter* painter, const QString & t, const QRect & rect, double scalex, double scaley ) +{ + // DSRichText cannot calculate the width on its own + QSimpleRichText srt( t, KApplication::font() ); + int width = (rect.width() > 0) ? rect.width() : srt.widthUsed(); + int height = (rect.height() > 0) ? rect.height() : srt.height(); + + DSRichText r( t ); + r.setX( rect.x() ); + r.setY( rect.y() ); + r.setWidth( width ); + r.setHeight( height ); + r.setScale( scalex, scaley ); + r.draw( painter ); +} + +QPixmap* LabelUtils::drawString( const QString & t, int w, int h, double rot ) +{ + QSimpleRichText srt( t, KApplication::font() ); + + int width = (w > 0) ? w : srt.widthUsed(); + int height = (h > 0) ? h : srt.height(); + srt.setWidth( width ); + + QPixmap* pix; + QPainter painter; + if( rot == 0.0 ) { + QBitmap bm( width, height ); + bm.fill( Qt::color0 ); //transparent + painter.begin( &bm ); + + painter.save(); + painter.setPen( Qt::color1 ); + QColorGroup cg; + cg.setColor( QColorGroup::Foreground, Qt::color1 ); + cg.setColor( QColorGroup::Text, Qt::color1 ); + cg.setColor( QColorGroup::Base, Qt::color0 ); + + srt.draw( &painter, 0, 0, bm.rect(), cg ); + painter.restore(); + painter.end(); + + pix = new QPixmap( width, height ); + pix->fill( Qt::white ); + pix->setMask( bm ); + + if( !pix->isNull() ) { + painter.begin( pix ); + painter.setPen( Qt::black ); + QColorGroup cg; + srt.draw( &painter, 0, 0, pix->rect(), cg ); + painter.end(); + } + } else { + int w2 = (w > 0) ? w : srt.widthUsed(); + int h2 = (h > 0) ? h : srt.height(); + + QWMatrix wm; + wm.rotate( rot ); + + QSize s = LabelUtils::stringSize( t ); + QPixmap* tmp = LabelUtils::drawString( t, s.width(), s.height() ); + + QPixmap* p = new QPixmap( w2, h2 ); + p->fill( Qt::white ); + painter.begin( p ); + painter.drawPixmap( 0, 0, tmp->xForm( wm ) ); + painter.end(); + + p->setMask( p->createHeuristicMask() ); + + pix = p; + delete tmp; + } + + return pix; +} + diff --git a/kbarcode/labelutils.h b/kbarcode/labelutils.h new file mode 100644 index 0000000..724000d --- /dev/null +++ b/kbarcode/labelutils.h @@ -0,0 +1,61 @@ +/*************************************************************************** + labelutils.h - description + ------------------- + begin : Sam Okt 26 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef LABELUTILS_H +#define LABELUTILS_H + +class Definition; +class KPrinter; +class QDomElement; +class QFont; +class QImage; +class QPainter; +class QPixmap; +class QPaintDevice; +class QPoint; +class QRect; +class QSize; +class QString; +class QStringList; +class QSqlQuery; +class LabelUtils { + public: + LabelUtils(); + ~LabelUtils(); + + enum _dpixy { + DpiX, + DpiY + }; + + double pixelToMm( double pixel, const QPaintDevice* device, int mode = DpiX ); + double mmToPixel( double mm, const QPaintDevice* device, int mode = DpiX ); + + double pixelToPixelX( double unit, const QPaintDevice* src, const QPaintDevice* dest ); + double pixelToPixelY( double unit, const QPaintDevice* src, const QPaintDevice* dest ); + static QSize stringSize( const QString & t ); + static QPixmap* drawString( const QString & t, int w, int h, double rot = 0 ); + static QPixmap* drawString( const QString & t ) { + return LabelUtils::drawString( t, 0, 0, 0 ); + } + static void renderString( QPainter* painter, const QString & t, const QRect & r, double scalex, double scaley ); + + const QString getTypeFromCaption( const QString & cap ); + const QString getModeFromCaption( const QString & cap ); +}; + +#endif diff --git a/kbarcode/lineitem.cpp b/kbarcode/lineitem.cpp new file mode 100644 index 0000000..5e7ae65 --- /dev/null +++ b/kbarcode/lineitem.cpp @@ -0,0 +1,67 @@ +/*************************************************************************** + lineitem.cpp - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include + +#include "documentitem.h" +#include "lineitem.h" + +#include + +LineItem::LineItem() + : DocumentItem() +{ + init(); +} + +void LineItem::init() +{ + setRect( QRect( 0, 0, 20, 20 ) ); +} + +void LineItem::draw(QPainter* painter) +{ + painter->save(); + painter->setPen( pen() ); + painter->drawLine( rect().x(), rect().y(), rect().x() + rect().width(), rect().y() + rect().height() ); + painter->restore(); +} + +void LineItem::drawZpl( QTextStream* ) +{ + qDebug("LineItem not implemented for ZPL"); +} + +void LineItem::drawEPcl( QTextStream* ) +{ + qDebug("LineItem not implemented for EPCL"); +} + +void LineItem::drawIpl( QTextStream*, IPLUtils* ) +{ + qDebug("LineItem not implemented for IPL"); +} + +void LineItem::loadXML(QDomElement* element) +{ + DocumentItem::loadXML(element); +} + +void LineItem::saveXML(QDomElement* element) +{ + DocumentItem::saveXML(element); +} diff --git a/kbarcode/lineitem.h b/kbarcode/lineitem.h new file mode 100644 index 0000000..0843a42 --- /dev/null +++ b/kbarcode/lineitem.h @@ -0,0 +1,44 @@ +/*************************************************************************** + lineitem.h - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef LINEITEM_H +#define LINEITEM_H +#include +#include "documentitem.h" +#include "qcolor.h" + +/** + * Class LineItem + * Implements a line on screen or printer + */ +class LineItem : public DocumentItem { +public: + LineItem (); + + virtual int rtti() const { return eRtti_Line; } + virtual void draw(QPainter* painter); + virtual void drawZpl( QTextStream* stream ); + virtual void drawIpl( QTextStream* stream, IPLUtils* utils ); + virtual void drawEPcl( QTextStream* stream ); + virtual void loadXML(QDomElement* element); + virtual void saveXML(QDomElement* element); + +private: + void init(); +}; +#endif //LINEITEM_H + diff --git a/kbarcode/logo.png b/kbarcode/logo.png new file mode 100644 index 0000000..d50eefb Binary files /dev/null and b/kbarcode/logo.png differ diff --git a/kbarcode/main.cpp b/kbarcode/main.cpp new file mode 100644 index 0000000..081cf08 --- /dev/null +++ b/kbarcode/main.cpp @@ -0,0 +1,121 @@ +/*************************************************************************** + main.cpp - description + ------------------- + begin : Don Apr 18 12:34:56 CEST 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "kbarcode.h" +#include "labeleditor.h" +#include "barcodedialog.h" + +#ifndef VERSION + #define VERSION "Unknown Version" +#endif + +static KCmdLineOptions options[] = +{ + { "+[file]", I18N_NOOP("Load the file in KBarcode (if --batch is specified, the file will be used in batchprinting mode)"), 0}, + { "print", I18N_NOOP("Print any loaded files immediately on the default printer " + "or on the printer specified by the --printer commandline option and exit afterwards"), 0 }, + { "printer ", I18N_NOOP("Printer/destination to print on"), 0}, + { ":", I18N_NOOP("KBarcode Modes:"), 0 }, + { "barcode", I18N_NOOP("Start KBarcode as xbarcode replacement"), 0 }, + { "label", I18N_NOOP("Open the label editor"), 0 }, + { "batch", I18N_NOOP("Start directly in batchprinting mode"), 0 }, + { ":", I18N_NOOP("Additional options for batchprinting (--batch):"), 0 }, + { "output ", I18N_NOOP("Output format where mode is one of POSTSCRIPT|IMAGE|BARCODE"), "POSTSCRIPT" }, + { "serialnumber ", I18N_NOOP("Set the serial number to be used"), 0 }, + { "serialinc ", I18N_NOOP("Increase a previously specified serial number using this value for each printed label"), 0 }, + { "numlabels ", I18N_NOOP("Print labels without any data"), 0 }, + { "importsql ", I18N_NOOP("Import variable data from a specified sql query"), 0 }, + { "importcsv ", I18N_NOOP("Import variable data from a specified csv file"), 0 }, + KCmdLineLastOption +}; + +void setupDirs() +{ + if( locate("data", "kbarcode/logo.png").isEmpty() ) { + // Maybe KBarcode was not installed into $KDEDIR + KStandardDirs* dirs = KGlobal::dirs(); + QString kdedir = dirs->kfsstnd_prefixes(); + + if( !kdedir.contains( "/usr/local/" ) ) + dirs->addPrefix( "/usr/local/" ); + + if( !kdedir.contains( "/usr/local/kde/" ) ) + dirs->addPrefix( "/usr/local/kde/" ); + + if( !kdedir.contains( "/usr/" ) ) + dirs->addPrefix( "/usr/" ); + + qDebug("WARNING: Prefix changed: %s", dirs->kfsstnd_prefixes().latin1() ); + } +} + +int main(int argc, char *argv[]) +{ + KAboutData aboutData( "kbarcode", I18N_NOOP("KBarcode"), VERSION, I18N_NOOP( + "KBarcode is a barcode and label printing application for KDE 3." + ), KAboutData::License_GPL, "KBarcode Build:\n" __DATE__ " " __TIME__ + , "(c) 2001-2006, Dominik Seichter\n\n", + "http://www.kbarcode.net", "kbarcode-users@lists.sourceforge.net" ); + + aboutData.addAuthor("Dominik Seichter", I18N_NOOP("Programmer"), "domseichter@web.de"); + aboutData.addAuthor("Stefan \"Stonki\" Onken", + I18N_NOOP("Project Manager"), + "support@stonki.de", "http://www.stonki.de" ); + + aboutData.addCredit("Alessandro Rubini", I18N_NOOP("Wrote GNU Barcode on which kbarcode is based."), + "rubini@prosa.it", "http://arcana.linux.it/" ); + aboutData.addCredit("Terry Burton", I18N_NOOP("Author of Barcode Writer in Pure Postscript"), + "tez@terryburton.co.uk", "http://www.terryburton.co.uk/" ); + aboutData.addCredit("Daniele Medri", I18N_NOOP("Italian translation"), "madrid@linuxmeeting.net" ); + aboutData.addCredit("Anton Vaaranmaa", + I18N_NOOP("Finnish and Swedish translation, created the KBarcode icon"), "antonv@postikaista.net" ); + aboutData.addCredit("Miguel Revilla Rodr�uez", I18N_NOOP("Spanish translation"), "yo@miguelrevilla.com" ); + aboutData.addCredit("Sandor Jager", I18N_NOOP("Hungarian translation"), "jager@puskas.hu" ); + aboutData.addCredit("Daniel Etzold", + I18N_NOOP("Tab icon code stolen from his excellent app qtella."), "detzold@qtella.net" ); + aboutData.addCredit("Richard J. Moore", I18N_NOOP("Wrote the RichText KPart"), "rich@kde.org", "http://xmelegance.org/" ); + aboutData.addCredit("Yann Bouan", I18N_NOOP("French Translation"), "yann@bouan.net" ); + aboutData.addCredit("Erich Kitzmüller", I18N_NOOP("Help with ZPL and IPL code"), "kitzmueller@metasyst.at" ); + aboutData.addCredit("Dag Nygren", I18N_NOOP("Wrote many patches to improve KBarcode"), "dag@newtech.fi" ); + aboutData.addCredit("Frank Schoolmeesters", I18N_NOOP("Made the Netherlands translation"), "frank_schoolmeesters@fastmail.fm" ); + aboutData.addCredit("John Volpe", I18N_NOOP("Added lot's of useful data fields to kbarcode"), "jtvolpe@cape.com" ); + aboutData.addCredit("Nyssa s.r.l.", I18N_NOOP("Added TEC barcode printer support"), "imorrison@nyssa.com.ar", "http://www.nyssa.com.ar" ); + aboutData.addCredit("Brian Glass", I18N_NOOP("Added EPCL barcode printer support"), "brian@glassbrian.com", "http://www.glassbrian.com" ); + KCmdLineArgs::init( argc, argv, &aboutData ); + KCmdLineArgs::addCmdLineOptions( options ); + + KApplication a; + // setup standard dirs + setupDirs(); + + KImageIO::registerFormats(); + a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); + + KBarcode* kbc = new KBarcode( 0, "KBarcodeMainWindow" ); + + if( kbc->parseCmdLine() ) + return 0; + else + return a.exec(); +} diff --git a/kbarcode/measurements.cpp b/kbarcode/measurements.cpp new file mode 100644 index 0000000..07044ec --- /dev/null +++ b/kbarcode/measurements.cpp @@ -0,0 +1,164 @@ +/*************************************************************************** + measurements.cpp - description + ------------------- + begin : Mit Dec 24 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "measurements.h" + +// Qt includes +#include + +// KDE includes +#include + +Measurements::Measurements() +{ + Measurements::init(); + + defaultMeasurements(); +} + +Measurements::Measurements( const Measurements & rhs ) +{ + Measurements::init(); + + this->operator=( rhs ); +} + + +Measurements::~Measurements() {} + +int Measurements::m_system = None; +QString Measurements::m_string = QString::null; + +void Measurements::init() +{ + if( m_system == None ) { + m_system = KGlobal::locale()->measureSystem(); + m_string = (m_system == Metric) ? + KGlobal::staticQString( i18n("mm" ) ) : + KGlobal::staticQString( i18n("in" ) ); + } +} + +void Measurements::defaultMeasurements() { + // init everything in case of + // database connection fails. + gap_h = 40.0; + gap_left = 0.0; + gap_top = 0.0; + gap_v = 40.0; + m_height = 40.0; + num_h = 1; + num_v = 1; + m_width = 40.0; +} + +void Measurements::operator=( const Measurements & m ) { + num_h = m.num_h; + num_v = m.num_v; + gap_left = m.gap_left; + gap_top = m.gap_top; + gap_v = m.gap_v; + gap_h = m.gap_h; + m_width = m.m_width; + m_height = m.m_height; +} + +double Measurements::mmToPixel( double mm, const QPaintDevice* device, int mode ) const { + QPaintDeviceMetrics pdm( device ); + if( mode == DpiX ) + return (mm / 25.4) * pdm.logicalDpiX(); + else + return (mm / 25.4 ) * pdm.logicalDpiY(); +} + +double Measurements::gapLeft( const QPaintDevice* device ) const { + return mmToPixel( gap_left, device, DpiX ); +} + +double Measurements::gapTop( const QPaintDevice* device ) const { + return mmToPixel( gap_top, device, DpiY ); +} + +double Measurements::gapV( const QPaintDevice* device ) const { + return mmToPixel( gap_v, device, DpiX ); +} + +double Measurements::gapH( const QPaintDevice* device ) const { + return mmToPixel( gap_h, device, DpiY ); +} + +double Measurements::width( const QPaintDevice* device ) const { + return mmToPixel( m_width, device, DpiX ); +} + +double Measurements::height( const QPaintDevice* device ) const { + return mmToPixel( m_height, device, DpiY ); +} + +double Measurements::gapLeft() const { + return (gapLeftMM() / (m_system == Imperial ? 25.4 : 1 )); +} + +double Measurements::gapTop() const { + return (gapTopMM() / (m_system == Imperial ? 25.4 : 1 )); +} + +double Measurements::gapV() const { + return (gapVMM() / (m_system == Imperial ? 25.4 : 1 )); +} + +double Measurements::gapH() const { + return (gapHMM() / (m_system == Imperial ? 25.4 : 1 )); +} + +double Measurements::width() const { + return (widthMM() / (m_system == Imperial ? 25.4 : 1 )); +} + +double Measurements::height() const { + return (heightMM() / (m_system == Imperial ? 25.4 : 1 )); +} + +void Measurements::setGapLeft( double d ) +{ + gap_left = (d * (m_system == Imperial ? 25.4 : 1 )); +} + +void Measurements::setGapTop( double d ) +{ + gap_top = (d * (m_system == Imperial ? 25.4 : 1 )); +} + +void Measurements::setGapV( double d ) +{ + gap_v = (d * (m_system == Imperial ? 25.4 : 1 )); +} + +void Measurements::setGapH( double d ) +{ + gap_h = (d * (m_system == Imperial ? 25.4 : 1 )); +} + +void Measurements::setWidth( double d ) +{ + m_width = (d * (m_system == Imperial ? 25.4 : 1 )); +} + +void Measurements::setHeight( double d ) +{ + m_height = (d * (m_system == Imperial ? 25.4 : 1 )); +} diff --git a/kbarcode/measurements.h b/kbarcode/measurements.h new file mode 100644 index 0000000..a95e666 --- /dev/null +++ b/kbarcode/measurements.h @@ -0,0 +1,134 @@ +/*************************************************************************** + measurements.h - description + ------------------- + begin : Mit Dec 24 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MEASUREMENTS_H +#define MEASUREMENTS_H + +#include + +class QPaintDevice; + +/** + * This class keeps all measurements required to correctly draw a label. + * The measurements are available in pixels, milimeter and inch. + * This class allows also for transformations from inch to mm or pixels + * (and the other way round). Internally, everything is handled in mm. + * + * @author Dominik Seichter + */ +class Measurements { + public: + enum { + DpiX, + DpiY + }; + + enum { + Metric = KLocale::Metric, + Imperial = KLocale::Imperial, + None + }; + + Measurements(); + Measurements( const Measurements & rhs ); + ~Measurements(); + + int numH() const { return num_h; } + int numV() const { return num_v; } + + double gapLeftMM() const { return gap_left; } + double gapTopMM() const { return gap_top; } + double gapVMM() const { return gap_v; } + double gapHMM() const { return gap_h; } + double widthMM() const { return m_width; } + double heightMM() const { return m_height; } + + // return inch or milimeters according to the + // users preferrences + double gapLeft() const; + double gapTop() const; + double gapV() const; + double gapH() const; + double width() const; + double height() const; + + double gapLeft( const QPaintDevice* device ) const; + double gapTop( const QPaintDevice* device ) const; + double gapV( const QPaintDevice* device ) const; + double gapH( const QPaintDevice* device ) const; + double width( const QPaintDevice* device ) const; + double height( const QPaintDevice* device ) const; + + void setNumH( int n ) { num_h = n; } + void setNumV( int n ) { num_v = n; } + + // use milimeters for all of the setter methods + void setGapLeftMM( double d ) { gap_left = d; } + void setGapTopMM( double d ) { gap_top = d; } + void setGapVMM( double d ) { gap_v = d; } + void setGapHMM( double d ) { gap_h = d; } + void setWidthMM( double d ) { m_width = d; } + void setHeightMM( double d ) { m_height = d; } + + // inch or milimeters are taken as input + // according to the users preferrences + void setGapLeft( double d ); + void setGapTop( double d ); + void setGapV( double d ); + void setGapH( double d ); + void setWidth( double d ); + void setHeight( double d ); + + void operator=(const Measurements & rhs ); + + /** return the localized string that should be appended + * to a measurement number visible to the user. I.e. + * "mm" or "in". + */ + static const QString & system() { Measurements::init(); return m_string; } + + /** return the measurements system to be used. + */ + static int measurementSystem() { Measurements::init(); return m_system; } + + private: + /** initialize measurements with the correctly + * measurements system to be used from KDE. + */ + static void init(); + + void defaultMeasurements(); + + double mmToPixel( double mm, const QPaintDevice* device, int mode = DpiX ) const; + + /** Measurement system to use: + * milimeters or inch + */ + static int m_system; + static QString m_string; + + int num_h; + int num_v; + double gap_left; + double gap_top; + double gap_v; + double gap_h; + double m_width; + double m_height; +}; + +#endif diff --git a/kbarcode/mimesources.cpp b/kbarcode/mimesources.cpp new file mode 100644 index 0000000..c02ded7 --- /dev/null +++ b/kbarcode/mimesources.cpp @@ -0,0 +1,129 @@ +/*************************************************************************** + mimesources.cpp - description + ------------------- + begin : Son Sep 14 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "mimesources.h" +#include "mycanvasview.h" +#include "documentitem.h" +#include "commands.h" +#include "xmlutils.h" + +#include + +#include +#include +#include + +class DragCommand : public NewItemCommand { + public: + DragCommand( MyCanvasView* view, DocumentItem* doc_item ) + : NewItemCommand( view, i18n("Pasted Object") ) + { + m_doc_item = doc_item; + } + + void create() + { + m_object = m_doc_item; + } + + private: + DocumentItem* m_doc_item; +}; + + + +DocumentItemDrag::DocumentItemDrag( QWidget* dragSource, const char* name ) + : QStoredDrag( DocumentItemDrag::mimeType(), dragSource, name ) +{ +} + +QString DocumentItemDrag::mimeType() +{ + return "application/x-kbarcode-document-item"; +} + +void DocumentItemDrag::setDocumentItem( DocumentItemList* list ) +{ + QByteArray data; + QBuffer buffer( data ); + if( buffer.open( IO_WriteOnly ) ) + { + QDomDocument doc("KBarcodeClipboard"); + QDomElement root = doc.createElement( "root" ); + doc.appendChild( root ); + + XMLUtils xml; + for( unsigned int i=0;icount();i++) + { + DocumentItem* item = list->at( i ); + xml.writeXMLDocumentItem( &root, &item ); + } + + QTextStream t( &buffer ); + doc.save( t, 0 ); + + buffer.close(); + setEncodedData( data ); + } +} + +bool DocumentItemDrag::canDecode( QMimeSource* e ) +{ + return e->provides( DocumentItemDrag::mimeType() ); +} + +bool DocumentItemDrag::decode( QMimeSource* mime, MyCanvasView* cv, TokenProvider* token, KCommandHistory* history ) +{ + QByteArray data = mime->encodedData( DocumentItemDrag::mimeType() ); + QDomDocument doc( "KBarcodeClipboard" ); + if( !doc.setContent( data ) ) + return false; + + QDomNode n = doc.documentElement(); + QDomNodeList list = n.childNodes(); + KMacroCommand* commands = new KMacroCommand( i18n("Paste") ); + + for( unsigned int i=0;iexecute(); + commands->addCommand( dc ); + } + else + { + delete commands; + return false; + } + } + } + + history->addCommand( commands, false ); + + return true; +} + + +#include "mimesources.moc" diff --git a/kbarcode/mimesources.h b/kbarcode/mimesources.h new file mode 100644 index 0000000..abaf5d7 --- /dev/null +++ b/kbarcode/mimesources.h @@ -0,0 +1,41 @@ +/*************************************************************************** + mimesources.h - description + ------------------- + begin : Son Sep 14 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MIMESOURCES_H +#define MIMESOURCES_H + +#include +#include "documentitem.h" + +class KCommandHistory; +class TokenProvider; +class MyCanvasView; + +class DocumentItemDrag : public QStoredDrag { + Q_OBJECT + public: + DocumentItemDrag( QWidget* dragSource = NULL, const char* name = 0 ); + + static QString mimeType(); + + void setDocumentItem( DocumentItemList* list ); + + static bool canDecode( QMimeSource * ); + static bool decode( QMimeSource *, MyCanvasView* cv, TokenProvider* token, KCommandHistory* history ); +}; + +#endif diff --git a/kbarcode/multilineeditdlg.cpp b/kbarcode/multilineeditdlg.cpp new file mode 100644 index 0000000..650f58e --- /dev/null +++ b/kbarcode/multilineeditdlg.cpp @@ -0,0 +1,312 @@ +/*************************************************************************** + multilineeditdlg.cpp - description + ------------------- + begin : Sam Jan 11 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "multilineeditdlg.h" +#include "tokendialog.h" + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include + +MultiLineEditor::MultiLineEditor( TokenProvider* token, QWidget *parent, const char *name ) + : QWidget( parent, name ), m_token( token ) +{ + QVBoxLayout* layout = new QVBoxLayout( this, 6, 6 ); + +// ksc = new KSpellConfig( this ); + + editor = new DSTextEdit( this ); + editor->setTextFormat( Qt::RichText ); + //editor->setText( text, "" ); + editor->setFocus(); + + QDockArea* area = new QDockArea( Qt::Horizontal, QDockArea::Normal, this ); + toolBar = new KToolBar( area ); + tool2Bar = new KToolBar( area ); + tool3Bar = new KToolBar( area ); + + setupActions(); + + layout->addWidget( area ); + layout->addWidget( editor ); + +} + +MultiLineEditor::~MultiLineEditor() +{ +} + + +void MultiLineEditor::setupActions() +{ + ac = new KActionCollection( this ); + + KAction* action_export = new KAction( i18n("Export"), "fileexport", 0, this, SLOT( save() ), ac ); + + // + // Edit Actions + // + KAction *action_undo = KStdAction::undo( editor, SLOT( undo() ), ac ); + action_undo->setEnabled( false ); + connect( editor, SIGNAL( undoAvailable(bool) ), action_undo, SLOT( setEnabled(bool) ) ); + + + KAction *action_redo = KStdAction::redo( editor, SLOT( redo() ), ac ); + action_redo->setEnabled( false ); + connect( editor, SIGNAL( redoAvailable(bool) ), action_redo, SLOT( setEnabled(bool) ) ); + + KAction *action_cut = KStdAction::cut( editor, SLOT( cut() ), ac ); + action_cut->setEnabled( false ); + connect( editor, SIGNAL( copyAvailable(bool) ), action_cut, SLOT( setEnabled(bool) ) ); + + KAction *action_copy = KStdAction::copy( editor, SLOT( copy() ), ac ); + action_copy->setEnabled( false ); + connect( editor, SIGNAL( copyAvailable(bool) ), action_copy, SLOT( setEnabled(bool) ) ); + + KAction* action_paste = KStdAction::paste( editor, SLOT( paste() ), ac ); + + // + // Character Formatting + // + action_bold = new KToggleAction( i18n("&Bold"), "text_bold", CTRL+Key_B, ac, "format_bold" ); + connect( action_bold, SIGNAL( toggled(bool) ), editor, SLOT( setBold(bool) ) ); + + action_italic = new KToggleAction( i18n("&Italic"), "text_italic", CTRL+Key_I, ac, "format_italic" ); + connect( action_italic, SIGNAL( toggled(bool) ), editor, SLOT( setItalic(bool) ) ); + + action_underline = new KToggleAction( i18n("&Underline"), "text_under", CTRL+Key_U, ac, "format_underline" ); + connect( action_underline, SIGNAL( toggled(bool) ), editor, SLOT( setUnderline(bool) ) ); + + KAction* action_color = new KAction( i18n("Text &Color..."), "colorpicker", 0, this, SLOT( formatColor() ), ac, "format_color" ); + + // + // Font + // + action_font = new KFontAction( i18n("&Font"), 0, ac, "format_font" ); + connect( action_font, SIGNAL( activated( const QString & ) ), editor, SLOT( setFamily( const QString & ) ) ); + + action_font_size = new KFontSizeAction( i18n("Font &Size"), 0, ac, "format_font_size" ); + connect( action_font_size, SIGNAL( fontSizeChanged(int) ), editor, SLOT( setPointSize(int) ) ); + + // + // Alignment + // + action_align_left = new KToggleAction( i18n("Align &Left"), "text_left", 0, ac, "format_align_left" ); + connect( action_align_left, SIGNAL( toggled(bool) ), this, SLOT( setAlignLeft(bool) ) ); + + action_align_center = new KToggleAction( i18n("Align &Center"), "text_center", 0, ac, "format_align_center" ); + connect( action_align_center, SIGNAL( toggled(bool) ), this, SLOT( setAlignCenter(bool) ) ); + + action_align_right = new KToggleAction( i18n("Align &Right"), "text_right", 0, ac, "format_align_right" ); + connect( action_align_right, SIGNAL( toggled(bool) ), this, SLOT( setAlignRight(bool) ) ); + + action_align_justify = new KToggleAction( i18n("&Justify"), "text_block", 0, ac, "format_align_justify" ); + connect( action_align_justify, SIGNAL( toggled(bool) ), this, SLOT( setAlignJustify(bool) ) ); + + action_align_left->setExclusiveGroup( "alignment" ); + action_align_center->setExclusiveGroup( "alignment" ); + action_align_right->setExclusiveGroup( "alignment" ); + action_align_justify->setExclusiveGroup( "alignment" ); + + //KAction* action_spell = KStdAction::spelling( this, SLOT( checkSpelling() ), ac ); + + KAction* textDataAct = new KAction( i18n("Insert &Data Field"), "contents", 0, this, SLOT( insertNewField() ), ac, "text_data_act"); action_export->plug( toolBar ); + + toolBar->insertSeparator(); + action_undo->plug( toolBar ); + action_redo->plug( toolBar ); + toolBar->insertSeparator(); + action_cut->plug( toolBar ); + action_copy->plug( toolBar ); + action_paste->plug( toolBar ); + toolBar->insertSeparator(); + action_bold->plug( toolBar ); + action_italic->plug( toolBar ); + action_underline->plug( toolBar ); + toolBar->insertSeparator(); +//#if KDE_IS_VERSION( 3, 1, 90 ) +// action_spell->plug( toolBar ); +//#endif + + action_font->plug( tool2Bar ); + action_font_size->plug( tool2Bar ); + action_color->plug( tool2Bar ); + tool2Bar->insertSeparator(); + action_align_left->plug( tool2Bar ); + action_align_center->plug( tool2Bar ); + action_align_right->plug( tool2Bar ); + action_align_justify->plug( tool2Bar ); + + textDataAct->plug( tool3Bar ); + + // + // Setup enable/disable + // + updateActions(); + + connect( editor, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( updateFont() ) ); + connect( editor, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( updateCharFmt() ) ); + connect( editor, SIGNAL( cursorPositionChanged( int,int ) ), this, SLOT( updateAligment() ) ); +} + +QString MultiLineEditor::text() +{ + return editor->text(); +} + +void MultiLineEditor::setText( const QString & t ) +{ + editor->setText( t ); +} + +void MultiLineEditor::updateCharFmt() +{ + action_bold->setChecked( editor->bold() ); + action_italic->setChecked( editor->italic() ); + action_underline->setChecked( editor->underline() ); +} + +void MultiLineEditor::updateAligment() +{ + int align = editor->alignment(); + + switch ( align ) { + case AlignRight: + action_align_right->setChecked( true ); + break; + case AlignCenter: + action_align_center->setChecked( true ); + break; + case AlignLeft: + action_align_left->setChecked( true ); + break; + case AlignJustify: + action_align_justify->setChecked( true ); + break; + default: + break; + } +} + +void MultiLineEditor::updateFont() +{ + if ( editor->pointSize() > 0 ) + action_font_size->setFontSize( editor->pointSize() ); + action_font->setFont( editor->family() ); +} + +void MultiLineEditor::updateActions() +{ + updateCharFmt(); + updateAligment(); + updateFont(); +} + +void MultiLineEditor::formatColor() +{ + QColor col; + + int s = KColorDialog::getColor( col, editor->color(), editor ); + if ( s != QDialog::Accepted ) + return; + + editor->setColor( col ); +} + +void MultiLineEditor::setAlignLeft( bool yes ) +{ + if ( yes ) + editor->setAlignment( AlignLeft ); +} + +void MultiLineEditor::setAlignRight( bool yes ) +{ + if ( yes ) + editor->setAlignment( AlignRight ); +} + +void MultiLineEditor::setAlignCenter( bool yes ) +{ + if ( yes ) + editor->setAlignment( AlignCenter ); +} + +void MultiLineEditor::setAlignJustify( bool yes ) +{ + if ( yes ) + editor->setAlignment( AlignJustify ); +} + +void MultiLineEditor::insertNewField() +{ + TokenDialog dlg( m_token, this, "dlg" ); + if( dlg.exec() == QDialog::Accepted ) + editor->insert( dlg.token() ); +} + +void MultiLineEditor::checkSpelling() +{ +/* +#if KDE_IS_VERSION( 3, 1, 90 ) + QString s; + if ( editor->hasSelectedText() ) + s = editor->selectedText(); + else + s = editor->text(); + + spell = new KSpell( this, i18n("Spell Checking"), 0, 0, 0, true, true, KSpell::HTML ); + spell->setAutoDelete( true ); + spell->check( s, true ); + connect( spell, SIGNAL( done(const QString &) ), this, SLOT( spellCheckDone(const QString &) ) ); + + spell->cleanUp(); +#endif +*/ +} + +void MultiLineEditor::spellCheckDone(const QString & buffer) +{ + editor->setText( buffer ); + spell->cleanUp(); +} + +void MultiLineEditor::save() +{ + QString name = KFileDialog::getSaveFileName ( NULL, "*", this ); + if( name.isEmpty() ) + return; + + QFile file( name ); + if ( file.open( IO_WriteOnly ) ) { + QTextStream ts( &file ); + ts << editor->text(); + } +} + + +#include "multilineeditdlg.moc" diff --git a/kbarcode/multilineeditdlg.h b/kbarcode/multilineeditdlg.h new file mode 100644 index 0000000..8941950 --- /dev/null +++ b/kbarcode/multilineeditdlg.h @@ -0,0 +1,85 @@ +/*************************************************************************** + multilineeditdlg.h - description + ------------------- + begin : Sam Jan 11 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MULTILINEEDITDLG_H +#define MULTILINEEDITDLG_H + +#include +#include "documentitem.h" + +class KActionCollection; +class KToggleAction; +class KFontAction; +class KFontSizeAction; +class KToolBar; +class KSpell; +class KSpellConfig; +class DSTextEdit; +class TokenProvider; + +class MultiLineEditor : public QWidget { + Q_OBJECT + public: + MultiLineEditor( TokenProvider* token, QWidget *parent=0, const char *name=0); + ~MultiLineEditor(); + QString text(); + void setText( const QString & t ); + + private slots: + void setupActions(); + void updateActions(); + void spellCheckDone(const QString & buffer); + + void save(); + void updateFont(); + void updateCharFmt(); + void updateAligment(); + void formatColor(); + void checkSpelling(); + void setAlignLeft( bool yes ); + void setAlignRight( bool yes ); + void setAlignCenter( bool yes ); + void setAlignJustify( bool yes ); + void insertNewField(); + + protected: + TokenProvider* m_token; + + DSTextEdit* editor; + + KActionCollection* ac; + + KToggleAction *action_bold; + KToggleAction *action_italic; + KToggleAction *action_underline; + + KFontAction *action_font; + KFontSizeAction *action_font_size; + + KToggleAction *action_align_left; + KToggleAction *action_align_right; + KToggleAction *action_align_center; + KToggleAction *action_align_justify; + + KToolBar* toolBar; + KToolBar* tool2Bar; + KToolBar* tool3Bar; + + KSpell* spell; +}; + +#endif diff --git a/kbarcode/mybarcode.cpp b/kbarcode/mybarcode.cpp new file mode 100644 index 0000000..64160df --- /dev/null +++ b/kbarcode/mybarcode.cpp @@ -0,0 +1,620 @@ +f/*************************************************************************** + barcode.cpp - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "sqltables.h" +#include "barcodecache.h" + +#include "mybarcode.h" +#include + +// Qt includes +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include + +#define BARCODE_MARGIN 10 /* Margin added by GNU Barcode to the barcodes */ + +QValueList codes; + +void init() { + BarCode::setHaveBarcode(); +} + +bool barcodeData::operator==( const struct barcodeData d ) const { + bool b = ( value == d.value && type == d.type && + scale == d.scale && text == d.text ); + + if( BarCode::hasFeature( type, TBARCODEADV ) ) + b = ( b && tbarcode == d.tbarcode ); + + if( BarCode::hasFeature( type, DATAMATRIX ) ) + b = ( b && datamatrix == d.datamatrix ); + + if( BarCode::hasFeature( type, PDF417BARCODE ) ) + b = ( b && pdf417 == d.pdf417 ); + + return b; +}; + +BarCode::BarCode( const barcodeData* data ) +{ + barcode = *data; + m_index = 0; +} + +BarCode::BarCode() +{ + fillDefault( &barcode ); + m_index = 0; +} + +BarCode::~BarCode() +{ +} + +const QPixmap BarCode::pixmap() +{ + if( p.isNull() ) + createBarcode( &p, KApplication::desktop() ); + + if( p.isNull() ) { + KMessageBox::error( 0, "" + i18n("Barcode not valid!") + "
" + barcode.value + "
" ); + barcode.valid = false; + } + + return p; +} + +bool BarCode::createPixmap( QPixmap* target, int resx, int resy ) +{ + KTempFile* output = new KTempFile( QString::null, ".ps" );; + output->file()->close(); + + KTempFile* input = new KTempFile( QString::null, ".pbm" ); + input->file()->close(); + + m_value = createSequence( barcode.value ); + + if( BarCode::hasFeature( barcode.type, PDF417 ) ) { + if(!createPdf417( output )) { + cleanUp( output, input, target ); + return false; + } + } else if( BarCode::hasFeature( barcode.type, TBARCODE ) ) { + if(!createTBarcode( output )) { + cleanUp( output, input, target ); + return false; + } + } else { // if( BarCode::hasFeature( barcode.type, GNU_BARCODE ) ) { + QString flag = barcode.text ? "" : "-n"; + + KShellProcess proc; + proc << "barcode" << "-E" + << "-b" << KShellProcess::quote( m_value ) << flag + << "-e" << barcode.type << "-o" << output->name(); + + proc.start( KProcess::Block, KProcess::NoCommunication ); + proc.resume(); + + if( proc.exitStatus() ) { + cleanUp( output, input, target ); + return false; + } + } + + QFileInfo fi( output->name() ); + // if file size = 0, error in generation + if( !fi.size() ) { + cleanUp( output, input, target ); + return false; + } + + QSize s = getBoundingBox( output->name() ); + double sw = (double)s.width()/72 * resx; + double sh = (double)s.height()/72 * resy; + + KShellProcess proc2; + proc2 << "gs" << QString("-g%1x%2").arg(int(sw*(double)barcode.scale)).arg(int(sh*(double)barcode.scale)) + << "-r" + QString::number( resx*(double)barcode.scale ) + "x" + QString::number( resy*(double)barcode.scale ) + << "-sDEVICE=pbmraw" << "-sOutputFile=" + input->name() << "-sNOPAUSE" + << "-q " + output->name() << "-c showpage" << "-c quit"; + + proc2.start( KProcess::Block, KProcess::NoCommunication ); + proc2.resume(); + + if( proc2.exitStatus() ) { + cleanUp( output, input, target ); + return false; + } + + target->load( input->name(), "PBM" ); +// BarcodeCache::instance()->write( barcode, resx, resy, target, m_value ); + + input->unlink(); + output->unlink(); + + delete output; + delete input; + + return true; +} + +void BarCode::createBarcode( QPixmap* target, QPaintDevice* device ) +{ + QPaintDeviceMetrics pdm( device ); + int resx = pdm.logicalDpiX(); + int resy = pdm.logicalDpiY(); + + QString value = createSequence( barcode.value ); + QPixmap* cached = 0;//BarcodeCache::instance()->read( barcode, resx, resy, value ); + + // no matching barcode found in cache + if( !cached ) { + if( !createPixmap( target, resx, resy ) ) + return; + } else { + *target = *cached; + delete cached; + } + + if( BarCode::hasFeature( barcode.type, PDF417 ) ) { + // we have to scale to the correct resolution. + // we scale already here and not at the end, + // so that the addMargin function does not get a scaled margin. + QPaintDeviceMetrics pdm( KApplication::desktop() ); + int screenresx = pdm.logicalDpiX(); + int screenresy = pdm.logicalDpiY(); + + QWMatrix m; + double scalex = (resx/screenresx)*barcode.scale; + double scaley = (resy/screenresy)*barcode.scale; + m.scale( scalex, scaley ); + *target = target->xForm( m ); + } + *target = cut( target, barcode.cut ); + *target = addMargin( target, barcode.margin ); + + // Rotate + QWMatrix m; + m.rotate( (double)barcode.rotation ); + *target = target->xForm( m ); + + barcode.valid = true; +} + +bool BarCode::createPdf417( KTempFile* output ) +{ + KTempFile text( QString::null, ".txt" ); + QTextStream t( text.file() ); + t << m_value; + text.file()->close(); + + // ps does not work use pbm! + KShellProcess proc; + proc << "pdf417_enc" << "-tps" << text.name() << output->name() + << barcode.pdf417.row + << barcode.pdf417.col + << barcode.pdf417.err; + + proc.start( KProcess::Block, KProcess::NoCommunication ); + proc.resume(); + + if( proc.exitStatus() ) { + text.unlink(); + return false; + } + + text.unlink(); + return true; +} + +bool BarCode::createTBarcode( KTempFile* output ) +{ + // print text + QString flag = barcode.text ? "" : "n"; + // escape text + flag.append( barcode.tbarcode.escape ? " son" : " soff" ); + // autocorrection + flag.append( barcode.tbarcode.autocorrect ? " Aon" : " Aoff" ); + // text above + flag.append( barcode.tbarcode.above ? " a" : "" ); + + KShellProcess proc; + proc << "tbarcodeclient" << "-f" + output->name(); + if( !BarCode::hasFeature( barcode.type, BARCODE2D ) ) + proc << QString( "m%1" ).arg( barcode.tbarcode.modulewidth * 1000 ); + + if( BarCode::hasFeature( barcode.type, DATAMATRIX ) ) + proc << QString( "Ds%1" ).arg( barcode.datamatrix.size ); + + if( BarCode::hasFeature( barcode.type, PDF417BARCODE ) ) + proc << QString( "Pr%1 Pc%2 Pe%3" ).arg( barcode.pdf417.row ) + .arg( barcode.pdf417.col ) + .arg( barcode.pdf417.err ); + + proc << barcode.type << "tPS" << QString("c%1").arg( barcode.tbarcode.checksum ) << flag << "d" + KShellProcess::quote( m_value ); + proc.start( KProcess::Block, KProcess::NoCommunication ); + proc.resume(); + + if( proc.exitStatus() ) + return false; + + return true; +} + +const QPixmap BarCode::printerPixmap( QPaintDevice* device ) +{ + if( pp.isNull() ) + createBarcode( &pp, device ); + + return pp; +} + +void BarCode::fillDefault( barcodeData* data ) +{ + data->margin = 10; + data->text = true; + data->value = "1234567890"; + data->type = "code39"; + data->scale = 1.0; + data->cut = 1.0; + data->rotation = 0; + data->valid = false; + + data->pdf417.row = 24; + data->pdf417.col = 8; + data->pdf417.err = 5; + + data->datamatrix.size = 0; + + data->tbarcode.modulewidth = 0.353; + data->tbarcode.escape = false; + data->tbarcode.above = false; + data->tbarcode.autocorrect = false; + data->tbarcode.checksum = 0; + + data->xml.caption = "Static"; + data->xml.x = 0; + data->xml.y = 0; + + data->sequence.enabled = false; + data->sequence.mode = NUM; + data->sequence.step = 1; + data->sequence.start = 1; +} + +void BarCode::redrawBarcode() +{ + p.resize( 0, 0 ); + pp.resize( 0, 0 ); +} + +QPixmap BarCode::cut( QPixmap* pic, double cut) +{ + if( cut == 1.0 ) + return (*pic); + + QPixmap pcut( pic->width(), int((double)pic->height() * cut) ); + pcut.fill( Qt::white ); // barcode.bg + + QWMatrix m; + /* + * if text is above the barcode cut from + * below the barcode. + */ + + // TODO: put this into one if, I am to stupid today..... + if( BarCode::hasFeature( barcode.type, TBARCODEADV ) ) { + if( !barcode.tbarcode.above ) + m.rotate( 180 ); + } else + m.rotate( 180 ); + + QPainter painter( &pcut ); + painter.drawPixmap( 0, 0, pic->xForm( m ) ); + + return pcut.xForm( m ); +} + +QPixmap BarCode::addMargin( QPixmap* pic, int margin ) +{ + QPixmap p; + + /* We have to handle UPC special because of the checksum character + * which is printed on the right margin. + * The samve goes for ISBN codes. + * Any other formats?? + */ + + bool gnubarcode = BarCode::hasFeature( barcode.type, GNU_BARCODE ); + double barm = gnubarcode ? BARCODE_MARGIN * barcode.scale : 0; + + // Add margin + double sx = barm; + double sy = barm; + double sw = pic->width() - barm * 2; + double sh = pic->height() - barm * 2; + + if( gnubarcode && (barcode.type == "upc" || barcode.type == "isbn") ) { + sw = pic->width() - barm; + + p.resize( pic->width() + int(margin*2 - barm), pic->height() + int(margin * 2 - barm * 2) ); + } else + p.resize( pic->width() + int(margin*2 - barm * 2), pic->height() + int(margin * 2 - barm * 2) ); + + p.fill( Qt::white ); // barcode.bg + QPainter painter( &p ); + painter.drawPixmap( margin, margin, *pic, (int)sx, (int)sy, (int)sw, (int)sh ); + painter.end(); + + return p; +} + +const QString BarCode::getMaxLength( const QString & name ) +{ + QSqlQuery query("select uid, (length(barcode_no)) as LEN from " TABLE_BASIC + " where encoding_type = '" + name +"' ORDER by LEN DESC LIMIT 1" ); + + while( query.next() ) { + QSqlQuery queryuid("select barcode_no from barcode_basic where uid = '" + + query.value( 0 ).toString() + "'" ); + while( queryuid.next() ) + if(!queryuid.value( 0 ).toString().isEmpty()) + return queryuid.value( 0 ).toString(); + } + + QSqlQuery query1("select uid, (length(barcode_no)) as LEN from " TABLE_CUSTOMER_TEXT + " where encoding_type = '" + name +"' ORDER by LEN DESC LIMIT 1" ); + + while( query1.next() ) { + QSqlQuery queryuid("select barcode_no from customer_text where uid = '" + + query1.value( 0 ).toString() + "'" ); + while( queryuid.next() ) + if(!queryuid.value( 0 ).toString().isEmpty()) + return queryuid.value( 0 ).toString(); + } + + return "1234567"; +} + +void BarCode::cleanUp( KTempFile* file, KTempFile* file2, QPixmap* target ) +{ + target->resize( 0, 0 ); + + file->unlink(); + file2->unlink(); + delete file; + delete file2; +} + +QString BarCode::createSequence( const QString & value ) +{ + if( !barcode.sequence.enabled ) + return value; + + if( value.contains( '#' ) <= 0 ) + return value; + + QString text = value; + int pos = 0, counter = 1; + + pos = text.find("#", pos); + pos++; + while( text[pos] == '#' ) { + text.remove(pos, 1); + counter++; + } + + pos = text.find("#", 0); + QString temp; + + if( barcode.sequence.mode == NUM ) { + int v = barcode.sequence.start + m_index*barcode.sequence.step; + temp.sprintf("%0*i", counter, v ); + } else { + for( int i = 0; i < counter; i++ ) + temp.append( "A" ); + + unsigned int z = 0; + for( int p = temp.length(); p >= 0; p--, z++ ) { + if( barcode.sequence.mode == ALPHA ) { + int v = 'A' + m_index*barcode.sequence.step; + v -= z*('Z'-'A'); + + if( v <= 'Z' ) { + temp[p] = QChar(v); + break; + } else if( v > 'Z' ) + v = 'Z'; + temp[p] = QChar(v); + } else if( barcode.sequence.mode == ALPHANUM ) { + qDebug("NOT IMPLEMENTED"); +/* char array[36]; + for( unsigned int i = 'A'; i <= 'Z'; i++ ) + array[i-'A'] = i; + for( unsigned int i = '0'; i <= '9'; i++ ) + array['Z'-'A'+i-'0'] = i; + + int z = m_index*barcode.sequence.step; + if( z < sizeof(array) ) + temp[] + int v = array[ ]*/ + } + } + } + + text.replace( pos, 1, temp); + + return text; +} + +QString BarCode::sequenceValue() +{ + return createSequence( barcode.value ); +} + +bool BarCode::hasFeature( const QString & type, unsigned int feature ) +{ + for( unsigned int i = 0; i < codes.count(); i++ ) + if( codes[i].name == type ) + return (codes[i].features & feature) == feature; + + return false; +} + +QSize BarCode::getBoundingBox( const QString & filename ) +{ + QSize s(0,0); + QFile f( filename ); + if( !f.open( IO_ReadOnly ) ) + return s; + + QString t; + while( f.readLine( t, 1000 ) != -1 ) + { + if( t.startsWith( "%%BoundingBox:") ) + { + int x = 0; + int y = 0; + int w = 0; + int h = 0; + t = t.right( t.length() - 14 ); + sscanf( (const char*)t, "%d %d %d %d", &x, &y, &w, &h ); + s = QSize( w, h ); + break; + } + } + + f.close(); + return s; +} + +bool BarCode::m_haveGnuBarcode = false; +bool BarCode::m_havePdfEncode = false; +bool BarCode::m_haveTBarcode = false; + +barcodeFormat BarCode::fillStruct( const QString & name, const QString & text, const int feature ) +{ + barcodeFormat t; + t.name = name; + t.text = text; + t.features = feature; + return t; +} + +void BarCode::setHaveBarcode() +{ + m_haveGnuBarcode = !KStandardDirs::findExe( "barcode" ).isNull(); + m_havePdfEncode = !KStandardDirs::findExe( "pdf417_enc" ).isNull(); + m_haveTBarcode = !KStandardDirs::findExe( "tbarcodeclient" ).isNull(); + + if( codes.count() == 0 ) { + if( m_haveGnuBarcode ) { + codes.append( fillStruct( "ean", i18n("EAN (EAN 8 or EAN 13)"), GNU_BARCODE ) ); + codes.append( fillStruct( "upc", i18n("UPC (12-digit EAN; UPCA and UPCB)"), GNU_BARCODE ) ); + codes.append( fillStruct( "isbn", i18n("ISBN (still EAN13)"), GNU_BARCODE | NOCUT ) ); + codes.append( fillStruct( "code39", i18n("Code 39"), GNU_BARCODE ) ); + codes.append( fillStruct( "code39 -c", i18n("Code 39 (no checksum)"), GNU_BARCODE ) ); + codes.append( fillStruct( "code128", i18n("Code 128 (a,b,c: autoselection)"), GNU_BARCODE ) ); + codes.append( fillStruct( "code128c", i18n("Code 128C (compact form digits)"), GNU_BARCODE ) ); + codes.append( fillStruct( "code128b", i18n("Code 128B, full printable ascii"), GNU_BARCODE ) ); + codes.append( fillStruct( "i25", i18n("interleaved 2 of 5 (only digits)"), GNU_BARCODE ) ); + codes.append( fillStruct( "i25 -c", i18n("interleaved 2 of 5 (only digits, no checksum)"), GNU_BARCODE ) ); + codes.append( fillStruct( "128raw", i18n("Raw code 128"), GNU_BARCODE ) ); + codes.append( fillStruct( "cbr", i18n("Codabar"), GNU_BARCODE ) ); + codes.append( fillStruct( "cbr -c", i18n("Codabar (no checksum)"), GNU_BARCODE ) ); + codes.append( fillStruct( "msi", i18n("MSI"), GNU_BARCODE ) ); + codes.append( fillStruct( "pls", i18n("Plessey"), GNU_BARCODE ) ); + codes.append( fillStruct( "code93", i18n("Code 93"), GNU_BARCODE ) ); + } + + if( m_havePdfEncode ) { + codes.append( fillStruct( "pdf417", i18n("pdf 417 2D Barcode"), BARCODE2D | PDF417 | PDF417BARCODE ) ); + } + + if( m_haveTBarcode ) { + codes.append( fillStruct( "b1", "Code 11", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b2", "Code 2 of 5 (Standard)", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b3", "Interleaved 2 of 5 Standard", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b4", "Code 2 of 5 IATA", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b5", "Code 2 of 5 Matrix", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b6", "Code 2 of 5 Data Logic", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b7", "Code 2 of 5 Industrial", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b8", "Code 3 of 9 (Code 39)", TBARCODE | TBARCODEADV | MODULOALLCHECK ) ); + codes.append( fillStruct( "b9", "Code 3 of 9 (Code 39) ASCII", TBARCODE | TBARCODEADV | MODULOALLCHECK ) ); + codes.append( fillStruct( "b10", "EAN8", TBARCODE | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + codes.append( fillStruct( "b11", "EAN8 - 2 digits add on", TBARCODE | NOCUT | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + codes.append( fillStruct( "b12", "EAN8 - 5 digits add on", TBARCODE | NOCUT | TBARCODEADV | EAN8CHECK | MODULO10CHECK ) ); + codes.append( fillStruct( "b13", "EAN13", TBARCODE | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + codes.append( fillStruct( "b14", "EAN13 - 2 digits add on", TBARCODE | NOCUT | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + codes.append( fillStruct( "b15", "EAN13 - 5 digits add on", TBARCODE | NOCUT | TBARCODEADV | EAN13CHECK | MODULO10CHECK ) ); + codes.append( fillStruct( "b16", "EAN128 (supports AIS)", TBARCODE | TBARCODEADV | MODULOALLCHECK ) ); + codes.append( fillStruct( "b17", "UPC 12 Digits", TBARCODE | TBARCODEADV | MODULOALLCHECK ) ); + codes.append( fillStruct( "b18", "CodaBar (2 width)", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b19", "CodaBar (18 widths)", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b20", "Code128", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b21", "Deutsche Post Leitcode", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b22", "Deutsche Post Identcode", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b25", "Code 93", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b26", "Identical to eBC_UPCA", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b33", "UCC128 (= EAN128)", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b34", "UPC A", TBARCODE | TBARCODEADV | TBARCODEADV | UPCACHECK ) ); + codes.append( fillStruct( "b35", "UPC A - 2 digit add on", TBARCODE | TBARCODEADV | UPCACHECK ) ); + codes.append( fillStruct( "b36", "UPC A - 5 digit add on", TBARCODE | TBARCODEADV | UPCACHECK ) ); + codes.append( fillStruct( "b37", "UPC E", TBARCODE | TBARCODEADV | UPCECHECK ) ); + codes.append( fillStruct( "b38", "UPC E - 2 digit add on", TBARCODE | TBARCODEADV | UPCECHECK ) ); + codes.append( fillStruct( "b39", "UPC E - 5 digit add on", TBARCODE | TBARCODEADV | UPCECHECK ) ); + codes.append( fillStruct( "b40", "PostNet ZIP (5d.)", TBARCODE | NOCUT | TBARCODEADV | POSTNETCHECK ) ); + codes.append( fillStruct( "b41", "PostNet ZIP (5d.+CD)", TBARCODE | NOCUT | TBARCODEADV | POSTNETCHECK ) ); + codes.append( fillStruct( "b42", "PostNet ZIP (8d.)", TBARCODE | NOCUT | TBARCODEADV | POSTNETCHECK ) ); + codes.append( fillStruct( "b43", "PostNet ZIP+4 (5d.+4d.+CD)", TBARCODE | NOCUT | TBARCODEADV | POSTNETCHECK ) ); + codes.append( fillStruct( "b44", "PostNet DPBC (5d.+4d.+2d.)", TBARCODE | NOCUT | TBARCODEADV | POSTNETCHECK ) ); + codes.append( fillStruct( "b45", "PostNet DPBC (5d.+4d.+2d.+CD)", TBARCODE | NOCUT | TBARCODEADV | POSTNETCHECK ) ); + codes.append( fillStruct( "b46", "Plessey Code", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b47", "MSI Code", TBARCODE | TBARCODEADV | MODULO10CHECK ) ); + codes.append( fillStruct( "b50", "LOGMARS", TBARCODE | TBARCODEADV | MODULOALLCHECK ) ); + codes.append( fillStruct( "b55", "PDF417 - 2D bar code", TBARCODE | BARCODE2D | PDF417BARCODE ) ); + codes.append( fillStruct( "b56", "PDF417 Truncated - 2D bar code", TBARCODE | BARCODE2D | PDF417BARCODE ) ); + codes.append( fillStruct( "b57", "MaxiCode - 2D-bar code (Postscript only)", TBARCODE | BARCODE2D ) ); + codes.append( fillStruct( "b58", "QR-Code", TBARCODE | BARCODE2D ) ); + codes.append( fillStruct( "b59", "Code128 (CharSet A)", TBARCODE | TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + codes.append( fillStruct( "b60", "Code128 (CharSet B)", TBARCODE | TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + codes.append( fillStruct( "b61", "Code128 (CharSet C)", TBARCODE | TBARCODEADV | CODE128CHECK | MODULOALLCHECK ) ); + codes.append( fillStruct( "b62", "Code 93 Ascii", TBARCODE | TBARCODEADV | MODULOALLCHECK ) ); + codes.append( fillStruct( "b63", "Australian Post Standard Customer", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b64", "Australian Post Customer 2", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b65", "Australian Post Customer 3", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b66", "Australian Post Reply Paid", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b67", "Australian Post Routing", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b68", "Australian Post Redirection", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b69", "ISBN Code (=EAN13P5)", TBARCODE | TBARCODEADV ) ); + codes.append( fillStruct( "b70", "Royal Mail 4 State (RM4SCC)", TBARCODE | NOCUT | TBARCODEADV ) ); + codes.append( fillStruct( "b71", "Data Matrix", DATAMATRIX | TBARCODE | BARCODE2D | NOSCALE ) ); + } + } +} + diff --git a/kbarcode/mybarcode.h b/kbarcode/mybarcode.h new file mode 100644 index 0000000..5865b2d --- /dev/null +++ b/kbarcode/mybarcode.h @@ -0,0 +1,304 @@ +/*************************************************************************** + mybarcode.h - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MY_BARCODE_H +#define MY_BARCODE_H + +#include +#include + +#include +#include "barkode.h" +void init(); + +typedef union u_settings { + struct { + int row; + int col; + int err; + } pdf417; + + struct { + int size; + } datamatrix; + + struct { + double modulewidth; + bool escape; + } tbarcode; +}; + +class QColor; +class QString; +typedef struct barcodeData { + QString value; + QString type; + int margin; + int rotation; + double scale; + double cut; + bool text; + bool valid; + + struct _pdf417 { + int row; + int col; + int err; + + bool operator==( const struct _pdf417 p ) const { + return row == p.row && col == p.col && err == p.err; + }; + + } pdf417; + + struct _datamatrix { + int size; + + bool operator==( const struct _datamatrix d ) const { + return size == d.size; + }; + + } datamatrix; + + struct _tbarcode { + double modulewidth; + bool escape; + bool above; + bool autocorrect; + int checksum; + + bool operator==( const struct _tbarcode t ) const { + return modulewidth == t.modulewidth && escape == t.escape && above == t.above && checksum == t.checksum && autocorrect == t.autocorrect; + }; + + } tbarcode; + + struct { + // only important + // when this struct + // is read from XML + QString caption; + int x; + int y; + } xml; + + /** + * Compare to barcodeData structs, + * but only the fields which are used + * as commandline parameters for + * the genaration backends. + * E.g. margin is not compared, because + * the margin is created by KBarcode internally. + */ + bool operator==( const struct barcodeData d ) const; + + struct { + bool enabled; + int mode; + int step; + int start; + } sequence; +}; + +#if 0 +enum { NOCUT = 0x00001, MULTILINE = 0x00002, NOTEXT = 0x00004, NOSCALE = 0x00008, + /** + * The different Generator Backends + */ + GNU_BARCODE = 0x00010, PDF417 = 0x00020, TBARCODE = 0x00040, + /** + * Different advanced option modes. + */ + DATAMATRIX = 0x00080, PDF417BARCODE = 0x00100, TBARCODEADV = 0x00200, + /** + * Checksum ID's + */ + POSTNETCHECK = 0x01000, CODE128CHECK = 0x02000, EAN8CHECK = 0x04000, EAN13CHECK = 0x08000, + UPCACHECK = 0x10000, UPCECHECK = 0x20000, MODULOALLCHECK = 0x40000, MODULO10CHECK = 0x80000, + /** + * Short cut's + */ + BARCODE2D = NOCUT | MULTILINE | NOTEXT }; +#endif + +typedef struct barcodeFormat { + QString name; + QString text; + unsigned int features; +}; + +class KProcess; +class KTempFile; +class QPaintDevice; +/** + * This class creates a QPixmap from a barcodeData struct. + * Several backends are supported to generate the pixmap. + * GNU Barcode + * pdf417_enc + * TBarcode (http://www.tec-it.com) + * + * This tools generate a postscript file. The ps file is + * transformed to a PBM file scaled to the requested resolution + * or screen resolution using ghostscript. + * + * The generated barcodes are cached using BarcodeCache. + * To fill a barcodeData struct with data from the user, you + * might want to use BarcodeWidget. + * + * A small example, of how to generate a valid Barcode in your application + * without the use of BarcodeWidget: + *
+  *  barcodeData data;
+  *  BarCode::fillDefault( &data ); // setup a barcode object with valid data
+  *  data.value = "KBARCODE";
+  *  data.type = "code39";
+  *  BarCode b( &data ); // create a barcode object
+  *  QPixmap p = b.pixmap(); // get a pixmap of the barcode
+  * 
+ * + * @see BarcodeCache @see BarcodeWidget + * @author Dominik Seichter + */ +class BarCode { + public: + /** Create a BarCode object from the data const barcodeData* @p data. + * You may delete @p data afterwards. Be sure to call at least once + * BarCode::fillDefault() on @p data. Otherwise you rsik invalid barcode data. + */ + BarCode( const barcodeData* data ); + /** Create a BarCode object filled with default data. + */ + BarCode(); + ~BarCode(); + + /** Get a QPixmap of the current barcodeData in + * screen resolution- + */ + const QPixmap pixmap(); + /** Get a QPixmap of the barcode in the same resolution as the + * QPaintDevice* @p device. This is necessary if you want to print + * your barcodes, as they won't be scanable in screen resolution. + */ + const QPixmap printerPixmap( QPaintDevice* device ); + + /** Set the index of the barcodes for barcode sequences. + */ + void setIndex( int i ) { m_index = i; } + /** Change the barcodeData to @p d, call redraw() afterwards. + */ + void setData( barcodeData* d ) { barcode = *d; } + bool validBarcode() {return !p.isNull();} + + barcodeData data() const { return barcode; } + + QString sequenceValue(); + + /** Fill @p barcodeData* data with its default parameters. + * Always call this function, after you have created a new + * barcodeData struct. + */ + static void fillDefault( barcodeData* data ); + + /** Test if the encodingType @p type has a certain + * @p feature, as defined in the codes QValueList. + */ + static bool hasFeature( const QString & type, unsigned int feature ); + + /** get the meximum length of value for the encoding type @p name + * from the SQL databases. + */ + static const QString getMaxLength( const QString & name ); + + /** This function has to be called befor barcode support is avaible. + * It searches for the barcode generation backends + * (gnu barcode, tbarcode and pdf417) and fills the QValueList codes + * with data and information about the avaible barcode encoding types. + * You only have to call this function once. + * The results can be retrieved with the following functions: + * @see haveBarcode() + * @see haveTBarcode() + * @see havePDFBarcode() + */ + static void setHaveBarcode(); + static bool haveBarcode() { + return ( m_haveGnuBarcode || m_havePdfEncode || m_haveTBarcode ); + } + static bool haveGNUBarcode() { + return m_haveGnuBarcode; + } + static bool haveTBarcode() { + return m_haveTBarcode; + } + static bool havePDFBarcode() { + return m_havePdfEncode; + } + + /** call this, always after you changed the barcodeData using setData, + * so that the pixmaps are recreated. + */ + void redrawBarcode(); + private: + bool createPixmap( QPixmap* target, int resx, int resy ); + void createBarcode( QPixmap* target, QPaintDevice* device ); + bool createPdf417( KTempFile* output ); + bool createTBarcode( KTempFile* output ); + QString createSequence( const QString & value ); + /** reads the bounding box information from a postscript file + */ + QSize getBoundingBox( const QString & filename ); + + void cleanUp( KTempFile* file, KTempFile* file2, QPixmap* target ); + static barcodeFormat fillStruct( const QString & name, const QString & text, const int feature ); + + /** + * Cut the barcode either on the top or + * on the bottom, depending on the text position. + * + * @param pic the QPixmap that will be cutted + * @param cut a value between 0.0 and 1.0. If cut = 1.0 + * then no cut will happen, if cut = 0.5, half of + * the barcode is going to be cutted away. + */ + QPixmap cut( QPixmap* pic, double cut ); + + /** + * Add a margin to the QPixmap pic. + * @param pic the QPixmap pic which should get a margin + * @param margin the margin size in pixels. + */ + QPixmap addMargin( QPixmap* pic, int margin ); + + + /** + * The barcode is generated from this value. + * This is necessary so that sequences will work. + */ + QString m_value; + + /** index for barcode sequences; + */ + int m_index; + + QPixmap p; + QPixmap pp; + barcodeData barcode; + static bool m_haveGnuBarcode; + static bool m_havePdfEncode; + static bool m_haveTBarcode; +}; + +#endif diff --git a/kbarcode/mycanvasitem.cpp b/kbarcode/mycanvasitem.cpp new file mode 100644 index 0000000..43cc56d --- /dev/null +++ b/kbarcode/mycanvasitem.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + mycanvasitem.cpp - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "mycanvasitem.h" +#include "labelutils.h" +#include "labeleditor.h" + +// KDE includes +#include + +// QT includes +#include +#include + +SpotProvider::SpotProvider() +{ + m_spot = new QPixmap( SPOTSIZE, SPOTSIZE ); + m_spot->fill( Qt::green ); + + QPainter p( m_spot ); + p.drawRect( 0, 0, SPOTSIZE, SPOTSIZE ); + p.end(); +} + +SpotProvider::~SpotProvider() +{ + delete m_spot; +} + +SpotProvider* SpotProvider::instance = 0; +QPixmap* SpotProvider::m_spot = 0; + +SpotProvider* SpotProvider::getInstance() +{ + if( !instance ) + instance = new SpotProvider(); + + return instance; +} + diff --git a/kbarcode/mycanvasitem.h b/kbarcode/mycanvasitem.h new file mode 100644 index 0000000..a01d9c2 --- /dev/null +++ b/kbarcode/mycanvasitem.h @@ -0,0 +1,52 @@ +/*************************************************************************** + mycanvasitem.h - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MYCANVASITEM_H +#define MYCANVASITEM_H + +#include +#include +#include +#include +#include "tokenprovider.h" + +#define SPOTSIZE 7 + +class QPixmap; +/** A very small singleton, which creates a pixmap + * for the accesor points in the label editor. + * + * @author Dominik Seichter + */ +class SpotProvider { + public: + static SpotProvider* getInstance(); + + const QPixmap* spot() const { + return m_spot; + } + + private: + SpotProvider(); + ~SpotProvider(); + + static SpotProvider* instance; + static QPixmap* m_spot; +}; + + +#endif diff --git a/kbarcode/mycanvasview.cpp b/kbarcode/mycanvasview.cpp new file mode 100644 index 0000000..b9bd295 --- /dev/null +++ b/kbarcode/mycanvasview.cpp @@ -0,0 +1,611 @@ +/*************************************************************************** + mycanvasview.cpp - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "mycanvasview.h" +#include "commands.h" +#include "definition.h" +#include "measurements.h" +#include "kbarcodesettings.h" + +// Qt includes +#include +#include +#include + +// KDE includes +#include +#include + +MyCanvas::MyCanvas( QObject* parent, const char* name ) + : QCanvas( parent, name ) +{ + m_grid = false; + + setBackgroundColor( Qt::lightGray ); + + resize( 0, 0 ); +} + +MyCanvas::~MyCanvas() +{ +} + +void MyCanvas::drawBackground( QPainter & painter, const QRect & clip ) +{ + QCanvas::drawBackground( painter, clip ); + + QRect shadow1( int(m_rect.x() + m_rect.width()), m_rect.y() + 5, 5, m_rect.height() ); + QRect shadow2( m_rect.x()+ 5, int(m_rect.y() + m_rect.height()), m_rect.width(), 5 ); + + // draw background shadow + if( clip.intersects( shadow1 ) ) + painter.fillRect( shadow1, Qt::black ); + + if( clip.intersects( shadow2 ) ) + painter.fillRect( shadow2, Qt::black ); + + if( clip.intersects( m_rect ) ) { + painter.fillRect( m_rect, Qt::white ); + + if( m_grid ) { + painter.translate( m_rect.x(), m_rect.y() ); + + painter.setPen( QPen( KBarcodeSettings::getInstance()->gridColor(), 0 ) ); + for( int y = 0; y <= m_rect.height(); y += KBarcodeSettings::getInstance()->gridSize() ) + for( int x = 0; x <= m_rect.width(); x += KBarcodeSettings::getInstance()->gridSize() ) + painter.drawPoint( x, y ); + + painter.translate( -m_rect.x(), -m_rect.y() ); + } + } +} + +MyCanvasView::MyCanvasView( Definition* d, MyCanvas* c, QWidget* parent, const char* name, WFlags f) + : QCanvasView(c,parent,name,f) +{ + statusbar = 0; + m_commov = 0; + canv = c; + + rulerv = new KRuler( Qt::Vertical, this ); + rulerh = new KRuler( Qt::Horizontal, this ); + if( Measurements::measurementSystem() == Measurements::Metric ) { + rulerv->setRulerMetricStyle( KRuler::Millimetres ); + rulerh->setRulerMetricStyle( KRuler::Millimetres ); + } else { + rulerv->setRulerMetricStyle( KRuler::Inch ); + rulerh->setRulerMetricStyle( KRuler::Inch ); + } + rulerv->setMaxValue( 0 ); + rulerh->setMaxValue( 0 ); + + viewport()->setMouseTracking( true ); + setDefinition( d ); +} + +MyCanvasView::~MyCanvasView() +{ +} + +void MyCanvasView::snapPoint(QPoint * point, TCanvasItem* item ) +{ + // move item to next grid position + // TODO: align the top left to the grid not the current mouse position! + + /* + */ + + if( item ) + { + int difx = point->x() - (int)item->x(); + int dify = point->y() - (int)item->y(); + + int x = (int)item->x(); + int y = (int)item->y(); + + int grid = KBarcodeSettings::getInstance()->gridSize(); + int modx = x % grid; + int mody = y % grid; + + x -= modx; + y -= mody; + + if(modx >= grid / 2) + x += grid; + + if(mody >= grid / 2) + y += grid; + + point->setX( x + difx ); + point->setY( y + dify ); + } + else + { + point->setX(point->x() - point->x() % KBarcodeSettings::getInstance()->gridSize()); + point->setY(point->y() - point->y() % KBarcodeSettings::getInstance()->gridSize()); + } +} + +void MyCanvasView::contentsMouseMoveEvent(QMouseEvent* e) +{ + rulerh->slotNewValue( e->x() ); + rulerv->slotNewValue( e->y() ); + + if( statusbar ) { + LabelUtils l; + int x = (int)l.pixelToMm( e->x(), this, LabelUtils::DpiX ); + int y = (int)l.pixelToMm( e->y(), this, LabelUtils::DpiY ); + statusbar->changeItem( i18n("Position: ") + + QString( "%1%2 x %3%4" ).arg( x ) + .arg( Measurements::system() ).arg( y ).arg( Measurements::system()), mouseid ); + } + + updateCursor( e->pos() ); + + // if no mouse button is pressed bail out now + if( !(e->state() & Qt::LeftButton ) ) { + (void)updateCursor( e->pos(), true ); + return; + } + + bool shift_pressed = e->state() & Qt::ShiftButton; + + TCanvasItem* moving = getActive(); + if( moving && !moving->item()->locked() ) { + QPoint p = inverseWorldMatrix().map(e->pos()); + + if( m_mode == Barcode || m_mode == Inside ) { + TCanvasItemList list = getSelected(); + for( unsigned int i = 0; i < list.count(); i++ ) { + TCanvasItem* moving = list[i]; + QPoint new_pt = QPoint(p.x() - delta_pt.x(),p.y() - delta_pt.y()); + if( canv->grid() ) { + snapPoint(&new_pt, moving) ; + } + + LabelUtils l; + QPoint pmm; + pmm.setX( (int)l.pixelToMm( new_pt.x() - getTranslation().x(), this, LabelUtils::DpiX ) * 1000 ); + pmm.setY( (int)l.pixelToMm( new_pt.y() - getTranslation().y(), this, LabelUtils::DpiY ) * 1000 ); + + // Move the item + MoveCommand* mv = new MoveCommand( pmm.x() - moving->item()->rectMM().x(), + pmm.y() - moving->item()->rectMM().y(), moving ); + mv->execute(); + getMoveCommand()->addCommand( mv ); + } + } else { + + if( canv->grid() ) { + snapPoint(&p, NULL ) ; + } + + LabelUtils l; + + QPoint pmm; + pmm.setX( (int)l.pixelToMm( p.x() - getTranslation().x(), this, LabelUtils::DpiX ) * 1000 ); + pmm.setY( (int)l.pixelToMm( p.y() - getTranslation().y(), this, LabelUtils::DpiY ) * 1000 ); + + QRect rmm = moving->item()->rectMM(); + ResizeCommand* mv = new ResizeCommand( moving, shift_pressed ); + + switch( m_mode ) { + case RightMiddle: + mv->setRect( rmm.x(), rmm.y(), pmm.x() - rmm.x(), rmm.height() ); + break; + case LeftMiddle: + mv->setRect( pmm.x(), rmm.y(), rmm.width()+ (rmm.x() - pmm.x()), rmm.height() ); + break; + case BottomMiddle: + mv->setRect( rmm.x(), rmm.y(), rmm.width(), pmm.y() - rmm.y()); + break; + case TopMiddle: + mv->setRect( rmm.x(), pmm.y(), rmm.width(), rmm.height()+ (rmm.y() - pmm.y())); + break; + case BottomLeft: + mv->setRect( pmm.x(), rmm.y(), rmm.width()+ (rmm.x() - pmm.x()), pmm.y() - rmm.y() ); + break; + case BottomRight: + mv->setRect( rmm.x(), rmm.y(), pmm.x() - rmm.x(), pmm.y() - rmm.y() ); + break; + case TopLeft: + mv->setRect( pmm.x(), pmm.y(), rmm.width()+ (rmm.x() - pmm.x()), rmm.height()+ (rmm.y() - pmm.y())); + break; + case TopRight: + mv->setRect( rmm.x(), pmm.y(), pmm.x() - rmm.x(),rmm.height()+ (rmm.y() - pmm.y()) ); + break; + default: + break; + } + mv->execute(); + getMoveCommand()->addCommand( mv ); + } + + moving_start = p; + + emit movedSomething(); + } +} + +void MyCanvasView::contentsMousePressEvent(QMouseEvent* e) +{ + setActive( 0, e->state() & Qt::ControlButton ); + + QCanvasItemList list = canvas()->allItems(); + for( int z = MyCanvasView::getLowestZ( list ); z <= MyCanvasView::getHighestZ( list ); z++ ) + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->z() == z && isInside( e->pos(), list[i] ) ) + setActive( list[i], (e->state() & Qt::ControlButton) ); + + if( getActive() ) { + moving_start = inverseWorldMatrix().map(e->pos()); + m_mode = updateCursor( e->pos() ); + old = getActive()->boundingRect(); + delta_pt=QPoint(e->x() - old.x(),e->y() - old.y()); + } + + if( e->button() == Qt::RightButton && getActive() ) + emit showContextMenu( e->globalPos() ); +} + +void MyCanvasView::contentsMouseReleaseEvent(QMouseEvent* e) +{ + if( e->button() != Qt::LeftButton || getSelected().isEmpty() ) + return; + + if( m_commov ) { + history->addCommand( getMoveCommand(), false ); + m_commov = 0; + } + + updateCursor( e->pos() ); +} + +KMacroCommand* MyCanvasView::getMoveCommand() +{ + if( !m_commov ) + m_commov = new KMacroCommand( i18n("Item Moved") ); + + return m_commov; +} + +void MyCanvasView::contentsMouseDoubleClickEvent(QMouseEvent* e) +{ + setActive( 0 ); + QCanvasItemList list = canvas()->allItems(); + for( int z = MyCanvasView::getHighestZ( list ); z >= MyCanvasView::getLowestZ( list ); z-- ) + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->z() == z && isInside( e->pos(), list[i] ) ) { + setActive( list[i] ); + emit doubleClickedItem( getActive() ); + return; + } +} + +bool MyCanvasView::isInside( QPoint p, QCanvasItem* item ) +{ + if( !item->isVisible() ) + return false; + + return item->boundingRect().contains( p ); +} + +int MyCanvasView::isEdge( QPoint p, QCanvasItem* item ) +{ + if( !isInside( p, item ) ) + return Outside; + + QRect r = item->boundingRect(); + + int rh = r.y() + r.height(); + int rw = r.x() + r.width(); + if( p.x() > r.x() && p.x() < r.x() + SPOTSIZE ) { + // Left + if( p.y() > r.y() && p.y() < r.y() + SPOTSIZE ) + return TopLeft; + + if( p.y() > rh - SPOTSIZE && p.y() < rh ) + return BottomLeft; + + if( (r.height() - 2 * SPOTSIZE ) / 2 > SPOTSIZE ) { + // Middle + int start = ( r.y() + (r.height() - SPOTSIZE)/2 ); + if( p.y() > start && p.y() < start + SPOTSIZE ) + return LeftMiddle; + } + + } + + if( p.y() > r.y() && p.y() < r.y() + SPOTSIZE ) { + // Top + if( (r.width() - 2 * SPOTSIZE ) / 2 > SPOTSIZE ) { + // Middle + int start = ( r.x() + (r.width() - SPOTSIZE)/2 ); + if( p.x() > start && p.x() < start + SPOTSIZE ) + return TopMiddle; + } + } + + if( p.y() > rh - SPOTSIZE && p.y() < rh ) { + // Bottom + if( (r.width() - 2 * SPOTSIZE ) / 2 > SPOTSIZE ) { + // Middle + int start = ( r.x() + (r.width() - SPOTSIZE)/2 ); + if( p.x() > start && p.x() < start + SPOTSIZE ) + return BottomMiddle; + } + } + + if( p.x() > rw - SPOTSIZE && p.x() < rw ) { + // Right + if( p.y() > r.y() && p.y() < r.y() + SPOTSIZE ) + return TopRight; + + if( p.y() > rh - SPOTSIZE && p.y() < rh ) + return BottomRight; + + if( (r.height() - 2 * SPOTSIZE ) / 2 > SPOTSIZE ) { + // Middle + int start = ( r.y() + (r.height() - SPOTSIZE)/2 ); + if( p.y() > start && p.y() < start + SPOTSIZE ) + return RightMiddle; + } + } + + return Inside; +} + +void MyCanvasView::deleteCurrent() +{ + TCanvasItemList list = getSelected(); + if( !list.isEmpty() ) { + KMacroCommand* mc = new KMacroCommand( i18n("Delete") ); + + for( unsigned int i = 0; i < list.count(); i++ ) { + DeleteCommand* dc = new DeleteCommand( list[i] ); + dc->execute(); + mc->addCommand( dc ); + } + + history->addCommand( mc, false ); + setActive( 0 ); + canvas()->update(); + } +} + +void MyCanvasView::setCurrent( QCanvasItem* item ) +{ + setSelected( item ); + setActive( item ); +} + +void MyCanvasView::updateRuler() +{ + rulerh->setGeometry( 20, 0, width() - 20, 20 ); + rulerv->setGeometry( 0, 20, 20, height() - 20 ); + + if( def ) { + canv->setRect( QRect( translation.x(), translation.y(), (int)def->getMeasurements().width( this ), (int)def->getMeasurements().height( this )) ); + + rulerv->setMaxValue( height() ); + rulerh->setMaxValue( width() ); + + + QPaintDeviceMetrics pdm( this ); + if( Measurements::measurementSystem() == Measurements::Metric ) { + rulerh->setPixelPerMark( (1/ 25.4)* pdm.logicalDpiX() ); + rulerv->setPixelPerMark( (1/25.4)* pdm.logicalDpiY() ); + } + } + +} + +void MyCanvasView::resizeEvent( QResizeEvent * r ) +{ + setUpdatesEnabled( false ); + QPoint old = translation; + + QCanvasView::resizeEvent( r ); + + reposition(); + updateRuler(); + + repaintContents(); + + old = translation - old; + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + list[i]->moveBy( old.x(), old.y() ); + + setUpdatesEnabled( true ); +} + +void MyCanvasView::reposition() +{ + /* + * it is difficult to handle the repositioning + * when a new scaling factor has been set. + * Therefore we divide by the old factor + * and multiply with the new one. + * As a result we have the correct width. + */ + int x = int((width() - (def->getMeasurements().width( this )) ) / 2); + int y = int((height() - (def->getMeasurements().height( this )) ) / 2); + + // move label 30 pixels away from top/left if necessary + x = x > 0 ? x : 30; + y = y > 0 ? y : 30; + + // make sure that there is some space around the label, therefore at 60 pixel + int w = ( this->width() - 2 > def->getMeasurements().width( this ) ? this->width() - 2 : int(def->getMeasurements().width( this ) + 60) ); + int h = ( this->height() - 2 > def->getMeasurements().height( this ) ? this->height() - 2 : int(def->getMeasurements().height( this ) + 60) ); + + canvas()->resize( w, h ); + + + translation = QPoint( x, y ); +} + +void MyCanvasView::setDefinition( Definition* d ) +{ + def = d; + reposition(); + updateRuler(); + repaintContents( true ); +} + +void MyCanvasView::selectAll() +{ + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + setSelected( list[i], true ); +} + +void MyCanvasView::deSelectAll() +{ + setSelected( 0 ); +} + +int MyCanvasView::getLowestZ( QCanvasItemList list ) +{ + int v = 0; + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->z() < v ) + v = (int)list[i]->z(); + + return v; +} + +int MyCanvasView::getHighestZ( QCanvasItemList list ) +{ + int v = 0; + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->z() > v ) + v = (int)list[i]->z(); + + return v; +} + +TCanvasItem* MyCanvasView::getActive() +{ + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->isActive() ) + return (TCanvasItem*)list[i]; + + return 0; +} + +void MyCanvasView::setActive( QCanvasItem* item, bool control ) +{ + emit selectionChanged(); + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + list[i]->setActive( false ); + + if( item ) + item->setActive( true ); + + setSelected( item, control ); +} + +DocumentItemList MyCanvasView::getAllItems() +{ + DocumentItemList l; + + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + l.append( ((TCanvasItem*)list[i])->item() ); + + return l; +} + +TCanvasItemList MyCanvasView::getSelected() +{ + TCanvasItemList l; + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + if( list[i]->isSelected() ) + l.append( (TCanvasItem*)list[i] ); + + return l; +} + +void MyCanvasView::setSelected( QCanvasItem* item, bool control ) +{ + if( !control ) { + QCanvasItemList list = canvas()->allItems(); + for( unsigned int i = 0; i < list.count(); i++ ) + list[i]->setSelected( false ); + } + + if( item ) + item->setSelected( true ); +} + +int MyCanvasView::updateCursor( QPoint pos, bool pressed ) +{ + if( !getActive() ) { + this->setCursor( QCursor::ArrowCursor ); + return -1; + } + + int mode = isEdge( pos, getActive() ); + + if( getActive()->item()->locked() ) + { + pressed && mode != Outside ? setCursor( Qt::ForbiddenCursor ) : setCursor( QCursor::ArrowCursor ); + return mode; + } + + if( getActive()->rtti() == eRtti_Barcode ) { + pressed && mode != Outside ? setCursor( QCursor::SizeAllCursor ) : setCursor( QCursor::ArrowCursor ); + mode = Barcode; + return mode; + } + + switch( mode ) { + case TopLeft: + case BottomRight: + this->setCursor( QCursor::SizeFDiagCursor ); + break; + case TopMiddle: + case BottomMiddle: + this->setCursor( QCursor::SizeVerCursor ); + break; + case TopRight: + case BottomLeft: + this->setCursor( QCursor::SizeBDiagCursor ); + break; + case RightMiddle: + case LeftMiddle: + this->setCursor( QCursor::SizeHorCursor ); + break; + case Inside: + pressed ? setCursor( QCursor::SizeAllCursor ) : setCursor( QCursor::ArrowCursor ); + break; + case Outside: + default: + this->setCursor( QCursor::ArrowCursor ); + break; + }; + + return mode; +} + + +#include "mycanvasview.moc" diff --git a/kbarcode/mycanvasview.h b/kbarcode/mycanvasview.h new file mode 100644 index 0000000..0922717 --- /dev/null +++ b/kbarcode/mycanvasview.h @@ -0,0 +1,175 @@ +/*************************************************************************** + mycanvasview.h - description + ------------------- + begin : Die Apr 23 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MYCANVASVIEW_H +#define MYCANVASVIEW_H + +#include +#include +#include "documentitem.h" + +class TCanvasItem; + +typedef QValueList TCanvasItemList; + + +class QRect; +class QPainter; +class MyCanvas : public QCanvas { + Q_OBJECT + + public: + MyCanvas( QObject* parent, const char* name = 0 ); + ~MyCanvas(); + + void setRect( QRect r ) { + m_rect = r; + } + + QRect rect() const { + return m_rect; + } + + void setGrid( bool enabled ) { + m_grid = enabled; + } + + bool grid() const { return m_grid; } + + protected: + void drawBackground( QPainter & painter, const QRect & clip ); + + private: + QRect m_rect; + bool m_grid; +}; + +class Definition; +class QColor; +class QLabel; +class QPoint; +class KCommandHistory; +class KMacroCommand; +class KRuler; +class KStatusBar; +class MyCanvasView : public QCanvasView +{ + Q_OBJECT + + enum edges { + TopLeft, + TopMiddle, + TopRight, + RightMiddle, + LeftMiddle, + BottomLeft, + BottomMiddle, + BottomRight, + Inside, + Outside, + Barcode + }; + + public: + MyCanvasView( Definition* d, MyCanvas *c, QWidget* parent=0, const char* name=0, WFlags f=0); + ~MyCanvasView(); + + /** return a list of all DocumentItems on the canvas + */ + DocumentItemList getAllItems(); + + TCanvasItemList getSelected(); + + TCanvasItem* getActive(); + void setActive( QCanvasItem* item = 0, bool control = false ); + + void setCurrent( QCanvasItem* item ); + + void setHistory( KCommandHistory* hist ) { + history = hist; + } + + QPoint getTranslation() const { + return translation; + } + + void setDefinition( Definition* d ); + void setPosLabel( KStatusBar* s, int id ) { + mouseid = id; + statusbar = s; + } + + static int getLowestZ( QCanvasItemList list ); + static int getHighestZ( QCanvasItemList list ); + + void snapPoint(QPoint* point, TCanvasItem* item) ; + + public slots: + void selectAll(); + void deSelectAll(); + + void deleteCurrent(); + + void updateGUI() { + canvas()->update(); + repaintContents(); + } + + protected: + void contentsMousePressEvent(QMouseEvent*); + void contentsMouseMoveEvent(QMouseEvent*); + void contentsMouseReleaseEvent(QMouseEvent *); + void contentsMouseDoubleClickEvent(QMouseEvent*); + void resizeEvent( QResizeEvent * r ); + + signals: + void selectionChanged(); + void movedSomething(); + void doubleClickedItem( TCanvasItem* ); + void showContextMenu( QPoint ); + + private: + void setSelected( QCanvasItem* item = 0, bool control = false ); + KMacroCommand* getMoveCommand(); + + Definition* def; + + KRuler* rulerv; + KRuler* rulerh; + + KCommandHistory* history; + KMacroCommand* m_commov; + MyCanvas* canv; + + int mouseid; + KStatusBar* statusbar; + + QPoint moving_start; + QPoint translation; + + QRect old; + + bool isInside( QPoint p, QCanvasItem* item ); + int isEdge( QPoint p, QCanvasItem* item ); + void reposition(); + void updateRuler(); + int updateCursor( QPoint pos, bool pressed = false ); + int m_mode; + QPoint delta_pt ; +}; + +#endif diff --git a/kbarcode/mydatatable.cpp b/kbarcode/mydatatable.cpp new file mode 100644 index 0000000..9ec9dd1 --- /dev/null +++ b/kbarcode/mydatatable.cpp @@ -0,0 +1,44 @@ +/*************************************************************************** + mydatatable.cpp - description + ------------------- + begin : Son Jun 16 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "mydatatable.h" + +MyDataTable::MyDataTable(QWidget *parent, const char *name ) + : QDataTable(parent,name) +{ } + +MyDataTable::~MyDataTable() +{ +} + +bool MyDataTable::update() +{ + return updateCurrent(); +} + + +bool MyDataTable::deleteItem() +{ + return deleteCurrent(); +} + +bool MyDataTable::newItem() +{ + return insertCurrent(); +} + +#include "mydatatable.moc" diff --git a/kbarcode/mydatatable.h b/kbarcode/mydatatable.h new file mode 100644 index 0000000..fa55fb4 --- /dev/null +++ b/kbarcode/mydatatable.h @@ -0,0 +1,37 @@ +/*************************************************************************** + mydatatable.h - description + ------------------- + begin : Son Jun 16 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef MYDATATABLE_H +#define MYDATATABLE_H + +#include +#include + +/** A table to modify SQL tables. + */ +class MyDataTable : public QDataTable { + Q_OBJECT + public: + MyDataTable(QWidget *parent=0, const char *name=0); + ~MyDataTable(); + + bool update(); + bool deleteItem(); + bool newItem(); +}; + +#endif diff --git a/kbarcode/newlabel.cpp b/kbarcode/newlabel.cpp new file mode 100644 index 0000000..4ca7f04 --- /dev/null +++ b/kbarcode/newlabel.cpp @@ -0,0 +1,248 @@ +/*************************************************************************** + newlabel.cpp - description + ------------------- + begin : Son Mai 5 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "newlabel.h" +#include "definitiondialog.h" +#include "sqltables.h" + +// Qt includes +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include + +#ifndef I2S + #define I2S(x) QString("%1").arg(x) +#endif // I2S + +NewLabel::NewLabel( QWidget* parent, const char* name, bool change, WFlags fl ) + : QDialog( parent, name, true, fl ) +{ + setCaption( i18n( "New Label" ) ); + curid = 0; + types = 0; + + NewLabelLayout = new QVBoxLayout( this, 11, 6, "NewLabelLayout"); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + if( !change ) + TextLabel1->setText( i18n( "

Create a new Label



" ) ); + else + TextLabel1->setText( i18n( "

Change Label Size



" ) ); + + NewLabelLayout->addWidget( TextLabel1 ); + + QGroupBox* group1 = new QGroupBox( this ); + group1->setTitle( i18n( "Label" ) ); + group1->setColumnLayout(0, Qt::Vertical ); + group1->layout()->setSpacing( 6 ); + group1->layout()->setMargin( 11 ); + QGridLayout* group1Layout = new QGridLayout( group1->layout() ); + group1Layout->setAlignment( Qt::AlignTop ); + + TextLabel2 = new QLabel( group1, "TextLabel2" ); + TextLabel2->setText( i18n( "Producer:" ) ); + + TextLabel3 = new QLabel( group1, "TextLabel3" ); + TextLabel3->setText( i18n( "Type:" ) ); + + comboProducer = new KComboBox( FALSE, group1, "comboProducer" ); + comboType = new KComboBox( FALSE, group1, "comboType" ); + + checkEmpty = new QCheckBox( i18n("&Start with an empty label"), group1 ); + checkEmpty->setEnabled( !change ); + + group1Layout->addMultiCellWidget( checkEmpty, 0, 0, 0, 1 ); + group1Layout->addWidget( TextLabel2, 1, 0 ); + group1Layout->addWidget( TextLabel3, 2, 0 ); + group1Layout->addWidget( comboProducer, 1, 1 ); + group1Layout->addWidget( comboType, 2, 1 ); + + NewLabelLayout->addWidget( group1 ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout2->addItem( spacer_2 ); + NewLabelLayout->addLayout( Layout2 ); + + TextLabel4 = new QLabel( this, "TextLabel4" ); + preview = new LabelPreview( this, "preview" ); + + QHBoxLayout* hlayout = new QHBoxLayout( 0, 6, 6 ); + hlayout->addWidget( TextLabel4 ); + hlayout->addWidget( preview ); + NewLabelLayout->addLayout( hlayout ); + QSpacerItem* spacer_3 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + NewLabelLayout->addItem( spacer_3 ); + + Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1"); + + buttonOwnFormat = new KPushButton( this, "buttonOwnFormat" ); + buttonOwnFormat->setText( i18n( "&Add own Label Definition" ) ); + Layout1->addWidget( buttonOwnFormat ); + + QSpacerItem* spacer_4 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout1->addItem( spacer_4 ); + + buttonOk = new KPushButton( this, "buttonOk" ); + buttonOk->setText( i18n( "&OK" ) ); + buttonOk->setDefault( true ); + Layout1->addWidget( buttonOk ); + + buttonCancel = new KPushButton( this, "buttonCancel" ); + buttonCancel->setText( i18n( "&Cancel" ) ); + Layout1->addWidget( buttonCancel ); + NewLabelLayout->addLayout( Layout1 ); + + connect( comboProducer, SIGNAL( activated(int) ), this, SLOT( updateType() ) ); + connect( comboProducer, SIGNAL( activated(int) ), this, SLOT( updateText() ) ); + connect( comboType, SIGNAL( activated(int) ), this, SLOT( updateText() ) ); + connect( checkEmpty, SIGNAL( clicked() ), this, SLOT( updateText() ) ); + + connect( buttonOk, SIGNAL( clicked() ), this, SLOT(accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT(reject() ) ); + connect( buttonOwnFormat, SIGNAL( clicked() ), this, SLOT(add() ) ); + fillData(); + updateType(); + updateText(); +} + +NewLabel::~NewLabel() +{ + if( types ) + delete [] types; +} + +void NewLabel::fillData() +{ + comboProducer->clear(); + QStringList list = Definition::getProducers(); + comboProducer->insertStringList( list ); + + if( comboProducer->count() ) { + types = new QStringList[comboProducer->count()]; + for( int i = 0; i < comboProducer->count(); i++ ) + types[i] = Definition::getTypes( comboProducer->text( i ) ); + } +} + +void NewLabel::updateType() +{ + comboType->clear(); + if( types ) + comboType->insertStringList( types[ comboProducer->currentItem() ] ); +} + +void NewLabel::updateText() +{ + comboProducer->setEnabled( !checkEmpty->isChecked() ); + comboType->setEnabled( !checkEmpty->isChecked() ); + TextLabel2->setEnabled( !checkEmpty->isChecked() ); + TextLabel3->setEnabled( !checkEmpty->isChecked() ); + + if(!checkEmpty->isChecked()) + { + Definition d( comboProducer->currentText(), comboType->currentText() ); + TextLabel4->setText( QString(i18n( + "Format:
\nWidth: ") + I2S(d.getMeasurements().width()) + + i18n("%1
Height: ") + I2S(d.getMeasurements().height()) + + i18n("%2
Horizontal Gap: ") + I2S(d.getMeasurements().gapH()) + + i18n("%3
Vertical Gap: ") + I2S(d.getMeasurements().gapV()) + + i18n("%4
Top Gap: ") + I2S(d.getMeasurements().gapTop()) + + i18n("%5
Left Gap: ") + I2S(d.getMeasurements().gapLeft()) + "%6
" + ).arg( Measurements::system() ) + .arg( Measurements::system() ) + .arg( Measurements::system() ) + .arg( Measurements::system() ) + .arg( Measurements::system() ) + .arg( Measurements::system() ) ); + + preview->setRect( QRect( (int)d.getMeasurements().gapLeftMM(), + (int)d.getMeasurements().gapTopMM(), + (int)d.getMeasurements().widthMM(), + (int)d.getMeasurements().heightMM() ) ); + preview->setMeasurements( d.getMeasurements() ); + preview->setPrvEnabled( true ); + preview->repaint(); + curid = d.getId(); + } + else + { + TextLabel4->setText( i18n("No label selected.") ); + preview->setPrvEnabled( false ); + preview->repaint(); + } +} + +bool NewLabel::isInCombo( QComboBox* combo, QString text ) +{ + if( combo->count() == 0 ) + return false; + + for( int i = 0; i < combo->count(); i++ ) + if( combo->text( i ) == text ) + return true; + return false; +} + +void NewLabel::setLabelId( int id ) +{ + QString name; + QSqlQuery query("SELECT type FROM " TABLE_LABEL_DEF " WHERE label_no='" + QString::number( id ) + "'" ); + while( query.next() ) + name = query.value( 0 ).toString(); + + for( int i = 0; i < comboProducer->count(); i++ ) { + comboProducer->setCurrentItem( i ); + updateType(); + for( int z = 0; z < comboType->count(); z++ ) + if( comboType->text( z ) == name ) { + comboProducer->setCurrentItem( i ); + comboType->setCurrentItem( z ); + return; + } + } + + comboProducer->setCurrentItem( 0 ); + updateType(); +} + +void NewLabel::add() +{ + DefinitionDialog* d = new DefinitionDialog( this ); + if( d->exec() == QDialog::Accepted ){ + fillData(); + updateType(); + updateText(); + } + delete d; +} + +bool NewLabel::empty() const +{ + return checkEmpty->isChecked(); +} + + +#include "newlabel.moc" diff --git a/kbarcode/newlabel.h b/kbarcode/newlabel.h new file mode 100644 index 0000000..5c5da06 --- /dev/null +++ b/kbarcode/newlabel.h @@ -0,0 +1,79 @@ +/*************************************************************************** + newlabel.h - description + ------------------- + begin : Son Mai 5 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef NEWLABEL_H +#define NEWLABEL_H + +#include +#include + +#include "definition.h" + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QCheckBox; +class QComboBox; +class KComboBox; +class KPushButton; +class QLabel; +class QString; +class LabelPreview; +class NewLabel : public QDialog +{ + Q_OBJECT + public: + NewLabel( QWidget* parent = 0, const char* name = 0, bool change = FALSE, WFlags fl = 0 ); + ~NewLabel(); + + int labelId() const { return curid; } + bool empty() const; + + void setLabelId( int id ); + + static bool isInCombo( QComboBox* combo, QString text ); + + private slots: + void updateType(); + void updateText(); + void add(); + + private: + void fillData(); + + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QCheckBox* checkEmpty; + KComboBox* comboProducer; + KComboBox* comboType; + KPushButton* buttonOwnFormat; + QLabel* TextLabel4; + KPushButton* buttonOk; + KPushButton* buttonCancel; + LabelPreview* preview; + QStringList* types; + + protected: + int curid; + QVBoxLayout* NewLabelLayout; + QHBoxLayout* Layout5; + QHBoxLayout* Layout2; + QHBoxLayout* Layout1; +}; + +#endif // NEWLABEL_H diff --git a/kbarcode/pixmapbarcode.cpp b/kbarcode/pixmapbarcode.cpp new file mode 100644 index 0000000..56a597e --- /dev/null +++ b/kbarcode/pixmapbarcode.cpp @@ -0,0 +1,492 @@ +/*************************************************************************** + pixmapbarcode.cpp - description + ------------------- + begin : Mon Nov 22 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "pixmapbarcode.h" +#include "barkode.h" + +// patch from Ali Akcaagac says that this include is needed +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* Margin added by GNU Barcode to the barcodes */ +#define BARCODE_MARGIN 10 + +/* Use a 5KB buffer for pipes */ +#define BUFFER_SIZE 1024 * 5 + +PDF417Options::PDF417Options() +{ + defaults(); +} + +const PDF417Options& PDF417Options::operator=( const BarkodeEngineOptions& rhs ) +{ + const PDF417Options* pdf = (dynamic_cast(&rhs)); + + this->m_row = pdf->m_row; + this->m_col = pdf->m_col; + this->m_err = pdf->m_err; + + return *this; +} + +void PDF417Options::defaults() +{ + m_row = 24; + m_col = 8; + m_err = 5; +} + +void PDF417Options::load( const QDomElement* tag ) +{ + m_row = tag->attribute( "pdf417.row", "24" ).toInt(); + m_col = tag->attribute( "pdf417.col", "8" ).toInt(); + m_err = tag->attribute( "pdf417.err", "5" ).toInt(); +} + +void PDF417Options::save( QDomElement* tag ) +{ + tag->setAttribute( "pdf417.row", m_row ); + tag->setAttribute( "pdf417.col", m_col ); + tag->setAttribute( "pdf417.err", m_err ); +} + +PixmapBarcode::PixmapBarcode() + : BarkodeEngine() +{ +} + + +PixmapBarcode::~PixmapBarcode() +{ +} + +const PixmapBarcode & PixmapBarcode::operator=( const BarkodeEngine & rhs ) +{ + const PixmapBarcode* pix = dynamic_cast(&rhs); + + if( pix ) + { + m_pdf417_options = pix->m_pdf417_options; + p = pix->p; + } + + return *this; +} + +const QSize PixmapBarcode::size() const +{ + return ( p.size().isNull() ? QSize( 100, 80 ) : p.size() ); +} + +void PixmapBarcode::update( const QPaintDevice* device ) +{ + p.resize( 0, 0 ); + createBarcode( &p, device ); +} + +void PixmapBarcode::drawBarcode( QPainter & painter, int x, int y ) +{ + if( p.isNull() ) + createBarcode( &p, painter.device() ); + + if( p.isNull() ) // still no barcode.... + { + barkode->drawInvalid( painter, x, y ); + return; + } + + painter.drawPixmap( x, y, p ); +} + +bool PixmapBarcode::createPixmap( QPixmap* target, int resx, int resy ) +{ + char* postscript = NULL; + long postscript_size = 0; + QString cmd; + bool bMonocrome; + + bMonocrome = ( barkode->foreground() == Qt::black && + barkode->background() == Qt::white && + barkode->textColor() == Qt::black ); + + KTempFile* input = new KTempFile( QString::null, bMonocrome ? ".pbm" : ".ppm" ); + input->file()->close(); + + if( Barkode::engineForType( barkode->type() ) == PDF417 ) { + if(!createPdf417( input )) { + cleanUp( input, target ); + return false; + } + + target->load( input->name(), "GIF" ); + } else { + if( !createPostscript( &postscript, &postscript_size ) ) + { + cleanUp( input, target ); + return false; + } + + FILE* gs_pipe; + + if( !postscript_size ) + { + // GNU Barcode was not able to encode this barcode + cleanUp( input, target ); + return false; + } + + QRect size = bbox( postscript, postscript_size ); + double sw = (double)(size.x() + size.width())/72 * resx; + double sh = (double)(size.y() + size.height())/72 * resy; + + if( Barkode::engineForType( barkode->type() ) == TBARCODE ) + { + sw = (double)(size.x() + size.width()); + sh = (double)(size.y() + size.height()); + } + + cmd = QString("gs -g%1x%2").arg(int(sw*(double)barkode->scaling())).arg(int(sh*(double)barkode->scaling())); + cmd += " -r" + QString::number( resx*(double)barkode->scaling()) + "x" + QString::number( resy*(double)barkode->scaling() ); + cmd += QString(" -sDEVICE=%1 -sOutputFile=").arg( bMonocrome ? "pbmraw" : "ppm" ); + cmd += input->name(); + cmd += " -sNOPAUSE -q - -c showpage quit"; + + qDebug("cmd: " + cmd ); + gs_pipe = popen( cmd.latin1(), "w" ); + if( !gs_pipe ) + { + qDebug("ERROR: cannot open Ghostscript pipe!"); + cleanUp( input, target ); + return false; + } + + fwrite( postscript, sizeof(char), postscript_size, gs_pipe ); + pclose( gs_pipe ); + + target->load( input->name(), "PBM" ); + } + + + free( postscript ); + + input->unlink(); + delete input; + + return true; +} + +bool PixmapBarcode::createPostscript( char** postscript, long* postscript_size ) +{ + QString cmd; + + /* + if( Barkode::engineForType( barkode->type() ) == TBARCODE ) + { + cmd = createTBarcodeCmd(); + qDebug("tbarcodeclient commandline: %s", cmd.latin1() ); + } + else // GNU_BARCODE + */ + { + cmd = "barcode -E -b "; + cmd += KShellProcess::quote( barkode->parsedValue() ) + (barkode->textVisible() ? "" : " -n"); + cmd += " -e " + barkode->type(); + } + + if( !readFromPipe( cmd.latin1(), postscript, postscript_size ) ) + return false; + + return true; +} + +QRect PixmapBarcode::bbox( const char* data, long size ) +{ + int x = 0, y = 0, w = 0, h = 0; + const char* bbox = "%%BoundingBox:"; + int len = strlen( bbox ); + + QRect s(0,0,0,0); + QByteArray array; + array.setRawData( data, size ); + + QBuffer b( array ); + if( !b.open( IO_ReadOnly ) ) + return s; + + QTextStream t( &b ); + + QString text = t.readLine(); + while( !text.isNull() ) + { + if( text.startsWith( bbox ) ) + { + text = text.right( text.length() - len ); + sscanf( (const char*)text, "%d %d %d %d", &x, &y, &w, &h ); + s = QRect( x, y, w, h ); + break; + } + + text = t.readLine(); + } + + b.close(); + array.resetRawData( data, size ); + + return s; +} + +bool PixmapBarcode::readFromPipe( const char* command, char** buffer, long* buffer_size ) +{ + FILE* pipe = popen( command, "r" ); + if( !pipe ) + { + qDebug("ERROR: cannot open pipe %s!", command ); + return false; + } + + char* buf = (char*)malloc( BUFFER_SIZE ); + char* tmp = NULL; + int s = 0; + + *buffer_size = 0; + do { + s = fread( buf, sizeof(char), BUFFER_SIZE, pipe ); + + // Special case: + // GNU Barcode Error + if( !s ) + break; + + // there won't be more data to read + tmp = (char*)malloc( *buffer_size + s ); + + if( *buffer ) + { + memcpy( tmp, *buffer, *buffer_size ); + free( *buffer ); + } + + memcpy( tmp+ *buffer_size, buf, s ); + *buffer = tmp; + *buffer_size += s; + } while( s == BUFFER_SIZE ); + + pclose( pipe ); + free( buf ); + + return true; +} + +void PixmapBarcode::createBarcode( QPixmap* target, const QPaintDevice* device ) +{ + QPaintDeviceMetrics pdm( device ); + int resx = pdm.logicalDpiX(); + int resy = pdm.logicalDpiY(); + + QPixmap* cached = 0;//BarcodeCache::instance()->read( barcode, resx, resy, value ); + + // no matching barcode found in cache + if( !cached ) { + if( !createPixmap( target, resx, resy ) ) + return; + } else { + *target = *cached; + delete cached; + } + + if( Barkode::hasFeature( barkode->type(), PDF417 ) ) { + // we have to scale to the correct resolution. + // we scale already here and not at the end, + // so that the addMargin function does not get a scaled margin. + QPaintDeviceMetrics pdm( KApplication::desktop() ); + int screenresx = pdm.logicalDpiX(); + int screenresy = pdm.logicalDpiY(); + + QWMatrix m; + double scalex = (resx/screenresx)*barkode->scaling(); + double scaley = (resy/screenresy)*barkode->scaling(); + m.scale( scalex, scaley ); + *target = target->xForm( m ); + } + *target = cut( target, barkode->cut() ); + *target = addMargin( target ); + + // Rotate + QWMatrix m; + m.rotate( (double)barkode->rotation() ); + *target = target->xForm( m ); + + //barcode.valid = true; +} + +bool PixmapBarcode::createPdf417( KTempFile* output ) +{ + const PDF417Options* options = (dynamic_cast(barkode->engine()->options())); + + if( !options ) + { + qDebug("No PDF417Options available!"); + return false; + } + + KTempFile text( QString::null, ".txt" ); + QTextStream t( text.file() ); + t << barkode->parsedValue(); + text.file()->close(); + + // ps does not work because bounding box information is missing + // pbm cannot be loaded by KImgIO (works fine in GIMP) + // gif is the only other option + KShellProcess proc; + proc << "pdf417_enc" << "-tgif" << text.name() << output->name() + << options->row() + << options->col() + << options->err(); + + proc.start( KProcess::Block, KProcess::NoCommunication ); + proc.resume(); + + if( proc.exitStatus() ) { + text.unlink(); + return false; + } + + text.unlink(); + return true; +} + +#if 0 +QString PixmapBarcode::createTBarcodeCmd() +{ + QString cmd; + + // print text + QString flag = barkode->textVisible() ? " Ton" : " n Toff"; // we pass the old parameter Ton and the new one: n + // escape text + flag.append( barkode->tbarcodeOptions()->escape() ? " son" : " soff" ); + // autocorrection + flag.append( barkode->tbarcodeOptions()->autocorrect() ? " Aon" : " Aoff" ); + // barcode height + flag.append( QString( " h%1" ).arg( barkode->tbarcodeOptions()->height() ) ); + // text above + if( barkode->tbarcodeOptions()->above() ) + flag.append( " a" ); + + cmd = "tbarcodeclient "; + if( !Barkode::hasFeature( barkode->type(), BARCODE2D ) ) + cmd += QString( " m%1" ).arg( barkode->tbarcodeOptions()->moduleWidth() * 1000 ); + + if( Barkode::hasFeature( barkode->type(), DATAMATRIX ) ) + cmd += QString( " Ds%1" ).arg( barkode->datamatrixSize() ); + + if( Barkode::hasFeature( barkode->type(), PDF417BARCODE ) ) + cmd += QString( " Pr%1 Pc%2 Pe%3" ).arg( barkode->pdf417Options()->row() ) + .arg( barkode->pdf417Options()->col() ) + .arg( barkode->pdf417Options()->err() ); + + cmd += " " + barkode->type() + QString(" tPS c%1").arg( barkode->tbarcodeOptions()->checksum() ); + cmd += flag + " d" + KShellProcess::quote( barkode->parsedValue() ); + + return cmd; +} +#endif // 0 + +void PixmapBarcode::cleanUp( KTempFile* file, QPixmap* target ) +{ + target->resize( 0, 0 ); + + file->unlink(); + delete file; +} + +QPixmap PixmapBarcode::cut( QPixmap* pic, double cut) +{ + if( cut == 1.0 ) + return (*pic); + + QPixmap pcut( pic->width(), int((double)pic->height() * cut) ); + pcut.fill( Qt::white ); // barcode.bg + + QWMatrix m; + /* + * if text is above the barcode cut from + * below the barcode. + */ + + // TODO: put this into one if, I am to stupid today..... + if( Barkode::hasFeature( barkode->type(), TBARCODEADV ) ) { + //if( !barcode.tbarcode.above ) + m.rotate( 180 ); + } else + m.rotate( 180 ); + + QPainter painter( &pcut ); + painter.drawPixmap( 0, 0, pic->xForm( m ) ); + + return pcut.xForm( m ); +} + +QPixmap PixmapBarcode::addMargin( QPixmap* pic ) +{ + QPixmap p; + + /* We have to handle UPC special because of the checksum character + * which is printed on the right margin. + * The samve goes for ISBN codes. + * Any other formats?? + */ + + bool gnubarcode = (Barkode::engineForType( barkode->type() ) == GNU_BARCODE) || + (Barkode::engineForType( barkode->type() ) == PURE_POSTSCRIPT); + double barm = gnubarcode ? BARCODE_MARGIN * barkode->scaling() : 0.0; + + // Add margin + double sx = barm; + double sy = barm; + double sw = pic->width() - (barm * 2); + double sh = pic->height() - (barm * 2); + int margin = (int)(barkode->quietZone()*2 - barm*2); + + if( gnubarcode && (barkode->type() == "upc" || barkode->type() == "isbn") ) + { + sw = pic->width() - barm; + + p.resize( pic->width() + int(barkode->quietZone()*2 - barm), pic->height() + margin ); + } + else + p.resize( pic->width() + margin, pic->height() + margin ); + + p.fill( barkode->background() ); + QPainter painter( &p ); + painter.drawPixmap( barkode->quietZone(), barkode->quietZone(), *pic, (int)sx, (int)sy, (int)sw, (int)sh ); + painter.end(); + + return p; +} diff --git a/kbarcode/pixmapbarcode.h b/kbarcode/pixmapbarcode.h new file mode 100644 index 0000000..76591a2 --- /dev/null +++ b/kbarcode/pixmapbarcode.h @@ -0,0 +1,136 @@ +/*************************************************************************** + pixmapbarcode.cpp - description + ------------------- + begin : Mon Nov 22 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef PIXMAPBARCODE_H +#define PIXMAPBARCODE_H + +#include "barkodeengine.h" +#include + +class KTempFile; +class QPainter; + +class PDF417Options : public BarkodeEngineOptions { + public: + PDF417Options(); + + const PDF417Options& operator=( const BarkodeEngineOptions& rhs ); + void defaults(); + + void load( const QDomElement* tag ); + void save( QDomElement* tag ); + + inline int row() const { return m_row; } + inline int col() const { return m_col; } + inline int err() const { return m_err; } + + inline void setRow( int r ) { m_row = r; } + inline void setCol( int r ) { m_col = r; } + inline void setErr( int r ) { m_err = r; } + + private: + int m_row; + int m_col; + int m_err; +}; + +/** + * A pixmap based barcode engine which + * uses different commandline tools to + * generate barcodes. + * This class is a port of the old BarCode + * class to the new Barkode interface. + * + * @author Dominik Seichter + */ +class PixmapBarcode : public BarkodeEngine +{ + public: + PixmapBarcode(); + ~PixmapBarcode(); + + const PixmapBarcode & operator=( const BarkodeEngine & rhs ); + + inline EEngine engine() const; + const QSize size() const; + void update( const QPaintDevice* device ); + void drawBarcode( QPainter & painter, int x, int y ); + + inline BarkodeEngineOptions* options(); + + private: + bool createPixmap( QPixmap* target, int resx, int resy ); + void createBarcode( QPixmap* target, const QPaintDevice* device ); + bool createPdf417( KTempFile* output ); + //QString createTBarcodeCmd(); + + virtual bool createPostscript( char** postscript, long* postscript_size ); + + /** Mage sure the temporaray file @p file + * gets closed and deleted properly + */ + void cleanUp( KTempFile* file, QPixmap* target ); + /** + * Cut the barcode either on the top or + * on the bottom, depending on the text position. + *g + * @param pic the QPixmap that will be cutted + * @param cut a value between 0.0 and 1.0. If cut = 1.0 + * then no cut will happen, if cut = 0.5, half of + * the barcode is going to be cutted away. + */ + QPixmap cut( QPixmap* pic, double cut ); + + /** + * Add a margin to the QPixmap pic. + * @param pic the QPixmap pic which should get a margin + */ + QPixmap addMargin( QPixmap* pic ); + + protected: + /** Creates a pipe and read the data returned by the command into a buffer. + * \param command the command to execute + * \param buffer pointer to a buffer, will be malloc'ed and has to be free'd + * \param buffer_size pointer to a long where the size of the buffer will be stored + * \returns true if all data could be read sucessfully otherwise false. + */ + bool readFromPipe( const char* command, char** buffer, long* buffer_size ); + + /** + * \param postscript a postscript program + * \param postscript_size length of the postscript program + * \returns the BoundingBox of the postscript or EPS file + * so that it can be cropped correctly + */ + virtual QRect bbox( const char* postscript, long postscript_size ); + + private: + QPixmap p; + PDF417Options m_pdf417_options; +}; + +EEngine PixmapBarcode::engine() const +{ + return PIXMAP; +} + +BarkodeEngineOptions* PixmapBarcode::options() +{ + return &m_pdf417_options; +} + +#endif diff --git a/kbarcode/previewdialog.cpp b/kbarcode/previewdialog.cpp new file mode 100644 index 0000000..2af08f6 --- /dev/null +++ b/kbarcode/previewdialog.cpp @@ -0,0 +1,219 @@ +/*************************************************************************** + previewdialog.cpp - description + ------------------- + begin : Die Dez 10 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "previewdialog.h" +#include "label.h" +#include "sqltables.h" +#include "labeleditor.h" +#include "measurements.h" + +// Qt includes +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int PreviewDialog::customer_index = 0; +int PreviewDialog::m_index = 1; +QString PreviewDialog::group = ""; +QString PreviewDialog::article = ""; + +PreviewDialog::PreviewDialog( QIODevice* device, Definition* d, QString filename, QWidget *parent, const char *name ) + : QDialog( parent, name, true, WDestructiveClose ) +{ + file = device; + def = d; + m_filename = filename; + + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + + QHBoxLayout* Layout = new QHBoxLayout( this, 6, 6 ); + QVBoxLayout* vbox = new QVBoxLayout( 0, 6, 6 ); + QVBoxLayout* buttons = new QVBoxLayout( 0, 6, 6 ); + QGridLayout* grid = new QGridLayout( 0 ); + + customerName = new KComboBox( false, this ); + customerId = new KComboBox( false, this ); + + groupName = new KLineEdit( group, this ); + articleId = new KLineEdit( article, this ); + if( SqlTables::isConnected() ) { + KCompletion* comp = articleId->completionObject(); + QSqlQuery query( "select article_no from barcode_basic" ); + QStringList slist; + while ( query.next() ) + slist.append( query.value(0).toString() ); + slist.sort(); + comp->setItems( slist ); + } + + spinIndex = new KIntNumInput( this ); + spinIndex->setRange( 1, 100000, 1, false ); + spinIndex->setValue( m_index ); + + serialStart = new KLineEdit( this ); + + serialInc = new KIntNumInput( this ); + serialInc->setRange( 1, 10000, 1, false ); + + lineAddr = new KLineEdit( this ); + lineAddr->setReadOnly( true ); + + buttonAddr = new KPushButton( i18n("Select &Address"), this ); + + buttonUpdate = new KPushButton( i18n("&Update"), this ); + buttonClose = new KPushButton( i18n("&Close"), this ); + buttonClose->setIconSet( SmallIconSet("fileclose") ); + + grid->addWidget( new QLabel( i18n("Customer Name and No.:"), this ), 0, 0 ); + grid->addWidget( customerName, 0, 1 ); + grid->addWidget( customerId, 0, 2 ); + grid->addWidget( new QLabel( i18n("Article Number:"), this ), 1, 0 ); + grid->addMultiCellWidget( articleId, 1, 1, 1, 2 ); + grid->addWidget( new QLabel( i18n("Group:"), this ), 2, 0 ); + grid->addMultiCellWidget( groupName, 2, 2, 1, 2 ); + grid->addWidget( new QLabel( i18n("Index:"), this ), 3, 0 ); + grid->addMultiCellWidget( spinIndex, 3, 3, 1, 2 ); + grid->addWidget( new QLabel( i18n("Serial start:"), this ), 4, 0 ); + grid->addMultiCellWidget( serialStart, 4, 4, 1, 2 ); + grid->addWidget( new QLabel( i18n( "Serial increment:" ), this ), 5, 0 ); + grid->addMultiCellWidget( serialInc, 5, 5, 1, 2 ); + grid->addWidget( new QLabel( i18n( "Addressbook entry:" ), this ), 6, 0 ); + grid->addWidget( lineAddr, 6, 1 ); + grid->addWidget( buttonAddr, 6, 2 ); + QScrollView* sv = new QScrollView( this ); + + preview = new QLabel( sv->viewport() ); + sv->addChild( preview ); + + QPixmap pix( (int)d->getMeasurements().width( this ), (int)d->getMeasurements().height( this ) ); + pix.fill( Qt::white ); + preview->setPixmap( pix ); + + vbox->addLayout( grid ); + vbox->addWidget( sv ); + + buttons->addWidget( buttonUpdate ); + buttons->addWidget( buttonClose ); + buttons->addItem( spacer ); + + Layout->addLayout( vbox ); + Layout->addLayout( buttons ); + + connect( buttonClose, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonAddr, SIGNAL( clicked() ), this, SLOT( selectAddress() ) ); + // TODO: + // remove this ugly hack! The finished label is only shown when I call + // updateChanges() twice. I have no idea why! + connect( buttonUpdate, SIGNAL( clicked() ), this, SLOT( updatechanges() ) ); + connect( buttonUpdate, SIGNAL( clicked() ), this, SLOT( updatechanges() ) ); + // end ugly hack + + connect( customerName, SIGNAL( activated(int) ), this, SLOT( customerNameChanged(int) ) ); + connect( customerId, SIGNAL( activated(int) ), this, SLOT( customerIdChanged(int) ) ); + + KConfig* config = kapp->config(); + config->setGroup( "PreviewDialog" ); + resize( config->readNumEntry( "width", width() ), config->readNumEntry( "height", height() ) ); + + if( SqlTables::isConnected() ) + setupSql(); +} + +PreviewDialog::~PreviewDialog() +{ + KConfig* config = kapp->config(); + config->setGroup( "PreviewDialog" ); + config->writeEntry( "width", width() ); + config->writeEntry( "height", height() ); + config->sync(); +} + +void PreviewDialog::setupSql() +{ + QSqlCursor cur( "customer" ); + cur.select(); + customerId->clear(); + customerName->clear(); + while ( cur.next() ) { + customerId->insertItem( cur.value("customer_no" ).toString() ); + customerName->insertItem( cur.value("customer_name" ).toString() ); + } + + customerId->setCurrentItem( customer_index ); + customerName->setCurrentItem( customer_index ); +} + +void PreviewDialog::selectAddress() +{ + m_address = KABC::AddresseeDialog::getAddressee( this ); + if( !m_address.isEmpty() ) + lineAddr->setText( m_address.realName() ); + else + lineAddr->setText( QString::null ); +} + +void PreviewDialog::updatechanges() +{ + QPixmap pix( (int)def->getMeasurements().width( this ), (int)def->getMeasurements().height( this ) ); + pix.fill( Qt::white ); + + QPainter painter( &pix ); + + Label* l = new Label( def, file, m_filename, KApplication::desktop(), + customerId->currentText(), articleId->text(), groupName->text() ); + l->setIndex( spinIndex->value() - 1 ); + l->setSerial( serialStart->text(), serialInc->value() ); + l->setAddressee( &m_address ); + l->draw( &painter, 0, 0 ); + + preview->setPixmap( pix ); + + delete l; + + // keep settings for next the + // next time the dialog is shown + group = groupName->text(); + article = articleId->text(); + customer_index = customerId->currentItem(); + m_index = spinIndex->value(); +} + +void PreviewDialog::customerIdChanged( int index ) +{ + customerName->setCurrentItem( index ); +} + +void PreviewDialog::customerNameChanged( int index ) +{ + customerId->setCurrentItem( index ); +} + +#include "previewdialog.moc" diff --git a/kbarcode/previewdialog.h b/kbarcode/previewdialog.h new file mode 100644 index 0000000..db3c056 --- /dev/null +++ b/kbarcode/previewdialog.h @@ -0,0 +1,76 @@ +/*************************************************************************** + previewdialog.h - description + ------------------- + begin : Die Dez 10 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef PREVIEWDIALOG_H +#define PREVIEWDIALOG_H + +#include +#include + +class Definition; +class KComboBox; +class KIntNumInput; +class KLineEdit; +class KPushButton; +class QIODevice; +class QLabel; +class QWidget; +class PreviewDialog : public QDialog { + Q_OBJECT + public: + PreviewDialog( QIODevice* device, Definition* d, QString filename, QWidget *parent=0, const char *name=0); + ~PreviewDialog(); + + private slots: + void updatechanges(); + void customerNameChanged( int index ); + void customerIdChanged( int index ); + void setupSql(); + void selectAddress(); + + private: + QLabel* preview; + + KLineEdit* articleId; + KLineEdit* groupName; + KLineEdit* serialStart; + KLineEdit* lineAddr; + + KIntNumInput* spinIndex; + KIntNumInput* serialInc; + + KComboBox* customerName; + KComboBox* customerId; + + KPushButton* buttonUpdate; + KPushButton* buttonClose; + KPushButton* buttonAddr; + + KABC::Addressee m_address; + + Definition* def; + QIODevice* file; + + QString m_filename; + + static int customer_index; + static int m_index; + static QString group; + static QString article; +}; + +#endif diff --git a/kbarcode/printersettings.cpp b/kbarcode/printersettings.cpp new file mode 100644 index 0000000..1668f44 --- /dev/null +++ b/kbarcode/printersettings.cpp @@ -0,0 +1,199 @@ +/*************************************************************************** + printersettings.cpp - description + ------------------- + begin : Don Jan 16 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "printersettings.h" +#include "kbarcode.h" + +// KDE includes +#include +#include +#include +#include +#include +#include + +// Stolen from koffice/lib/kofficecore/koGlobal.cc +// and modified afterwards + +// - the comments "should be..." indicates the exact values if the inch sizes would be multiplied by 25.4 mm/inch + +// paper formats ( mm ) - public for compat reasons, but DO NOT USE in new programs ! +// See KoPageFormat's methods instead. + +const PageFormatInfo pageFormatInfo[]= +{ + { KPrinter::A3, "A3", I18N_NOOP("ISO A3"), 297.0, 420.0 }, + { KPrinter::A4, "A4", I18N_NOOP("ISO A4"), 210.0, 297.0 }, + { KPrinter::A5, "A5", I18N_NOOP("ISO A5"), 148.0, 210.0 }, + { KPrinter::Letter, "Letter", I18N_NOOP("US Letter"), 216.0, 279.0 }, // should be 215.9 mm x 279.4 mm + { KPrinter::Legal, "Legal", I18N_NOOP("US Legal"), 216.0, 356.0 }, // should be 215.9 mm x 335.6 mm + { KPrinter::A4, "Screen", I18N_NOOP("Screen"), 297.0, 210.0 }, // Custom, so fall back to A4 + { KPrinter::A4, "Custom", I18N_NOOP("Custom"), 210.0, 297.0 }, // Custom, so fall back to A4 + { KPrinter::B5, "B5", I18N_NOOP("ISO B5"), 182.0, 257.0 }, + { KPrinter::Executive, "Executive", I18N_NOOP("US Executive"), 191.0, 254.0 }, // should be 190.5 mm x 254.0 mm + { KPrinter::A0, "A0", I18N_NOOP("ISO A0"), 841.0, 1189.0 }, + { KPrinter::A1, "A1", I18N_NOOP("ISO A1"), 594.0, 841.0 }, + { KPrinter::A2, "A2", I18N_NOOP("ISO A2"), 420.0, 594.0 }, + { KPrinter::A6, "A6", I18N_NOOP("ISO A6"), 105.0, 148.0 }, + { KPrinter::A7, "A7", I18N_NOOP("ISO A7"), 74.0, 105.0 }, + { KPrinter::A8, "A8", I18N_NOOP("ISO A8"), 52.0, 74.0 }, + { KPrinter::A9, "A9", I18N_NOOP("ISO A9"), 37.0, 52.0 }, + { KPrinter::B0, "B0", I18N_NOOP("ISO B0"), 1030.0, 1456.0 }, + { KPrinter::B1, "B1", I18N_NOOP("ISO B1"), 728.0, 1030.0 }, + { KPrinter::B10, "B10", I18N_NOOP("ISO B10"), 32.0, 45.0 }, + { KPrinter::B2, "B2", I18N_NOOP("ISO B2"), 515.0, 728.0 }, + { KPrinter::B3, "B3", I18N_NOOP("ISO B3"), 364.0, 515.0 }, + { KPrinter::B4, "B4", I18N_NOOP("ISO B4"), 257.0, 364.0 }, + { KPrinter::B6, "B6", I18N_NOOP("ISO B6"), 128.0, 182.0 }, + { KPrinter::C5E, "C5", I18N_NOOP("ISO C5"), 163.0, 229.0 }, // Some sources tells: 162 mm x 228 mm + { KPrinter::Comm10E, "Comm10", I18N_NOOP("US Common 10"), 105.0, 241.0 }, // should be 104.775 mm x 241.3 mm + { KPrinter::DLE, "DL", I18N_NOOP("ISO DL"), 110.0, 220.0 }, + { KPrinter::Folio, "Folio", I18N_NOOP("US Folio"), 210.0, 330.0 }, // should be 209.54 mm x 330.2 mm + { KPrinter::Ledger, "Ledger", I18N_NOOP("US Ledger"), 432.0, 279.0 }, // should be 431.8 mm x 297.4 mm + { KPrinter::Tabloid, "Tabloid", I18N_NOOP("US Tabloid"), 279.0, 432.0 } // should be 297.4 mm x 431.8 mm +}; +// end stolen + +PrinterSettings* PrinterSettings::printerInstance = 0; + +PrinterSettings::PrinterSettings() + :QObject( 0, "printersettings" ) +{ + lpdata = new labelprinterdata; + loadConfig(); + + connect( kapp, SIGNAL( aboutToQuit() ), this, SLOT( saveConfig() ) ); +} + +PrinterSettings::~PrinterSettings() +{ +} + +PrinterSettings* PrinterSettings::getInstance() +{ + if( !printerInstance ) + printerInstance = new PrinterSettings(); + + return printerInstance; +} + +void PrinterSettings::loadConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("Printer"); + lpdata->articleEvent1 = (enum linebreak)config->readNumEntry("articleEvent1", NO_BREAK ); + lpdata->articleEvent2 = (enum linebreak)config->readNumEntry("articleEvent2", NO_BREAK ); + lpdata->articleEvent3 = (enum linebreak)config->readNumEntry("articleEvent3", NO_BREAK ); + lpdata->articleEvent4 = (enum linebreak)config->readNumEntry("articleEvent4", NO_BREAK ); + lpdata->groupEvent1 = (enum linebreak)config->readNumEntry("groupEvent1", NO_BREAK ); + lpdata->groupEvent2 = (enum linebreak)config->readNumEntry("groupEvent2", NO_BREAK ); + lpdata->groupEvent3 = (enum linebreak)config->readNumEntry("groupEvent3", NO_BREAK ); + lpdata->groupEvent4 = (enum linebreak)config->readNumEntry("groupEvent4", NO_BREAK ); + lpdata->useCustomNo = config->readBoolEntry("UseArticleCustomerNo", false ); + lpdata->quality = config->readNumEntry( "quality", Middle ); + // screen resolution was removed before 1.5.4, use middle instead + if( lpdata->quality != High && lpdata->quality != Middle && lpdata->quality != VeryHigh ) + lpdata->quality = Middle; + + config->setGroup("BatchPrinting"); + lpdata->comment = config->readEntry("comment", "#" ); + lpdata->separator = config->readEntry("separator", ";" ); + lpdata->quote = config->readEntry("quote", ""); + lpdata->border = config->readBoolEntry("border", false ); + lpdata->format = config->readNumEntry("PageSize", -1 ); + // get default page size from KDE + if( lpdata->format == -1 ) + for( unsigned int i = 0; i < sizeof( pageFormatInfo ) / sizeof( PageFormatInfo ); i++ ) + if( pageFormatInfo[i].kprinter == KGlobal::locale()->pageSize() ) { + lpdata->format = i; + break; + } + +} + +void PrinterSettings::saveConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("Printer"); + config->writeEntry("articleEvent1", lpdata->articleEvent1 ); + config->writeEntry("articleEvent2", lpdata->articleEvent2 ); + config->writeEntry("articleEvent3", lpdata->articleEvent3 ); + config->writeEntry("articleEvent4", lpdata->articleEvent4 ); + config->writeEntry("groupEvent1", lpdata->groupEvent1 ); + config->writeEntry("groupEvent2", lpdata->groupEvent2 ); + config->writeEntry("groupEvent3", lpdata->groupEvent3 ); + config->writeEntry("groupEvent4", lpdata->groupEvent4 ); + config->writeEntry("quality", lpdata->quality ); + config->writeEntry("UseArticleCustomerNo", lpdata->useCustomNo ); + + config->setGroup("BatchPrinting"); + config->writeEntry("comment", lpdata->comment ); + config->writeEntry("separator", lpdata->separator ); + config->writeEntry("quote", lpdata->quote ); + config->writeEntry("border", lpdata->border ); + config->writeEntry("PageSize", lpdata->format ); + + config->sync(); +} + +int PrinterSettings::getQuality() const +{ + return lpdata->quality == Middle || lpdata->quality == VeryHigh? High : lpdata->quality; +}; + +KPrinter* PrinterSettings::setupPrinter( const KURL & url, QWidget* parent, bool immediately, const QString & prn ) +{ + KPrinter* printer = new KPrinter( true, (enum QPrinter::PrinterMode)getQuality() ); + if( getData()->quality == Middle ) + printer->setResolution( 300 ); + else if( getData()->quality == VeryHigh ) + printer->setResolution( 1200 ); + + printer->setFullPage( true ); // don't use build in margin system + + if( !immediately && !printer->setup( parent ) ) + return 0; + + if( immediately && !prn.isEmpty() ) + printer->autoConfigure( prn ); + + if( !url.isValid() ) + printer->setDocFileName( url.fileName() ); + + return printer; +} + +void PrinterSettings::insertPageFormat( KComboBox* combo ) +{ + for( unsigned int i = 0; i < sizeof( pageFormatInfo ) / sizeof( PageFormatInfo ); i++ ) + combo->insertItem( pageFormatInfo[i].descriptiveName ); +} + +double PrinterSettings::pageWidth() const +{ + return pageFormatInfo[lpdata->format].width; +} + +double PrinterSettings::pageHeight() const +{ + return pageFormatInfo[lpdata->format].height; +} + + +#include "printersettings.moc" diff --git a/kbarcode/printersettings.h b/kbarcode/printersettings.h new file mode 100644 index 0000000..8083fcb --- /dev/null +++ b/kbarcode/printersettings.h @@ -0,0 +1,95 @@ +/*************************************************************************** + printersettings.h - description + ------------------- + begin : Don Jan 16 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef PRINTERSETTINGS_H +#define PRINTERSETTINGS_H + +#include +#include +#include + +class KURL; + +typedef struct labelprinterdata { + int articleEvent1; + int articleEvent2; + int articleEvent3; + int articleEvent4; + + int groupEvent1; + int groupEvent2; + int groupEvent3; + int groupEvent4; + + bool useCustomNo; + + int quality; // printer quality; enum PrinterMode + bool border; + int format; // index of the page format + + QString comment; + QString separator; + QString quote; +}; + +typedef struct PageFormatInfo +{ + KPrinter::PageSize kprinter; + const char* shortName; // Short name + const char* descriptiveName; // Full name, which will be translated + double width; // in mm + double height; // in mm +}; + +class KPrinter; +class KComboBox; +class PrinterSettings: public QObject { + Q_OBJECT + public: + enum { High = QPrinter::HighResolution, Middle, VeryHigh }; + enum { TEC, ZEBRA, INTERMEC, EPCL }; + + PrinterSettings(); + ~PrinterSettings(); + + labelprinterdata* getData() const { + return lpdata; + } + + int getQuality() const; + + // Get the size of the current selected page format + double pageWidth() const; + double pageHeight() const; + + void insertPageFormat( KComboBox* combo ); + static PrinterSettings* getInstance(); + + // don't forget to delete printer + KPrinter* setupPrinter( const KURL & url, QWidget* parent, bool immediately = false, const QString & prn = QString::null ); + + public slots: + void loadConfig(); + void saveConfig(); + + private: + labelprinterdata* lpdata; + + static PrinterSettings* printerInstance; +}; + +#endif diff --git a/kbarcode/printlabeldlg.cpp b/kbarcode/printlabeldlg.cpp new file mode 100644 index 0000000..849750f --- /dev/null +++ b/kbarcode/printlabeldlg.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** + printlabeldlg.cpp - description + ------------------- + begin : Mon Jun 30 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "printlabeldlg.h" +#include "printersettings.h" + +// Qt includes +#include +#include + +// KDE includes +#include +#include + +PrintLabelDlg::PrintLabelDlg(QWidget *parent, const char *name ) + : KDialogBase( KDialogBase::Plain, i18n("Print"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent,name) +{ + QVBoxLayout* box = new QVBoxLayout( plainPage() ); + + numLabels = new KIntNumInput( plainPage() ); + numLabels->setLabel( i18n("Number of labels:" ), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + numLabels->setRange( 1, 100000, 1, false ); + + numPos = new KIntNumInput( numLabels, 1, plainPage() ); + numPos->setLabel( i18n("Start at label position:" ), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + numPos->setRange( 1, 100, 1, false ); + + checkBorder = new QCheckBox( i18n("&Print crop marks (borders)"), plainPage() ); + checkBorder->setChecked( PrinterSettings::getInstance()->getData()->border ); + + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); + + box->addWidget( numLabels ); + box->addWidget( numPos ); + box->addWidget( checkBorder ); + box->addItem( spacer ); +} + +PrintLabelDlg::~PrintLabelDlg() +{ +} + +void PrintLabelDlg::setLabelsEnabled( bool b ) +{ + numLabels->setEnabled( b ); +} + +int PrintLabelDlg::labels() const +{ + return numLabels->value(); +} + +int PrintLabelDlg::position() const +{ + return numPos->value(); +} + +bool PrintLabelDlg::border() const +{ + return checkBorder->isChecked(); +} + +#include "printlabeldlg.moc" diff --git a/kbarcode/printlabeldlg.h b/kbarcode/printlabeldlg.h new file mode 100644 index 0000000..4760359 --- /dev/null +++ b/kbarcode/printlabeldlg.h @@ -0,0 +1,69 @@ +/*************************************************************************** + printlabeldlg.h - description + ------------------- + begin : Mon Jun 30 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef PRINTLABELDLG_H +#define PRINTLABELDLG_H + +#include +#include + +class QCheckBox; +class KIntNumInput; + +/** + *@author Dominik Seichter + * + * This small dialogs allows the user to select how many + * pages shall be printed and at which position the first + * label should be printed. + */ +class PrintLabelDlg : public KDialogBase { + Q_OBJECT + public: + PrintLabelDlg(QWidget *parent=0, const char *name=0); + ~PrintLabelDlg(); + + /** + * Allow/disallow the user to enter the + * numer of labels to print. + * @param b bool + */ + void setLabelsEnabled( bool b ); + + /** + * returns how many labels should be printed + */ + int labels() const; + + /** + * returns at which position the first label shall be printed + * (counting from the first label being number 1 _not_ 0 ) + */ + int position() const; + + /** + * returns wether crop marks shall be printed or not + */ + bool border() const; + + private: + KIntNumInput* numLabels; + KIntNumInput* numPos; + QCheckBox* checkBorder; +}; + +#endif diff --git a/kbarcode/propertywidget.cpp b/kbarcode/propertywidget.cpp new file mode 100644 index 0000000..ee56af5 --- /dev/null +++ b/kbarcode/propertywidget.cpp @@ -0,0 +1,631 @@ +/*************************************************************************** + propertywidget.h - description + ------------------- + begin : Do Sep 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "propertywidget.h" +#include "documentitem.h" +#include "rectitem.h" +#include "commands.h" +#include "sqltables.h" +#include "barcodecombo.h" +#include "multilineeditdlg.h" +#include "textitem.h" +#include "imageitem.h" +#include "measurements.h" +#include "mycanvasview.h" +//NY20 +#include "textlineitem.h" +#include "textlineedit.h" +//NY20 +#include "tokendialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IMAGE_INTERNAL i18n("Image Saved in KBarcode") + +void FillLineCombo( KComboBox* box ) +{ + /* A small helper function to fill + * a combobox with all by Qt + * supported pen styles. + */ + + // TODO: Use the enum for Qt line styles here! + + QPainter p; + for( int i = 1; i < 6; i++ ) { + QPixmap pixmap( 60, 20 ); + pixmap.fill( Qt::white ); + p.begin( &pixmap ); + p.setPen( QPen( Qt::black, 3, (Qt::PenStyle)i ) ); + p.drawLine( 5, 10, 55, 10 ); + p.end(); + + box->insertItem( pixmap ); + } +} + +PropertyWidget::PropertyWidget(QWidget* parent ) + : QWidget( parent, 0 ) +{ + grid = new QGridLayout( this, 2, 2 ); +} + +PropertyBorder::PropertyBorder( QWidget* parent ) + : PropertyWidget( parent ) +{ + checkBorder = new QCheckBox( this ); + checkBorder->setText( i18n("&Border Visible") ); + + buttonColor = new KColorButton( this ); + + spinWidth = new KIntNumInput( this ); + spinWidth->setRange( 1, 100, 1, false ); + + comboLine = new KComboBox( false, this ); + FillLineCombo( comboLine ); + + grid->addMultiCellWidget( checkBorder, 0, 0, 0, 1 ); + grid->addWidget( new QLabel( i18n("Color:"), this ), 1, 0 ); + grid->addWidget( buttonColor, 1, 1 ); + grid->addWidget( new QLabel( i18n("Line Width:"), this ), 2, 0 ); + grid->addWidget( spinWidth, 2, 1 ); + grid->addWidget( new QLabel( i18n("Line Style:"), this ), 3, 0 ); + grid->addWidget( comboLine, 3, 1 ); + + + connect( checkBorder, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); +} + +void PropertyBorder::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + BorderCommand* bc = new BorderCommand( checkBorder->isChecked(), QPen( buttonColor->color(), spinWidth->value(), (Qt::PenStyle)(comboLine->currentItem() + 1) ), item ); + bc->execute(); + command->addCommand( bc ); +} + +void PropertyBorder::initSettings( DocumentItem* item ) +{ + checkBorder->setChecked( item->border() ); + buttonColor->setColor( item->pen().color() ); + spinWidth->setValue( item->pen().width() ); + comboLine->setCurrentItem( item->pen().style() - 1 ); + + enableControls(); +} + +void PropertyBorder::enableControls() +{ + buttonColor->setEnabled( checkBorder->isChecked() ); + spinWidth->setEnabled( checkBorder->isChecked() ); + comboLine->setEnabled( checkBorder->isChecked() ); +} + + +PropertyRotation::PropertyRotation( QWidget* parent ) + : PropertyWidget( parent ) +{ + QLabel* label = new QLabel( i18n("&Rotation:"), this ); + comboRotation = new KComboBox( FALSE, this ); + label->setBuddy( comboRotation ); + + comboRotation->insertItem( i18n("0") ); + comboRotation->insertItem( i18n("90") ); + comboRotation->insertItem( i18n("180") ); + comboRotation->insertItem( i18n("270") ); + + grid->addWidget( label, 0, 0 ); + grid->addWidget( comboRotation, 0, 1 ); + +} + +void PropertyRotation::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + TextItem* text = static_cast(item); + double rot = 0.0; + + if( comboRotation->currentItem() == 1 ) + rot = 90.0; + else if( comboRotation->currentItem() == 2 ) + rot = 180.0; + else if( comboRotation->currentItem() == 3 ) + rot = 270.0; + + TextRotationCommand* rc = new TextRotationCommand( rot, text ); + rc->execute(); + command->addCommand( rc ); +} + +void PropertyRotation::initSettings( DocumentItem* item ) +{ + TextItem* text = static_cast(item); + + if( text->rotation() == 0.0 ) + comboRotation->setCurrentItem( 0 ); + else if( text->rotation() == 90.0 ) + comboRotation->setCurrentItem( 1 ); + else if( text->rotation() == 180.0 ) + comboRotation->setCurrentItem( 2 ); + else if( text->rotation() == 270.0 ) + comboRotation->setCurrentItem( 3 ); +} + +PropertyFill::PropertyFill( QWidget* parent ) + : PropertyWidget( parent ) +{ + buttonColor = new KColorButton( this ); + + grid->addWidget( new QLabel( i18n("Color:"), this ), 0, 0 ); + grid->addWidget( buttonColor, 0, 1 ); +} + +void PropertyFill::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + RectItem* rect = static_cast(item); + FillCommand* fc = new FillCommand( buttonColor->color(), rect ); + fc->execute(); + command->addCommand( fc ); +} + +void PropertyFill::initSettings( DocumentItem* item ) +{ + RectItem* rect = static_cast(item); + buttonColor->setColor( rect->color() ); +} + +PropertyBarcode::PropertyBarcode( TokenProvider* token, QWidget* parent ) + : PropertyWidget( parent ) +{ + QLabel* TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setText( i18n( "Barcode Settings:" ) ); + + comboComplex = new KComboBox( FALSE, this ); + if( SqlTables::isConnected() ) + { + QSqlQuery* query = new QSqlQuery("select encoding_type from barcode_basic group by encoding_type"); + while( query->next() ) + comboComplex->insertItem( "Main:" + query->value( 0 ).toString() ); + + delete query; + + query = new QSqlQuery("select customer_no, encoding_type from customer_text group by customer_no, encoding_type"); + while( query->next() ) + comboComplex->insertItem( query->value( 0 ).toString() + ":" + query->value( 1 ).toString() ); + delete query; + } + + comboComplex->insertItem( "Static" ); + + barcode = new BarcodeWidget( this, "barcode" ); + barcode->setTokenProvider( token ); + + //connect( this, SIGNAL( defaultClicked() ), this, SLOT( defaults() ) ); + connect( comboComplex, SIGNAL( activated(int) ), this, SLOT(changedCombo() ) ); + + grid->addWidget( TextLabel1, 0, 0 ); + grid->addWidget( comboComplex, 0, 1 ); + grid->addMultiCellWidget( barcode, 1, 1, 0, 1 ); + + changedCombo(); +} + +// void PropertyBarcode::defaults() +// { +// comboComplex->setCurrentItem( 0 ); +// barcode->defaults(); +// } + +void PropertyBarcode::changedCombo() +{ + bool v = false; + if( comboComplex->currentItem() == comboComplex->count() - 1 ) + v = true; + + barcode->setDataEnabled( v ); + barcode->setStandardEnabled( v ); +} + +void PropertyBarcode::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + BarcodeItem* bcode = static_cast(item); + + Barkode* d = new Barkode(); + barcode->getData( *d ); + + if( comboComplex->currentItem() != comboComplex->count() - 1 ) { + d->setType( getTypeFromCaption( comboComplex->currentText() ) ); + d->setValue( SqlTables::getInstance()->getBarcodeMaxLength( d->type() ) ); + } + d->setDatabaseMode( comboComplex->currentText() ); + + BarcodeCommand* bc = new BarcodeCommand( bcode, d ); + bc->execute(); + command->addCommand( bc ); +} + +void PropertyBarcode::initSettings( DocumentItem* item ) +{ + BarcodeItem* bcode = static_cast(item); + + barcode->setData( *bcode ); + for( int i = 0; i < comboComplex->count(); i++ ) + if( comboComplex->text( i ).lower() == bcode->databaseMode().lower() ) + comboComplex->setCurrentItem( i ); + + changedCombo(); +} + +PropertyText::PropertyText( TokenProvider* token, QWidget* parent ) + : PropertyWidget( parent ) +{ + m_editor = new MultiLineEditor( token, this, "m_editor" ); + grid->addWidget( m_editor, 0, 0 ); +} + +void PropertyText::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + TextItem* text = static_cast(item); + + TextChangeCommand* tc = new TextChangeCommand( text, m_editor->text() ); + tc->execute(); + command->addCommand( tc ); +} + +void PropertyText::initSettings( DocumentItem* item ) +{ + TextItem* text = static_cast(item); + m_editor->setText( text->text() ); +} + +//NY21 +PropertyTextLine::PropertyTextLine( TokenProvider* token, QWidget* parent ) + : PropertyWidget( parent ) +{ + m_editor = new TextLineEditor( token, this ); + grid->addWidget( m_editor, 0, 0 ); +} + +void PropertyTextLine::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + TextLineItem* text = static_cast(item); + + TextLineChangeCommand* tc = new TextLineChangeCommand( text, m_editor->text(), m_editor->getFontType(),m_editor->getVertMag(),m_editor->getHorMag() ); + tc->execute(); + command->addCommand( tc ); +} + +void PropertyTextLine::initSettings( DocumentItem* item ) +{ + TextLineItem* text = static_cast(item); + m_editor->setText( text->text() ); + m_editor->setFontType(text->getFont()); + m_editor->setHorMag(text->getMagHor()); + m_editor->setVertMag(text->getMagVert()); +} +//NY21 + +PropertySize::PropertySize( QWidget* parent ) + : PropertyWidget( parent ) +{ + const double low = -1000.0; + const double max = 1000.0; + QVBox* box = new QVBox( this ); + + checkLock = new QCheckBox( i18n("&Protect item from being moved or resized"), box ); + numTop = new KDoubleNumInput( low, max, 0.0, 0.2, 3, box ); + numLeft = new KDoubleNumInput( numTop, low, max, 0.0, 0.2, 3, box ); + numHeight = new KDoubleNumInput( numLeft, low, max, 0.0, 0.2, 3, box ); + numWidth = new KDoubleNumInput( numHeight, low, max, 0.0, 0.2, 3, box ); + + numTop->setSuffix( Measurements::system() ); + numLeft->setSuffix( Measurements::system() ); + numHeight->setSuffix( Measurements::system() ); + numWidth->setSuffix( Measurements::system() ); + + numTop->setLabel( i18n("&Top:"), AlignLeft | AlignCenter ); + numLeft->setLabel( i18n("&Left:"), AlignLeft | AlignCenter ); + numHeight->setLabel( i18n("&Height:"), AlignLeft | AlignCenter ); + numWidth->setLabel( i18n("&Width:"), AlignLeft | AlignCenter ); + + grid->addWidget( box, 0, 0 ); + + connect( checkLock, SIGNAL( clicked() ), this, SLOT( enableControls() )); +} + +void PropertySize::enableControls() +{ + numTop->setEnabled( !checkLock->isChecked() ); + numLeft->setEnabled( !checkLock->isChecked() ); + numHeight->setEnabled( !checkLock->isChecked() ); + numWidth->setEnabled( !checkLock->isChecked() ); +} + +void PropertySize::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + QRect r = item->rect(); + QPoint translation( 0, 0 ); + + TCanvasItem* canvasItem = item->canvasItem(); + if( canvasItem ) + { + MyCanvasView* view = canvasItem->canvasView(); + translation = view->getTranslation(); + } + + if( Measurements::measurementSystem() == Measurements::Metric ) + { + r.setX( (int)(numLeft->value() * 1000)); + r.setY( (int)(numTop->value() * 1000)); + r.setWidth( (int)(numWidth->value() * 1000)); + r.setHeight( (int)(numHeight->value() * 1000)); + } + else + { + /* This conversion from int to millimeter should get its own + * function or maybe even an own class. + */ + #warning "test inch to mm!" + r.setX( (int)(numLeft->value() * 1000 * 25.4000508001016 ) ); + r.setY( (int)(numTop->value() * 1000 * 25.4000508001016 ) ); + r.setWidth( (int)(numWidth->value() * 1000 * 25.4000508001016 ) ); + r.setHeight( (int)(numHeight->value() * 1000 * 25.4000508001016 ) ); + } + + if( canvasItem ) + { + if( item->rectMM().x() != r.x() || item->rectMM().y() != r.y() ) + { + MoveCommand* mc = new MoveCommand( r.x(), r.y(), canvasItem ); + mc->execute(); + command->addCommand( mc ); + } + + if( item->rectMM() != r ) + { + ResizeCommand* rc = new ResizeCommand( canvasItem, false ); + rc->setRect( r.x(), r.y(), r.width(), r.height() ); + rc->execute(); + command->addCommand( rc ); + } + + if( checkLock->isChecked() != item->locked() ) + { + LockCommand* lc = new LockCommand( checkLock->isChecked(), canvasItem ); + lc->execute(); + command->addCommand( lc ); + } + } +} + +void PropertySize::initSettings( DocumentItem* item ) +{ + QRect r = item->rectMM(); + QPoint translation( 0, 0 ); + + TCanvasItem* canvasItem = item->canvasItem(); + if( canvasItem ) + { + MyCanvasView* view = canvasItem->canvasView(); + translation = view->getTranslation(); + } + + if( Measurements::measurementSystem() == Measurements::Metric ) + { + numLeft->setValue( r.x() / 1000.0 ); + numTop->setValue( r.y() / 1000.0 ); + numWidth->setValue( r.width() / 1000.0 ); + numHeight->setValue( r.height() / 1000.0 ); + } + else // Imperial + { + numLeft->setValue( (r.x() / 1000.0) / 25.4000508001016 ); + numTop->setValue( (r.y() / 1000.0) / 25.4000508001016 ); + numWidth->setValue( (r.width() / 1000.0) / 25.4000508001016 ); + numHeight->setValue( (r.height() / 1000.0) / 25.4000508001016 ); + } + + checkLock->setChecked( item->locked() ); + enableControls(); +} + +PropertyImage::PropertyImage( TokenProvider* token, QWidget* parent ) + : PropertyWidget( parent ), m_token( token ) +{ + QLabel* label = new QLabel( i18n("&Rotation:"), this ); + comboRotation = new KComboBox( FALSE, this ); + label->setBuddy( comboRotation ); + + QVButtonGroup* groupFile = new QVButtonGroup( i18n("&Image"), this ); + radioImagePath = new QRadioButton( i18n("&Load image from path"), groupFile ); + imgUrl = new KURLRequester( groupFile ); + imgUrl->setFilter( KImageIO::pattern( KImageIO::Reading ) ); + imgUrl->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + radioImageExpression = new QRadioButton( i18n("&Read image path from expression"), groupFile ); + + imgHBox = new QHBox( groupFile ); + imgHBox->setSpacing( 5 ); + + imgExpression = new KLineEdit( imgHBox ); + buttonToken = new KPushButton( i18n("&Insert Data Field..."), imgHBox ); + buttonToken->setIconSet( QIconSet( SmallIcon("contents") ) ); + + comboRotation->insertItem( i18n("0") ); + comboRotation->insertItem( i18n("90") ); + comboRotation->insertItem( i18n("180") ); + comboRotation->insertItem( i18n("270") ); + + QVButtonGroup* group = new QVButtonGroup( i18n("&Size"), this ); + + radioOriginal = new QRadioButton( i18n("&None"), group ); + radioZoomed = new QRadioButton( i18n("&Zoom"), group ); + radioScaled = new QRadioButton( i18n("S&cale"), group ); + + checkMirrorH = new QCheckBox( i18n("Mirror &Horizontaly"), this ); + checkMirrorV = new QCheckBox( i18n("Mirror &Vertically"), this ); + + grid->addMultiCellWidget( groupFile, 0, 1, 0, 1 ); + grid->addMultiCellWidget( group, 2, 3, 0, 1 ); + grid->addWidget( label, 4, 0 ); + grid->addWidget( comboRotation, 4, 1 ); + grid->addMultiCellWidget( checkMirrorH, 5, 5, 0, 1 ); + grid->addMultiCellWidget( checkMirrorV, 6, 6, 0, 1 ); + + connect( radioImageExpression, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( radioImagePath, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); + connect( buttonToken, SIGNAL( clicked() ), this, SLOT( slotTokens() ) ); +} + +void PropertyImage::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + ImageItem* img = static_cast(item); + EImageScaling scaling = eImage_Original; + double rot = 0.0; + QPixmap pix; + + if( radioImagePath->isChecked() ) + { + if( !imgUrl->url().isEmpty() ) + { + if( !pix.load( imgUrl->url() ) ) + KMessageBox::error( NULL, QString( i18n("Image format not supported for file: %1") ).arg( imgUrl->url() ) ); + } + else + { + pix = img->pixmap(); + } + } + + if( radioZoomed->isChecked() ) + scaling = eImage_Zoomed; + else if( radioScaled->isChecked() ) + scaling = eImage_Scaled; + + if( comboRotation->currentItem() == 1 ) + rot = 90.0; + else if( comboRotation->currentItem() == 2 ) + rot = 180.0; + else if( comboRotation->currentItem() == 3 ) + rot = 270.0; + + PictureCommand* pc = new PictureCommand( rot, checkMirrorH->isChecked(), checkMirrorV->isChecked(), scaling, img ); + pc->setExpression( radioImageExpression->isChecked() ? imgExpression->text() : QString::null ); + pc->setPixmap( pix ); + pc->execute(); + command->addCommand( pc ); +} + +void PropertyImage::initSettings( DocumentItem* item ) +{ + ImageItem* img = static_cast(item); + QString expr = img->expression(); + + if( !expr.isEmpty() ) + { + radioImageExpression->setChecked( true ); + imgExpression->setText( expr ); + } + else + { + // imgUrl->setURL( IMAGE_INTERNAL ); + radioImagePath->setChecked( true ); + } + + switch( img->scaling() ) + { + default: + case eImage_Original: + radioOriginal->setChecked( true ); + break; + case eImage_Scaled: + radioScaled->setChecked( true ); + break; + case eImage_Zoomed: + radioZoomed->setChecked( true ); + break; + } + + if( img->rotation() == 0.0 ) + comboRotation->setCurrentItem( 0 ); + else if( img->rotation() == 90.0 ) + comboRotation->setCurrentItem( 1 ); + else if( img->rotation() == 180.0 ) + comboRotation->setCurrentItem( 2 ); + else if( img->rotation() == 270.0 ) + comboRotation->setCurrentItem( 3 ); + + checkMirrorH->setChecked( img->mirrorHorizontal() ); + checkMirrorV->setChecked( img->mirrorVertical() ); + + + enableControls(); +} + +void PropertyImage::enableControls() +{ + imgHBox->setEnabled( radioImageExpression->isChecked() ); + imgUrl->setEnabled( radioImagePath->isChecked() ); +} + +void PropertyImage::slotTokens() +{ + TokenDialog tokendlg( m_token, this, "tokendlg" ); + if( tokendlg.exec() == QDialog::Accepted ) + imgExpression->insert( tokendlg.token() ); +} + +PropertyVisible::PropertyVisible( QWidget* parent ) + : PropertyWidget( parent ) +{ + QLabel* label = new QLabel( i18n("Evaluate JavsScript code to define the visibility of this item:"), this ); + m_script = new KTextEdit( this ); + + grid->addWidget( label, 0, 0 ); + grid->addMultiCellWidget( m_script, 1, 8, 0, 2 ); +} + +void PropertyVisible::applySettings( DocumentItem* item, KMacroCommand* command ) +{ + TCanvasItem* canvasItem = item->canvasItem(); + ScriptCommand* sc = new ScriptCommand( m_script->text(), canvasItem ); + sc->execute(); + command->addCommand( sc); +} + +void PropertyVisible::initSettings( DocumentItem* item ) +{ + m_script->setText( item->visibilityScript() ); +} + +#include "propertywidget.moc" diff --git a/kbarcode/propertywidget.h b/kbarcode/propertywidget.h new file mode 100644 index 0000000..bc2ea78 --- /dev/null +++ b/kbarcode/propertywidget.h @@ -0,0 +1,210 @@ +/*************************************************************************** + propertywidget.h - description + ------------------- + begin : Do Sep 10 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef PROPERTYWIDGET_H +#define PROPERTYWIDGET_H + +#include +#include "labelutils.h" + +class BarcodeWidget; +class DocumentItem; +class KColorButton; +class KComboBox; +class KIntNumInput; +class KDoubleNumInput; +class KMacroCommand; +class KTextEdit; +class MultiLineEditor; +class QCheckBox; +class QGridLayout; +class QRadioButton; +//NY23 +class TextLineEditor; +//NY23 +class TokenProvider; + +class QHBox; +class KURLRequester; +class KLineEdit; +class KPushButton; + +/** +@author Dominik Seichter +*/ +class PropertyWidget : public QWidget +{ + Q_OBJECT + public: + PropertyWidget( QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ) = 0; + virtual void initSettings( DocumentItem* item ) = 0; + + protected: + QGridLayout* grid; +}; + +class PropertyBorder : public PropertyWidget { + Q_OBJECT + public: + PropertyBorder( QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private slots: + void enableControls(); + + private: + KColorButton* buttonColor; + KComboBox* comboLine; + KIntNumInput* spinWidth; + QCheckBox* checkBorder; +}; + +class PropertyRotation : public PropertyWidget { + Q_OBJECT + public: + PropertyRotation( QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private: + KComboBox* comboRotation; +}; + +class PropertyFill : public PropertyWidget { + Q_OBJECT + public: + PropertyFill( QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private: + KColorButton* buttonColor; +}; + +class PropertyBarcode : public PropertyWidget, private LabelUtils { + Q_OBJECT + public: + PropertyBarcode( TokenProvider* token, QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private slots: + void changedCombo(); + + private: + KComboBox* comboComplex; + BarcodeWidget* barcode; +}; + +class PropertyText : public PropertyWidget, private LabelUtils { + Q_OBJECT + public: + PropertyText( TokenProvider* token, QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private: + MultiLineEditor* m_editor; +}; + +//NY22 +class PropertyTextLine : public PropertyWidget, private LabelUtils { + Q_OBJECT + public: + PropertyTextLine( TokenProvider* token, QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private: + TextLineEditor* m_editor; +}; +//NY22 + +class PropertySize : public PropertyWidget, private LabelUtils { + Q_OBJECT + public: + PropertySize( QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private slots: + void enableControls(); + + private: + QCheckBox* checkLock; + KDoubleNumInput* numTop; + KDoubleNumInput* numLeft; + KDoubleNumInput* numWidth; + KDoubleNumInput* numHeight; +}; + +class PropertyImage : public PropertyWidget { + Q_OBJECT + public: + PropertyImage( TokenProvider* token, QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private slots: + void enableControls(); + void slotTokens(); + + private: + TokenProvider* m_token; + + QCheckBox* checkMirrorH; + QCheckBox* checkMirrorV; + + QHBox* imgHBox; + + KComboBox* comboRotation; + KURLRequester* imgUrl; + KLineEdit* imgExpression; + KPushButton* buttonToken; + + QRadioButton* radioImagePath; + QRadioButton* radioImageExpression; + + QRadioButton* radioOriginal; + QRadioButton* radioScaled; + QRadioButton* radioZoomed; +}; + +class PropertyVisible : public PropertyWidget { + Q_OBJECT + public: + PropertyVisible( QWidget* parent ); + + virtual void applySettings( DocumentItem* item, KMacroCommand* command ); + virtual void initSettings( DocumentItem* item ); + + private: + KTextEdit* m_script; +}; + +#endif diff --git a/kbarcode/purepostscript.cpp b/kbarcode/purepostscript.cpp new file mode 100644 index 0000000..0b543e6 --- /dev/null +++ b/kbarcode/purepostscript.cpp @@ -0,0 +1,240 @@ +/*************************************************************************** + purepostscript.cpp - description + ------------------- + begin : Mon Jan 2 2006 + copyright : (C) 2006 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "purepostscript.h" +#include "barkode.h" + +#include + +#include +#include +#include + +#include +#include + +#define MAX_LINE_LENGTH 256 +#define BEGIN_TEMPLATE "--BEGIN TEMPLATE--" +#define END_TEMPLATE "--END TEMPLATE--" + +QString PurePostscriptBarcode::s_path = QString::null; + +PurePostscriptOptions::PurePostscriptOptions() + : BarkodeEngineOptions() +{ + defaults(); +} + +const BarkodeEngineOptions& PurePostscriptOptions::operator=( const BarkodeEngineOptions& rhs ) +{ + const PurePostscriptOptions* ps = (dynamic_cast(&rhs)); + + m_check = ps->m_check; + + return *this; +} + +void PurePostscriptOptions::defaults() +{ + m_check = false; +} + +void PurePostscriptOptions::load( const QDomElement* tag ) +{ + m_check = (bool)tag->attribute( "pure.check", "0" ).toInt(); +} + +void PurePostscriptOptions::save( QDomElement* tag ) +{ + tag->setAttribute( "pure.check", (int)m_check ); +} + +PurePostscriptBarcode::PurePostscriptBarcode() + : PixmapBarcode() +{ + bool append = false; + QString line; + + if( s_path.isNull() ) + { + qDebug( "Cannot locate barcode writer in pure postscript." ); + return; + } + + QFile pureFile( s_path ); + if( pureFile.open( IO_ReadOnly ) ) + { + while( pureFile.readLine( line, MAX_LINE_LENGTH ) != -1 ) + { + if( append ) + { + if( line.contains( END_TEMPLATE ) ) + break; + + m_program.append( line ); + } + + if( !append && line.contains( BEGIN_TEMPLATE ) ) + append = true; + } + pureFile.close(); + } +} + +PurePostscriptBarcode::~PurePostscriptBarcode() +{ +} + +void PurePostscriptBarcode::init() +{ + if( s_path.isNull() ) + { + // first look at the default location + const char* default_barcode = "/usr/share/libpostscriptbarcode/barcode.ps"; + if( QFile::exists( default_barcode ) ) + s_path = default_barcode; + else + s_path = locate( "data", "kbarcode/barcode.ps" ); + } + + if( !QFile::exists( s_path ) ) + s_path = QString::null; +} + +#define START_TOKEN "% --" +#define BEGIN_ENCODER "BEGIN ENCODER " +#define DESCRIPTION "DESC: " +#define EXAMPLE "EXAM: " + +void PurePostscriptBarcode::initInfo( TBarcodeInfoList* info ) +{ + PurePostscriptBarcode::init(); + + QFile pureFile( s_path ); + if( pureFile.open( IO_ReadOnly ) ) + { + QString encoder; + QString description; + QString example; + QString line; + + while( pureFile.readLine( line, MAX_LINE_LENGTH ) != -1 ) + { + /* + % --BEGIN ENCODER ean13-- + % --DESC: EAN-13 + % --EXAM: 977147396801 + */ + + if( line.startsWith( START_TOKEN ) ) + { + // remove all whitespaces on the line ending (and '-') + line = line.stripWhiteSpace(); + + line = line.right( line.length() - QString( START_TOKEN ).length() ); + if( line.startsWith( BEGIN_ENCODER ) ) + { + encoder = line.right( line.length() - QString( BEGIN_ENCODER ).length() ); + + if( encoder.endsWith( "--" ) ) + encoder = encoder.left( encoder.length() - 2 ); + } + else if( line.startsWith( DESCRIPTION ) ) + description = line.right( line.length() - QString( DESCRIPTION ).length() ); + else if( line.startsWith( EXAMPLE ) ) + { + example = line.right( line.length() - QString( EXAMPLE ).length() ); + + // we should have a complete encoder now. + info->append( Barkode::createInfo( QString("ps_") + encoder, description, PURE_POSTSCRIPT, PUREADV | COLORED ) ); + } + } + } + pureFile.close(); + } +} + +bool PurePostscriptBarcode::hasPurePostscriptBarcode() +{ + return !s_path.isNull(); +} + +void PurePostscriptBarcode::createProgram( QString & prg ) +{ + const PurePostscriptOptions* options = (dynamic_cast(barkode->engine()->options())); + QString type = barkode->type().right( barkode->type().length() - 3 ); + QString opt; + + opt.sprintf( "%s %s barcolor=%02X%02X%02X showbackground backgroundcolor=%02X%02X%02X textcolor=%02X%02X%02X", + barkode->textVisible() ? "includetext" : "", + options && options->checksum() ? "includecheck" : "", + barkode->foreground().red(), barkode->foreground().green(), barkode->foreground().blue(), + barkode->background().red(), barkode->background().green(), barkode->background().blue(), + barkode->textColor().red(), barkode->textColor().green(), barkode->textColor().blue() + ); + + prg = "%!PS-Adobe-2.0 EPSF-2.0\n%%EndComments\n%%EndProlog\n"; + prg += m_program; + prg += QString("20 20 moveto\n(%1) (%2) %3 barcode\n") + .arg( barkode->parsedValue() ) + .arg( opt ).arg( type ); +} + +QRect PurePostscriptBarcode::bbox( const char* postscript, long postscript_size ) +{ + const char* gs_bbox = "gs -sDEVICE=bbox -sNOPAUSE -q %1 -c showpage quit 2>&1"; + + char* buffer = NULL; + long len = 0; + QRect size; + + KTempFile psfile( QString::null, ".ps" ); + psfile.file()->writeBlock( postscript, postscript_size ); + psfile.file()->close(); + + if( !readFromPipe( QString( gs_bbox ).arg( psfile.file()->name() ).latin1(), &buffer, &len ) || !len ) + { + psfile.unlink(); + return QRect( 0, 0, 0, 0 ); + } + else + psfile.unlink(); + + size = PixmapBarcode::bbox( buffer, len ); + free( buffer ); + + return size; +} + +bool PurePostscriptBarcode::createPostscript( char** postscript, long* postscript_size ) +{ + QString cmd; + + if( m_program.isEmpty() ) + return false; + + createProgram( cmd ); + + *postscript_size = cmd.length(); + *postscript = (char*)malloc( sizeof(char) * *postscript_size ); + if( !*postscript ) + return false; + + memcpy( *postscript, cmd.latin1(), *postscript_size ); + + return true; +} diff --git a/kbarcode/purepostscript.h b/kbarcode/purepostscript.h new file mode 100644 index 0000000..406fbc9 --- /dev/null +++ b/kbarcode/purepostscript.h @@ -0,0 +1,90 @@ +/*************************************************************************** + purepostscript.h - description + ------------------- + begin : Mon Jan 2 2006 + copyright : (C) 2006 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + + +#ifndef PURE_POSTSCRIPT_H +#define PURE_POSTSCRIPT_H + +#include "pixmapbarcode.h" +#include "barkode.h" + +#include + +class PurePostscriptOptions : public BarkodeEngineOptions { + public: + PurePostscriptOptions(); + + const BarkodeEngineOptions& operator=( const BarkodeEngineOptions & ps ); + void defaults(); + + void load( const QDomElement* tag ); + void save( QDomElement* tag ); + + inline bool checksum() const { return m_check; } + inline void setChecksum( bool b ) { m_check = b; } + + private: + bool m_check; +}; + +class PurePostscriptBarcode : public PixmapBarcode { + public: + PurePostscriptBarcode(); + ~PurePostscriptBarcode(); + + /** Initialize PurePostscriptBarcode and set the path to + * the postscript program file or to QString::null if it cannot be found + */ + static void init(); + + static void initInfo( TBarcodeInfoList* info ); + + static bool hasPurePostscriptBarcode(); + + inline EEngine engine() const; + + inline BarkodeEngineOptions* options(); + + private: + virtual bool createPostscript( char** postscript, long* postscript_size ); + virtual QRect bbox( const char* postscript, long postscript_size ); + + /** Create a program which can be executed by ghostscript from + * m_program and the barcodes data. + * \param prg the program will be written to this string + */ + void createProgram( QString & prg ); + + private: + PurePostscriptOptions m_options; + + QString m_program; + + static QString s_path; +}; + +EEngine PurePostscriptBarcode::engine() const +{ + return PURE_POSTSCRIPT; +} + +BarkodeEngineOptions* PurePostscriptBarcode::options() +{ + return &m_options; +} + +#endif /* PURE_POSTSCRIPT_H */ diff --git a/kbarcode/rectitem.cpp b/kbarcode/rectitem.cpp new file mode 100644 index 0000000..4fe2e84 --- /dev/null +++ b/kbarcode/rectitem.cpp @@ -0,0 +1,159 @@ +/*************************************************************************** + rectitem.cpp - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "rectitem.h" + +#include +#include + +RectItem::RectItem() + : DocumentItem() +{ + init(); +} + +void RectItem::loadXML (QDomElement* element) +{ + DocumentItem::loadXML( element ); + + m_color = readXMLColor( element, "fill-color", Qt::white ); + m_filled = element->attribute( "filled", "0" ).toInt(); + m_circle = element->attribute( "circle", "0" ).toInt(); +} + +void RectItem::saveXML (QDomElement* element) +{ + DocumentItem::saveXML( element ); + + writeXMLColor( element, "fill-color", m_color ); + element->setAttribute( "filled", m_filled ); + element->setAttribute( "circle", m_circle ); +} + +void RectItem::draw (QPainter* painter) +{ + if( m_circle ) + { + if( m_filled ) + { + painter->save(); + painter->setPen( QPen( Qt::NoPen ) ); + painter->setBrush( m_color ); + painter->drawEllipse( rect() ); + painter->restore(); + } + + if( border() ) + { + painter->save(); + painter->setPen( pen() ); + painter->drawEllipse( rect() ); + painter->restore(); + } + } + else + { + if( m_filled ) + painter->fillRect( rect(), m_color ); + + DocumentItem::drawBorder( painter ); + } +} + +void RectItem::drawZpl( QTextStream* stream ) +{ + // TODO: refactor later and respect millimeters + int thick = pen().width(); + + *stream << ZPLUtils::fieldOrigin( rect().x(), rect().y() ); + if( m_circle ) + *stream << QString("~GE%1,%2,%3,B").arg( rect().width() ).arg( rect().height() ).arg( thick ); + else + *stream << QString("~GB%1,%2,%3,B,0").arg( rect().width() ).arg( rect().height() ).arg( thick ); +} + +void RectItem::drawIpl( QTextStream* stream, IPLUtils* utils ) +{ + // TODO: refactor later and respect millimeters + int thick = pen().width(); + + if( m_circle ) + qDebug("Cirlce not implemented for IPL"); + else + { + int counter = utils->counter(); + + QString s = QString("W%1;").arg( counter ); // field number + + s += utils->fieldOrigin( rect().x(), rect().y() ); + s += QString("l%1;").arg( rect().width() ); // box length + s += QString("h%1;").arg( rect().height() ); // box height + s += QString("w%1;").arg( thick ); + + *stream << utils->field( s ); + } +} + +void RectItem::drawEPcl( QTextStream* stream ) +{ + QString s = QString("C %1").arg( rect().x()+1 ); + s += QString(" %1").arg( rect().y()+1 ); + s += QString(" %1").arg( rect().width() ); + s += QString(" %1").arg( rect().height() ); + s += QString(" %1 2").arg( pen().width() ); + + *stream << EPCLUtils::field( s ); +} + +void RectItem::init() +{ + m_color = Qt::white; + m_filled = true; + m_circle = false; + setRect( QRect( 0, 0, 20, 20 ) ); +} + +void RectItem::setColor (const QColor & c) +{ + m_color = c; +} + +QColor RectItem::color () const +{ + return m_color; +} + +void RectItem::setFilled (bool f) +{ + m_filled = f; +} + +bool RectItem::filled () const +{ + return m_filled; +} + +void RectItem::setCircle (bool b) +{ + m_circle = b; +} + +bool RectItem::circle () const +{ + return m_circle; +} + diff --git a/kbarcode/rectitem.h b/kbarcode/rectitem.h new file mode 100644 index 0000000..c820db2 --- /dev/null +++ b/kbarcode/rectitem.h @@ -0,0 +1,71 @@ +/*************************************************************************** + rectitem.h - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef RECTITEM_H +#define RECTITEM_H +#include +#include "documentitem.h" +#include "qcolor.h" + +/** + * Class RectItem + * A rectangle or elipse. + */ +class RectItem : public DocumentItem { +public: + RectItem ( ); + + int rtti() const { return eRtti_Rect; } + /** + * + * @param c + */ + void setColor (const QColor & c=Qt::black); + QColor color () const; + + + /** + * + * @param f + */ + void setFilled (bool f=true); + bool filled () const; + + /** + * + * @param b + */ + void setCircle (bool b=false); + bool circle () const; + + void loadXML (QDomElement* element); + void saveXML (QDomElement* element); + void draw (QPainter* painter); + void drawZpl( QTextStream* stream ); + void drawIpl( QTextStream* stream, IPLUtils* utils ); + void drawEPcl( QTextStream* stream ); + +private: + void init(); + +private: + bool m_circle; + bool m_filled; + QColor m_color; +}; +#endif //RECTITEM_H + diff --git a/kbarcode/rectsettingsdlg.cpp b/kbarcode/rectsettingsdlg.cpp new file mode 100644 index 0000000..7cb112a --- /dev/null +++ b/kbarcode/rectsettingsdlg.cpp @@ -0,0 +1,183 @@ +/*************************************************************************** + rectsettingsdlg.cpp - description + ------------------- + begin : Mit Jun 18 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "rectsettingsdlg.h" + +// Qt includes +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include + +void fillLineCombo( KComboBox* box ) +{ + /* A small helper function to fill + * a combobox with all by Qt + * supported pen styles. + */ + + QPainter p; + for( int i = 1; i < 6; i++ ) { + QPixmap pixmap( 60, 20 ); + pixmap.fill( Qt::white ); + p.begin( &pixmap ); + p.setPen( QPen( Qt::black, 3, (Qt::PenStyle)i ) ); + p.drawLine( 5, 10, 55, 10 ); + p.end(); + + box->insertItem( pixmap ); + } +} + +RectSettingsDlg::RectSettingsDlg(QWidget *parent, const char *name ) + : KDialogBase( KDialogBase::Plain, i18n("Settings"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent,name) +{ + QFrame* frame = plainPage(); + QGridLayout* grid = new QGridLayout( frame, 6, 6 ); + QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + + + buttonBorder = new KColorButton( frame ); + buttonFill = new KColorButton( frame ); + + spinWidth = new KIntNumInput( frame ); + spinWidth->setRange( 1, 100, 1, false ); + + comboLine = new KComboBox( false, frame ); + fillLineCombo( comboLine ); + + checkBorder = new QCheckBox( i18n("&Enable Border"), frame ); + + grid->addWidget( new QLabel( i18n("Fill Color:"), frame ), 0, 0 ); + grid->addWidget( buttonFill, 0, 1 ); + grid->addItem( spacer, 1, 0 ); + grid->addWidget( checkBorder, 2, 0 ); + grid->addWidget( new QLabel( i18n("Border Color:"), frame ), 3, 0 ); + grid->addWidget( buttonBorder, 3, 1 ); + grid->addWidget( new QLabel( i18n("Border Width:"), frame ), 4, 0 ); + grid->addWidget( spinWidth, 4, 1 ); + grid->addWidget( new QLabel( i18n("Line Style:"), frame ), 5, 0 ); + grid->addWidget( comboLine, 5, 1 ); + + connect( checkBorder, SIGNAL( clicked() ), this, SLOT( enableControls() ) ); +} + +RectSettingsDlg::~RectSettingsDlg() +{ +} + +void RectSettingsDlg::enableControls() +{ + buttonBorder->setEnabled( checkBorder->isChecked() ); + spinWidth->setEnabled( checkBorder->isChecked() ); + comboLine->setEnabled( checkBorder->isChecked() ); +} + +void RectSettingsDlg::setBorderColor( const QColor & c ) +{ + buttonBorder->setColor( c ); +} + +void RectSettingsDlg::setFillColor( const QColor & c ) +{ + buttonFill->setColor( c ); +} + +void RectSettingsDlg::setBorderWidth( int w ) +{ + spinWidth->setValue( w ); +} + +void RectSettingsDlg::setPenStyle( int s ) +{ + if( s ) { + comboLine->setCurrentItem( s - 1 ); + checkBorder->setChecked( true ); + } else + checkBorder->setChecked( false ); + + enableControls(); +} + +const QColor RectSettingsDlg::borderColor() const +{ + return buttonBorder->color(); +} + +const QColor RectSettingsDlg::fillColor() const +{ + return buttonFill->color(); +} + +int RectSettingsDlg::borderWidth() const +{ + return spinWidth->value(); +} + +int RectSettingsDlg::penStyle() const +{ + return checkBorder->isChecked() ? comboLine->currentItem() + 1 : 0; +} + +LineSettingsDlg::LineSettingsDlg(QWidget *parent, const char *name ) + : KDialogBase( KDialogBase::Plain, i18n("Settings"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent,name) +{ + QFrame* frame = plainPage(); + QGridLayout* grid = new QGridLayout( frame, 6, 6 ); + + buttonColor = new KColorButton( frame ); + + spinWidth = new KIntNumInput( frame ); + spinWidth->setRange( 1, 100, 1, false ); + + comboLine = new KComboBox( false, frame ); + fillLineCombo( comboLine ); + + grid->addWidget( new QLabel( i18n("Color:"), frame ), 0, 0 ); + grid->addWidget( buttonColor, 0, 1 ); + grid->addWidget( new QLabel( i18n("Line Width:"), frame ), 1, 0 ); + grid->addWidget( spinWidth, 1, 1 ); + grid->addWidget( new QLabel( i18n("Line Style:"), frame ), 2, 0 ); + grid->addWidget( comboLine, 2, 1 ); +} + +LineSettingsDlg::~LineSettingsDlg() +{ +} + +QPen LineSettingsDlg::pen() const +{ + return QPen( buttonColor->color(), spinWidth->value(), (Qt::PenStyle)(comboLine->currentItem() + 1) ); +} + +void LineSettingsDlg::setPen( const QPen p ) +{ + buttonColor->setColor( p.color() ); + spinWidth->setValue( p.width() ); + comboLine->setCurrentItem( p.style() - 1 ); +} + +#include "rectsettingsdlg.moc" diff --git a/kbarcode/rectsettingsdlg.h b/kbarcode/rectsettingsdlg.h new file mode 100644 index 0000000..5bcd5f4 --- /dev/null +++ b/kbarcode/rectsettingsdlg.h @@ -0,0 +1,71 @@ +/*************************************************************************** + rectsettingsdlg.h - description + ------------------- + begin : Mit Jun 18 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef RECTSETTINGSDLG_H +#define RECTSETTINGSDLG_H + +#include + +class KColorButton; +class KComboBox; +class KIntNumInput; +class QCheckBox; +class RectSettingsDlg : public KDialogBase { + Q_OBJECT + public: + RectSettingsDlg(QWidget *parent=0, const char *name=0); + ~RectSettingsDlg(); + + void setBorderColor( const QColor & c ); + void setFillColor( const QColor & c ); + void setBorderWidth( int w ); + void setPenStyle( int s ); + + const QColor borderColor() const; + const QColor fillColor() const; + int borderWidth() const; + int penStyle() const; + + private slots: + void enableControls(); + + private: + KColorButton* buttonBorder; + KColorButton* buttonFill; + + KComboBox* comboLine; + QCheckBox* checkBorder; + + KIntNumInput* spinWidth; +}; + +class QPen; +class LineSettingsDlg : public KDialogBase { + Q_OBJECT + public: + LineSettingsDlg(QWidget *parent=0, const char *name=0); + ~LineSettingsDlg(); + + void setPen( const QPen p ); + QPen pen() const; + + private: + KColorButton* buttonColor; + KComboBox* comboLine; + KIntNumInput* spinWidth; +}; +#endif diff --git a/kbarcode/referencecounted.cpp b/kbarcode/referencecounted.cpp new file mode 100644 index 0000000..8759ffc --- /dev/null +++ b/kbarcode/referencecounted.cpp @@ -0,0 +1,23 @@ + +/*************************************************************************** + referencecounted.cpp - description + ------------------- + begin : Mo Apr 18 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "referencecounted.h" + + + + diff --git a/kbarcode/referencecounted.h b/kbarcode/referencecounted.h new file mode 100644 index 0000000..684cd21 --- /dev/null +++ b/kbarcode/referencecounted.h @@ -0,0 +1,64 @@ +/*************************************************************************** + referencecounted.h - description + ------------------- + begin : Mo Apr 18 2005 + copyright : (C) 2005 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#ifndef REFERENCE_COUNTED_H +#define REFERENCE_COUNTED_H + +/** + * A class to make objects reference counted. + * Most likely you will want to subclass this class. + * @see TCanvasItem for an example. + * + * Whenever you get a reference to a ReferenceCounted + * object, call addRef(). Whenever you do not need + * the object anymore, call remRef(). + * + * When the reference count reaches 0, the object + * deletes itself. + */ + + +class ReferenceCounted { + public: + ReferenceCounted():m_counter(0) {} + virtual ~ReferenceCounted() {} + + inline void addRef() + { + m_counter++; + } + + + inline void remRef() + { + if(--m_counter == 0) delete this; + } + + + inline unsigned int refCount() + { + return m_counter; + } + + private: + unsigned int m_counter; + +}; + +#endif // REFERENCE_COUNTED_H + + diff --git a/kbarcode/rules.xml b/kbarcode/rules.xml new file mode 100644 index 0000000..0c75828 --- /dev/null +++ b/kbarcode/rules.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^\_\`abcdefghijklmnopqrstuvwxyz\{\|\}\~] +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kbarcode/semantic.cache b/kbarcode/semantic.cache new file mode 100644 index 0000000..4e667be --- /dev/null +++ b/kbarcode/semantic.cache @@ -0,0 +1,39 @@ +;; Object kbarcode/ +;; SEMANTICDB Tags save file +(semanticdb-project-database-file "kbarcode/" + :tables (list + (semanticdb-table "barkode.cpp" + :major-mode 'c++-mode + :tags '(("barkode.h" include nil nil [830 850]) ("barkodeengine.h" include nil nil [851 877]) ("gnubarcode.h" include nil nil [878 901]) ("pixmapbarcode.h" include nil nil [902 928]) ("purepostscript.h" include nil nil [929 956]) ("tbarcode2.h" include nil nil [957 979]) ("tokenprovider.h" include nil nil [980 1006]) ("barcode.h" include (:system-flag t) nil [1042 1064]) ("BARCODE_DEFAULT_FLAGS" variable (:constant-flag t :default-value (nil)) nil [1071 1111]) ("BARCODE_ENCODING_MASK" variable (:constant-flag t :default-value (nil)) nil [1113 1153]) ("BARCODE_NO_ASCII" variable (:constant-flag t :default-value (nil)) nil [1182 1222]) ("BARCODE_NO_CHECKSUM" variable (:constant-flag t :default-value (nil)) nil [1252 1292]) ("BARCODE_OUTPUT_MASK" variable (:constant-flag t :default-value (nil)) nil [1327 1367]) ("BARCODE_OUT_EPS" variable (:constant-flag t :default-value (nil)) nil [1393 1433]) ("BARCODE_OUT_PS" variable (:constant-flag t :default-value (nil)) nil [1434 1474]) ("BARCODE_OUT_PCL" variable (:constant-flag t :default-value (nil)) nil [1475 1515]) ("BARCODE_OUT_PCL_III" variable (:constant-flag t :default-value (nil)) nil [1588 1628]) ("BARCODE_OUT_NOHEADERS" variable (:constant-flag t :default-value (nil)) nil [1629 1669]) ("" type (:members (("BARCODE_ANY" variable (:constant-flag t :default-value (1767 1768) :type "int") (reparse-symbol enumsubparts) [1753 1768]) ("BARCODE_EAN" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1800 1812]) ("BARCODE_UPC" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1817 1829]) ("BARCODE_ISBN" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1867 1880]) ("BARCODE_39" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1924 1935]) ("BARCODE_128" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1962 1974]) ("BARCODE_128C" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2024 2037]) ("BARCODE_128B" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2089 2102]) ("BARCODE_I25" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2150 2162]) ("BARCODE_128RAW" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2213 2228]) ("BARCODE_CBR" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2280 2292]) ("BARCODE_MSI" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2342 2354]) ("BARCODE_PLS" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2400 2412]) ("BARCODE_93" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2462 2519])) :type "enum") nil [1742 2520]) ("qdom.h" include (:system-flag t) nil [2559 2576]) ("qfile.h" include (:system-flag t) nil [2577 2595]) ("qpainter.h" include (:system-flag t) nil [2596 2617]) ("qpicture.h" include (:system-flag t) nil [2618 2639]) ("qpixmap.h" include (:system-flag t) nil [2640 2660]) ("qsize.h" include (:system-flag t) nil [2661 2679]) ("klocale.h" include (:system-flag t) nil [2681 2701]) ("kstandarddirs.h" include (:system-flag t) nil [2702 2728]) ("Barkode::s_info" variable (:type ("QValueList" type (:type "class") nil nil)) nil [2730 2771]) ("Barkode::s_encoding" variable (:pointer 1 :default-value "NULL;" :type ("QStringList" type (:type "class") nil nil)) nil [2772 2814]) ("Barkode::s_haveGnuBarcode" variable (:default-value "false;" :type ("bool" type (:type "class") nil nil)) nil [2815 2858]) ("Barkode::s_havePdfEncode" variable (:default-value "false;" :type ("bool" type (:type "class") nil nil)) nil [2859 2902]) ("Barkode::s_haveTBarcode" variable (:default-value "false;" :type ("bool" type (:type "class") nil nil)) nil [2903 2946]) ("Barkode::s_haveTBarcode2" variable (:default-value "false;" :type ("bool" type (:type "class") nil nil)) nil [2947 2990]) ("Barkode::s_havePurePostscript" variable (:default-value "false;" :type ("bool" type (:type "class") nil nil)) nil [2991 3034]) ("Barkode" function (:constructor-flag t :parent "Barkode" :type ("Barkode" type "class")) nil [3036 3136]) ("Barkode" function (:constructor-flag t :parent "Barkode" :arguments (("barkode" variable (:constant-flag t :type ("Barkode" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3156 3181])) :type ("Barkode" type "class")) nil [3138 3268]) ("Barkode" function (:destructor-flag t :parent "Barkode" :type "void") nil [3270 3337]) ("setTokenProvider" function (:parent "Barkode" :arguments (("token" variable (:pointer 1 :type ("TokenProvider" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3371 3393])) :type "void") nil [3339 3418]) ("defaults" function (:parent "Barkode" :type "void") nil [3420 4097]) ("setData" function (:parent "Barkode" :arguments (("barkode" variable (:constant-flag t :type ("Barkode" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4122 4147])) :type "void") nil [4099 5122]) ("==" function (:parent "Barkode" :arguments (("barkode" variable (:constant-flag t :type ("Barkode" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5230 5255])) :type ("bool" type (:type "class") nil nil)) nil [5204 5723]) ("picture" function (:parent "Barkode" :constant-flag t :type ("QPicture" type (:type "class") nil nil)) nil [5725 5973]) ("drawInvalid" function (:parent "Barkode" :arguments (("painter" variable (:type ("QPainter" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6002 6021]) ("x" variable (:type "int") (reparse-symbol arg-sub-list) [6022 6028]) ("y" variable (:type "int") (reparse-symbol arg-sub-list) [6029 6036])) :type "void") nil [5975 6395]) ("size" function (:parent "Barkode" :constant-flag t :type ("QSize" type (:type "class") nil nil)) nil [6397 6490]) ("pixmap" function (:parent "Barkode" :constant-flag t :arguments (("scalex" variable (:type "double") (reparse-symbol arg-sub-list) [6523 6537]) ("scaley" variable (:type "double") (reparse-symbol arg-sub-list) [6538 6553])) :type ("QPixmap" type (:type "class") nil nil)) nil [6492 6898]) ("parsedValue" function (:parent "Barkode" :constant-flag t :type ("QString" type (:type "class") nil nil)) nil [6900 8603]) ("engineForType" function (:parent "Barkode" :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8637 8659])) :type ("EEngine" type (:type "class") nil nil)) nil [8605 8877]) ("updateEngine" function (:parent "Barkode" :type "void") nil [8879 9790]) ("drawBarcode" function (:parent "Barkode" :arguments (("painter" variable (:type ("QPainter" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9820 9839]) ("x" variable (:type "int") (reparse-symbol arg-sub-list) [9840 9846]) ("y" variable (:type "int") (reparse-symbol arg-sub-list) [9847 9854])) :type "void") nil [9792 9927]) ("update" function (:parent "Barkode" :arguments (("device" variable (:pointer 1 :constant-flag t :type ("QPaintDevice" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9951 9979])) :type "void") nil [9929 10038]) ("isValid" function (:parent "Barkode" :type ("bool" type (:type "class") nil nil)) nil [10224 10277]) ("background" function (:parent "Barkode" :constant-flag t :type ("QColor" type (:type "class") nil nil)) nil [10279 10350]) ("foreground" function (:parent "Barkode" :constant-flag t :type ("QColor" type (:type "class") nil nil)) nil [10352 10423]) ("textColor" function (:parent "Barkode" :constant-flag t :type ("QColor" type (:type "class") nil nil)) nil [10425 10494]) ("fontsize" function (:parent "Barkode" :constant-flag t :type "unsigned int") nil [10496 10567]) ("quietZone" function (:parent "Barkode" :constant-flag t :type "unsigned int") nil [10569 10642]) ("barHeight" function (:parent "Barkode" :constant-flag t :type "unsigned int") nil [10644 10718]) ("type" function (:parent "Barkode" :constant-flag t :type ("QString" type (:type "class") nil nil)) nil [10720 10780]) ("value" function (:parent "Barkode" :constant-flag t :type ("QString" type (:type "class") nil nil)) nil [10782 10844]) ("index" function (:parent "Barkode" :constant-flag t :type "unsigned int") nil [10846 10911]) ("sequenceEnabled" function (:parent "Barkode" :constant-flag t :type ("bool" type (:type "class") nil nil)) nil [10913 10983]) ("sequenceMode" function (:parent "Barkode" :constant-flag t :type ("ESequence" type (:type "class") nil nil)) nil [10985 11058]) ("sequenceStart" function (:parent "Barkode" :constant-flag t :type "int") nil [11060 11133]) ("sequenceStep" function (:parent "Barkode" :constant-flag t :type "int") nil [11135 11206]) ("databaseMode" function (:parent "Barkode" :constant-flag t :type ("QString" type (:type "class") nil nil)) nil [11208 11285]) ("textVisible" function (:parent "Barkode" :constant-flag t :type ("bool" type (:type "class") nil nil)) nil [11287 11357]) ("rotation" function (:parent "Barkode" :constant-flag t :type "int") nil [11359 11421]) ("scaling" function (:parent "Barkode" :constant-flag t :type "double") nil [11423 11486]) ("cut" function (:parent "Barkode" :constant-flag t :type "double") nil [11488 11543]) ("datamatrixSize" function (:parent "Barkode" :constant-flag t :type "int") nil [11545 11620]) ("setBackground" function (:parent "Barkode" :arguments (("c" variable (:constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11835 11853])) :type "void") nil [11806 11879]) ("setForeground" function (:parent "Barkode" :arguments (("c" variable (:constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11910 11928])) :type "void") nil [11881 11954]) ("setTextColor" function (:parent "Barkode" :arguments (("c" variable (:constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11984 12002])) :type "void") nil [11956 12027]) ("setFontsize" function (:parent "Barkode" :arguments (("f" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [12056 12072])) :type "void") nil [12029 12096]) ("setQuietZone" function (:parent "Barkode" :arguments (("q" variable (:constant-flag t :type "unsigned int") (reparse-symbol arg-sub-list) [12126 12148])) :type "void") nil [12098 12173]) ("setBarHeight" function (:parent "Barkode" :arguments (("h" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [12203 12219])) :type "void") nil [12175 12245]) ("setType" function (:parent "Barkode" :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12270 12292])) :type "void") nil [12247 12343]) ("setValue" function (:parent "Barkode" :arguments (("value" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12369 12392])) :type "void") nil [12345 12417]) ("setIndex" function (:parent "Barkode" :arguments (("i" variable (:constant-flag t :type "unsigned int") (reparse-symbol arg-sub-list) [12443 12465])) :type "void") nil [12419 12486]) ("setSequenceEnabled" function (:parent "Barkode" :arguments (("b" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12522 12530])) :type "void") nil [12488 12554]) ("setSequenceMode" function (:parent "Barkode" :arguments (("e" variable (:type ("ESequence" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12587 12600])) :type "void") nil [12556 12625]) ("setSequenceStart" function (:parent "Barkode" :arguments (("s" variable (:type "int") (reparse-symbol arg-sub-list) [12659 12666])) :type "void") nil [12627 12696]) ("setSequenceStep" function (:parent "Barkode" :arguments (("s" variable (:type "int") (reparse-symbol arg-sub-list) [12729 12736])) :type "void") nil [12698 12765]) ("setDatabaseMode" function (:parent "Barkode" :arguments (("mode" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12798 12820])) :type "void") nil [12767 12852]) ("setTextVisible" function (:parent "Barkode" :arguments (("b" variable (:constant-flag t :type ("bool" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12884 12898])) :type "void") nil [12854 12926]) ("setRotation" function (:parent "Barkode" :arguments (("r" variable (:constant-flag t :type "int") (reparse-symbol arg-sub-list) [12955 12968])) :type "void") nil [12928 12992]) ("setScaling" function (:parent "Barkode" :arguments (("d" variable (:constant-flag t :type "double") (reparse-symbol arg-sub-list) [13020 13036])) :type "void") nil [12994 13059]) ("setCut" function (:parent "Barkode" :arguments (("c" variable (:constant-flag t :type "double") (reparse-symbol arg-sub-list) [13083 13099])) :type "void") nil [13061 13118]) ("setDatamatrixSize" function (:parent "Barkode" :arguments (("s" variable (:type "int") (reparse-symbol arg-sub-list) [13153 13160])) :type "void") nil [13120 13191]) ("hasFeature" function (:parent "Barkode" :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13371 13392]) ("feature" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [13393 13415])) :type ("bool" type (:type "class") nil nil)) nil [13345 13603]) ("internalType" function (:parent "Barkode" :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13632 13654])) :type "int") nil [13605 13819]) ("encodingTypes" function (:pointer 1 :parent "Barkode" :constant-flag t :type ("QStringList" type (:type "class") nil nil)) nil [13821 14107]) ("typeFromName" function (:pointer 1 :parent "Barkode" :constant-flag t :arguments (("name" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14144 14166])) :type "char") nil [14109 14326]) ("nameFromType" function (:pointer 1 :parent "Barkode" :constant-flag t :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14363 14385])) :type "char") nil [14328 14545]) ("validatorFromType" function (:pointer 1 :parent "Barkode" :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14584 14606])) :type ("QString" type (:type "class") nil nil)) nil [14547 14762]) ("validatorNotFromType" function (:pointer 1 :parent "Barkode" :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14804 14826])) :type ("QString" type (:type "class") nil nil)) nil [14764 14985]) ("createInfo" function (:parent "Barkode" :arguments (("xml" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [15021 15037]) ("name" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [15038 15059]) ("engine" variable (:constant-flag t :type ("EEngine" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [15060 15081]) ("features" variable (:constant-flag t :type "unsigned int") (reparse-symbol arg-sub-list) [15115 15143]) ("internal" variable (:constant-flag t :type "int") (reparse-symbol arg-sub-list) [15144 15164])) :type ("tBarcodeInfo" type (:type "class") nil nil)) nil [14987 16059]) ("initInfo" function (:parent "Barkode" :type "void") nil [16061 35789]) ("initValidators" function (:parent "Barkode" :type "void") nil [35791 37608])) + :file "barkode.cpp" + :pointmax 37610 + ) + (semanticdb-table "purepostscript.cpp" + :major-mode 'c++-mode + :tags '(("purepostscript.h" include nil nil [1029 1056]) ("barkode.h" include nil nil [1057 1077]) ("stdlib.h" include (:system-flag t) nil [1079 1098]) ("qdom.h" include (:system-flag t) nil [1100 1117]) ("qfile.h" include (:system-flag t) nil [1118 1136]) ("qtextstream.h" include (:system-flag t) nil [1137 1161]) ("kstandarddirs.h" include (:system-flag t) nil [1163 1189]) ("ktempfile.h" include (:system-flag t) nil [1190 1212]) ("MAX_LINE_LENGTH" variable (:constant-flag t :default-value (nil)) nil [1214 1241]) ("BEGIN_TEMPLATE" variable (:constant-flag t :default-value (nil)) nil [1242 1285]) ("END_TEMPLATE" variable (:constant-flag t :default-value (nil)) nil [1286 1325]) ("PurePostscriptBarcode::s_path" variable (:default-value "QString::null;" :type ("QString" type (:type "class") nil nil)) nil [1327 1381]) ("PurePostscriptOptions" function (:constructor-flag t :parent "PurePostscriptOptions" :type ("PurePostscriptOptions" type "class")) nil [1383 1478]) ("defaults" function (:parent "PurePostscriptOptions" :type "void") nil [1718 1781]) ("load" function (:parent "PurePostscriptOptions" :arguments (("tag" variable (:pointer 1 :constant-flag t :type ("QDomElement" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1817 1841])) :type "void") nil [1783 1910]) ("save" function (:parent "PurePostscriptOptions" :arguments (("tag" variable (:pointer 1 :type ("QDomElement" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1946 1964])) :type "void") nil [1912 2021]) ("PurePostscriptBarcode" function (:constructor-flag t :parent "PurePostscriptBarcode" :type ("PurePostscriptBarcode" type "class")) nil [2023 2746]) ("PurePostscriptBarcode" function (:destructor-flag t :parent "PurePostscriptBarcode" :type "void") nil [2748 2799]) ("init" function (:parent "PurePostscriptBarcode" :type "void") nil [2801 3235]) ("START_TOKEN" variable (:constant-flag t :default-value (nil)) nil [3237 3263]) ("BEGIN_ENCODER" variable (:constant-flag t :default-value (nil)) nil [3264 3302]) ("DESCRIPTION" variable (:constant-flag t :default-value (nil)) nil [3303 3331]) ("EXAMPLE" variable (:constant-flag t :default-value (nil)) nil [3332 3356]) ("initInfo" function (:parent "PurePostscriptBarcode" :arguments (("info" variable (:pointer 1 :type ("TBarcodeInfoList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3396 3420])) :type "void") nil [3358 5039]) ("hasPurePostscriptBarcode" function (:parent "PurePostscriptBarcode" :type ("bool" type (:type "class") nil nil)) nil [5041 5128]) ("createProgram" function (:parent "PurePostscriptBarcode" :arguments (("prg" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5173 5188])) :type "void") nil [5130 6215]) ("bbox" function (:parent "PurePostscriptBarcode" :arguments (("postscript" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [6252 6275]) ("postscript_size" variable (:type "long") (reparse-symbol arg-sub-list) [6276 6298])) :type ("QRect" type (:type "class") nil nil)) nil [6217 6895]) ("createPostscript" function (:parent "PurePostscriptBarcode" :arguments (("postscript" variable (:pointer 2 :type "char") (reparse-symbol arg-sub-list) [6943 6961]) ("postscript_size" variable (:pointer 1 :type "long") (reparse-symbol arg-sub-list) [6962 6985])) :type ("bool" type (:type "class") nil nil)) nil [6897 7316])) + :file "purepostscript.cpp" + :pointmax 7317 + ) + (semanticdb-table "barkode.h" + :major-mode 'c-mode + :tags '(("BARKODE_H" variable (:constant-flag t) nil [889 910]) ("qcolor.h" include (:system-flag t) nil [909 928]) ("qstring.h" include (:system-flag t) nil [929 949]) ("barkodeengine.h" include nil nil [951 977]) ("ESequence" type (:typedef (nil type (:members (("NUM" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1045 1049]) ("ALPHA" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1050 1056]) ("ALPHANUM" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1057 1067])) :type "enum") nil nil) :type "typedef") nil [1030 1078]) ("" type (:members (("NOCUT" variable (:constant-flag t :default-value (1193 1200) :type "int") (reparse-symbol enumsubparts) [1185 1200]) ("MULTILINE" variable (:constant-flag t :default-value (1214 1221) :type "int") (reparse-symbol enumsubparts) [1202 1221]) ("NOTEXT" variable (:constant-flag t :default-value (1232 1239) :type "int") (reparse-symbol enumsubparts) [1223 1239]) ("NOSCALE" variable (:constant-flag t :default-value (1251 1258) :type "int") (reparse-symbol enumsubparts) [1241 1258]) ("PDF417BARCODE" variable (:constant-flag t :default-value (1350 1357) :type "int") (reparse-symbol enumsubparts) [1334 1357]) ("TBARCODEADV" variable (:constant-flag t :default-value (1373 1380) :type "int") (reparse-symbol enumsubparts) [1359 1380]) ("PUREADV" variable (:constant-flag t :default-value (1392 1399) :type "int") (reparse-symbol enumsubparts) [1382 1399]) ("DATAMATRIX" variable (:constant-flag t :default-value (1414 1421) :type "int") (reparse-symbol enumsubparts) [1401 1421]) ("COLORED" variable (:constant-flag t :default-value (1441 1448) :type "int") (reparse-symbol enumsubparts) [1431 1448]) ("POSTNETCHECK" variable (:constant-flag t :default-value (1521 1528) :type "int") (reparse-symbol enumsubparts) [1506 1528]) ("CODE128CHECK" variable (:constant-flag t :default-value (1545 1552) :type "int") (reparse-symbol enumsubparts) [1530 1552]) ("EAN8CHECK" variable (:constant-flag t :default-value (1566 1573) :type "int") (reparse-symbol enumsubparts) [1554 1573]) ("EAN13CHECK" variable (:constant-flag t :default-value (1588 1595) :type "int") (reparse-symbol enumsubparts) [1575 1595]) ("UPCACHECK" variable (:constant-flag t :default-value (1616 1623) :type "int") (reparse-symbol enumsubparts) [1604 1623]) ("UPCECHECK" variable (:constant-flag t :default-value (1637 1644) :type "int") (reparse-symbol enumsubparts) [1625 1644]) ("MODULOALLCHECK" variable (:constant-flag t :default-value (1663 1670) :type "int") (reparse-symbol enumsubparts) [1646 1670]) ("MODULO10CHECK" variable (:constant-flag t :default-value (1688 1695) :type "int") (reparse-symbol enumsubparts) [1672 1695]) ("BARCODE2D" variable (:constant-flag t :default-value (1764 1771) :type "int") (reparse-symbol enumsubparts) [1751 1771]) ("MULTILINE" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1772 1783]) ("NOTEXT" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [1784 1792])) :type "enum") nil [1178 1793]) ("tBarcodeInfo" type (:members (("xml" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2053 2065]) ("name" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2125 2138]) ("engine" variable (:type ("EEngine" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2186 2201]) ("features" variable (:type "unsigned int") (reparse-symbol classsubparts) [2270 2292]) ("internal" variable (:type "int") (reparse-symbol classsubparts) [2363 2376]) ("validator" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2468 2486]) ("validatorNot" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2491 2512])) :type "struct") nil [1888 2515]) ("TBarcodeInfoList" type (:typedef ("QValueList" type (:type "class") nil nil) :superclasses "QValueList" :type "typedef") nil [2517 2567]) ("BarkodeEngine" type (:type "class") nil [2569 2589]) ("QPainter" type (:type "class") nil [2590 2605]) ("QPicture" type (:type "class") nil [2606 2621]) ("QSize" type (:type "class") nil [2622 2634]) ("QPaintDevice" type (:type "class") nil [2635 2654]) ("TokenProvider" type (:type "class") nil [2655 2675]) ("Barkode" type (:members (("public" label nil (reparse-symbol classsubparts) [2694 2701]) ("Barkode" function (:prototype-flag t :constructor-flag t :type ("Barkode" type "class")) (reparse-symbol classsubparts) [2706 2716]) ("Barkode" function (:prototype-flag t :constructor-flag t :arguments (("barkode" variable (:constant-flag t :type ("Barkode" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2730 2755])) :type ("Barkode" type "class")) (reparse-symbol classsubparts) [2721 2756]) ("Barkode" function (:prototype-flag t :destructor-flag t :typemodifiers ("virtual") :type "void") (reparse-symbol classsubparts) [2761 2780]) ("setTokenProvider" function (:prototype-flag t :arguments (("token" variable (:pointer 1 :type ("TokenProvider" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2869 2891])) :type "void") (reparse-symbol classsubparts) [2846 2892]) ("defaults" function (:prototype-flag t :type "void") (reparse-symbol classsubparts) [2939 2955]) ("update" function (:prototype-flag t :arguments (("device" variable (:pointer 1 :constant-flag t :type ("QPaintDevice" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3079 3107])) :type "void") (reparse-symbol classsubparts) [3066 3108]) ("parsedValue" function (:prototype-flag t :constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3217 3245]) ("pixmap" function (:prototype-flag t :constant-flag t :arguments (("scalex" variable (:default-value "1.0" :type "double") (reparse-symbol arg-sub-list) [3274 3293]) ("scaley" variable (:default-value "1.0" :type "double") (reparse-symbol arg-sub-list) [3295 3314])) :type ("QPixmap" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3252 3317]) ("picture" function (:prototype-flag t :constant-flag t :type ("QPicture" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3322 3347]) ("size" function (:prototype-flag t :constant-flag t :type ("QSize" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3352 3377]) ("isValid" function (:prototype-flag t :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3382 3403]) ("background" function (:prototype-flag t :constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3409 3443]) ("foreground" function (:prototype-flag t :constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3448 3482]) ("textColor" function (:prototype-flag t :constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3487 3520]) ("fontsize" function (:prototype-flag t :constant-flag t :type "unsigned int") (reparse-symbol classsubparts) [3525 3561]) ("quietZone" function (:prototype-flag t :constant-flag t :type "unsigned int") (reparse-symbol classsubparts) [3566 3603]) ("barHeight" function (:prototype-flag t :constant-flag t :type "unsigned int") (reparse-symbol classsubparts) [3608 3645]) ("type" function (:prototype-flag t :constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3650 3679]) ("value" function (:prototype-flag t :constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3684 3714]) ("sequenceEnabled" function (:prototype-flag t :constant-flag t :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3719 3754]) ("sequenceMode" function (:prototype-flag t :constant-flag t :type ("ESequence" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3759 3796]) ("sequenceStart" function (:prototype-flag t :constant-flag t :type "int") (reparse-symbol classsubparts) [3801 3833]) ("sequenceStep" function (:prototype-flag t :constant-flag t :type "int") (reparse-symbol classsubparts) [3838 3869]) ("databaseMode" function (:prototype-flag t :constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3874 3911]) ("textVisible" function (:prototype-flag t :constant-flag t :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [3916 3947]) ("rotation" function (:prototype-flag t :constant-flag t :type "int") (reparse-symbol classsubparts) [3952 3979]) ("scaling" function (:prototype-flag t :constant-flag t :type "double") (reparse-symbol classsubparts) [3984 4013]) ("index" function (:prototype-flag t :constant-flag t :type "unsigned int") (reparse-symbol classsubparts) [4018 4051]) ("cut" function (:prototype-flag t :constant-flag t :type "double") (reparse-symbol classsubparts) [4056 4081]) ("datamatrixSize" function (:prototype-flag t :constant-flag t :type "int") (reparse-symbol classsubparts) [4086 4119]) ("setBackground" function (:prototype-flag t :arguments (("c" variable (:constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4149 4167])) :type "void") (reparse-symbol classsubparts) [4129 4168]) ("setForeground" function (:prototype-flag t :arguments (("c" variable (:constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4193 4211])) :type "void") (reparse-symbol classsubparts) [4173 4212]) ("setTextColor" function (:prototype-flag t :arguments (("c" variable (:constant-flag t :type ("QColor" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4236 4254])) :type "void") (reparse-symbol classsubparts) [4217 4255]) ("setFontsize" function (:prototype-flag t :arguments (("f" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [4279 4295])) :type "void") (reparse-symbol classsubparts) [4260 4296]) ("setQuietZone" function (:prototype-flag t :arguments (("q" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [4320 4336])) :type "void") (reparse-symbol classsubparts) [4301 4337]) ("setBarHeight" function (:prototype-flag t :arguments (("h" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [4361 4377])) :type "void") (reparse-symbol classsubparts) [4342 4378]) ("setType" function (:prototype-flag t :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4397 4419])) :type "void") (reparse-symbol classsubparts) [4383 4420]) ("setValue" function (:prototype-flag t :arguments (("value" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4440 4463])) :type "void") (reparse-symbol classsubparts) [4425 4464]) ("setTextVisible" function (:prototype-flag t :arguments (("b" variable (:constant-flag t :type ("bool" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4490 4504])) :type "void") (reparse-symbol classsubparts) [4469 4505]) ("setIndex" function (:prototype-flag t :arguments (("i" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [4595 4611])) :type "void") (reparse-symbol classsubparts) [4580 4612]) ("setSequenceEnabled" function (:prototype-flag t :arguments (("b" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4642 4650])) :type "void") (reparse-symbol classsubparts) [4617 4651]) ("setSequenceMode" function (:prototype-flag t :arguments (("e" variable (:type ("ESequence" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4678 4691])) :type "void") (reparse-symbol classsubparts) [4656 4692]) ("setSequenceStart" function (:prototype-flag t :arguments (("s" variable (:type "int") (reparse-symbol arg-sub-list) [4720 4727])) :type "void") (reparse-symbol classsubparts) [4697 4728]) ("setSequenceStep" function (:prototype-flag t :arguments (("s" variable (:type "int") (reparse-symbol arg-sub-list) [4755 4762])) :type "void") (reparse-symbol classsubparts) [4733 4763]) ("setDatabaseMode" function (:prototype-flag t :arguments (("mode" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4790 4812])) :type "void") (reparse-symbol classsubparts) [4768 4813]) ("setRotation" function (:prototype-flag t :arguments (("r" variable (:constant-flag t :type "int") (reparse-symbol arg-sub-list) [4836 4849])) :type "void") (reparse-symbol classsubparts) [4818 4850]) ("setScaling" function (:prototype-flag t :arguments (("d" variable (:constant-flag t :type "double") (reparse-symbol arg-sub-list) [4872 4888])) :type "void") (reparse-symbol classsubparts) [4855 4889]) ("setCut" function (:prototype-flag t :arguments (("c" variable (:constant-flag t :type "double") (reparse-symbol arg-sub-list) [4907 4923])) :type "void") (reparse-symbol classsubparts) [4894 4924]) ("setDatamatrixSize" function (:prototype-flag t :arguments (("s" variable (:type "int") (reparse-symbol arg-sub-list) [4953 4960])) :type "void") (reparse-symbol classsubparts) [4929 4961]) ("setData" function (:prototype-flag t :arguments (("barkode" variable (:constant-flag t :type ("Barkode" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5067 5092])) :type "void") (reparse-symbol classsubparts) [5053 5093]) ("==" function (:prototype-flag t :arguments (("barkode" variable (:constant-flag t :type ("Barkode" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5162 5187])) :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [5145 5194]) ("engine" function (:prototype-flag t :pointer 1 :typemodifiers ("inline") :type ("BarkodeEngine" type (:type "class") nil nil)) (reparse-symbol classsubparts) [5200 5231]) ("engine" function (:prototype-flag t :pointer 1 :typemodifiers ("inline") :constant-flag t :type ("BarkodeEngine" type (:type "class") nil nil)) (reparse-symbol classsubparts) [5236 5279]) ("hasFeature" function (:prototype-flag t :typemodifiers ("static") :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5430 5451]) ("feature" variable (:type "unsigned int") (reparse-symbol arg-sub-list) [5452 5474])) :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [5406 5475]) ("internalType" function (:prototype-flag t :typemodifiers ("static") :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5582 5604])) :type "int") (reparse-symbol classsubparts) [5557 5605]) ("encodingTypes" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :constant-flag t :type ("QStringList" type (:type "class") nil nil)) (reparse-symbol classsubparts) [5710 5752]) ("typeFromName" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :constant-flag t :arguments (("name" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5888 5910])) :type "char") (reparse-symbol classsubparts) [5855 5911]) ("nameFromType" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :constant-flag t :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6049 6071])) :type "char") (reparse-symbol classsubparts) [6016 6072]) ("validatorFromType" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6113 6135])) :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6078 6136]) ("validatorNotFromType" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6179 6201])) :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6141 6202]) ("engineForType" function (:prototype-flag t :typemodifiers ("static") :arguments (("type" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6313 6335])) :type ("EEngine" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6283 6336]) ("drawInvalid" function (:prototype-flag t :arguments (("painter" variable (:type ("QPainter" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6432 6451]) ("x" variable (:default-value "0" :type "int") (reparse-symbol arg-sub-list) [6452 6461]) ("y" variable (:default-value "0" :type "int") (reparse-symbol arg-sub-list) [6463 6472])) :type "void") (reparse-symbol classsubparts) [6414 6475]) ("haveBarcode" function (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6561 6721]) ("haveGNUBarcode" function (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6726 6824]) ("haveTBarcode" function (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6829 6923]) ("haveTBarcode2" function (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [6928 7024]) ("havePDFBarcode" function (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7029 7126]) ("havePurePostscriptBarcode" function (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7131 7244]) ("createInfo" function (:prototype-flag t :typemodifiers ("static") :arguments (("xml" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [7282 7298]) ("name" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7299 7320]) ("engine" variable (:constant-flag t :type ("EEngine" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7321 7342]) ("features" variable (:constant-flag t :default-value "0" :type "unsigned int") (reparse-symbol arg-sub-list) [7380 7411]) ("internal" variable (:constant-flag t :default-value "0" :type "int") (reparse-symbol arg-sub-list) [7413 7435])) :type ("tBarcodeInfo" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7250 7438]) ("protected" label nil (reparse-symbol classsubparts) [7441 7451]) ("drawBarcode" function (:prototype-flag t :arguments (("painter" variable (:type ("QPainter" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7475 7494]) ("x" variable (:default-value "0" :type "int") (reparse-symbol arg-sub-list) [7495 7504]) ("y" variable (:default-value "0" :type "int") (reparse-symbol arg-sub-list) [7506 7515])) :type "void") (reparse-symbol classsubparts) [7456 7518]) ("private" label nil (reparse-symbol classsubparts) [7521 7529]) ("initInfo" function (:prototype-flag t :typemodifiers ("static") :type "void") (reparse-symbol classsubparts) [7534 7557]) ("initValidators" function (:prototype-flag t :typemodifiers ("static") :type "void") (reparse-symbol classsubparts) [7562 7591]) ("updateEngine" function (:prototype-flag t :type "void") (reparse-symbol classsubparts) [7597 7617]) ("protected" label nil (reparse-symbol classsubparts) [7620 7630]) ("m_engine" variable (:pointer 1 :type ("BarkodeEngine" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7635 7659]) ("m_token" variable (:pointer 1 :type ("TokenProvider" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7664 7687]) ("m_valid" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7693 7706]) ("m_sequence" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7711 7727]) ("m_esequence" variable (:type ("ESequence" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7732 7754]) ("m_sequence_start" variable (:type "int") (reparse-symbol classsubparts) [7759 7780]) ("m_sequence_step" variable (:type "int") (reparse-symbol classsubparts) [7785 7805]) ("m_text_visible" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7810 7830]) ("m_background" variable (:type ("QColor" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7840 7860]) ("m_foreground" variable (:type ("QColor" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7865 7885]) ("m_textcolor" variable (:type ("QColor" type (:type "class") nil nil)) (reparse-symbol classsubparts) [7890 7909]) ("m_quietzone" variable (:type "unsigned int") (reparse-symbol classsubparts) [7915 7940]) ("m_bar_height" variable (:type "unsigned int") (reparse-symbol classsubparts) [7945 7971]) ("m_fontsize" variable (:type "unsigned int") (reparse-symbol classsubparts) [7976 8000]) ("m_index" variable (:type "unsigned int") (reparse-symbol classsubparts) [8005 8026]) ("m_datamatrix_size" variable (:type "int") (reparse-symbol classsubparts) [8031 8053]) ("m_rotation" variable (:type "int") (reparse-symbol classsubparts) [8058 8073]) ("m_scaling" variable (:type "double") (reparse-symbol classsubparts) [8083 8100]) ("m_cut" variable (:type "double") (reparse-symbol classsubparts) [8105 8118]) ("m_type" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8234 8249]) ("m_value" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8254 8270]) ("m_database_mode" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8275 8299]) ("s_info" variable (:typemodifiers ("static") :type ("TBarcodeInfoList" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8309 8340]) ("s_encoding" variable (:pointer 1 :typemodifiers ("static") :type ("QStringList" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8345 8376]) ("s_haveGnuBarcode" variable (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8382 8411]) ("s_haveTBarcode" variable (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8416 8443]) ("s_haveTBarcode2" variable (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8448 8476]) ("s_havePdfEncode" variable (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8481 8509]) ("s_havePurePostscript" variable (:typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [8514 8547])) :type "class") nil [2677 8550]) ("engine" function (:pointer 1 :parent "Barkode" :type ("BarkodeEngine" type (:type "class") nil nil)) nil [8552 8609]) ("engine" function (:pointer 1 :parent "Barkode" :constant-flag t :type ("BarkodeEngine" type (:type "class") nil nil)) nil [8611 8680])) + :file "barkode.h" + :pointmax 8704 + ) + (semanticdb-table "purepostscript.h" + :major-mode 'c-mode + :tags '(("PURE_POSTSCRIPT_H" variable (:constant-flag t) nil [1054 1082]) ("pixmapbarcode.h" include nil nil [1081 1107]) ("barkode.h" include nil nil [1108 1128]) ("qcstring.h" include (:system-flag t) nil [1130 1151]) ("PurePostscriptOptions" type (:superclasses ("BarkodeEngineOptions") :members (("public" label nil (reparse-symbol classsubparts) [1217 1224]) ("PurePostscriptOptions" function (:prototype-flag t :constructor-flag t :type ("PurePostscriptOptions" type "class")) (reparse-symbol classsubparts) [1233 1257]) ("defaults" function (:prototype-flag t :type "void") (reparse-symbol classsubparts) [1349 1365]) ("load" function (:prototype-flag t :arguments (("tag" variable (:pointer 1 :constant-flag t :type ("QDomElement" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1386 1410])) :type "void") (reparse-symbol classsubparts) [1375 1411]) ("save" function (:prototype-flag t :arguments (("tag" variable (:pointer 1 :type ("QDomElement" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1431 1449])) :type "void") (reparse-symbol classsubparts) [1420 1450]) ("checksum" function (:typemodifiers ("inline") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1462 1510]) ("setChecksum" function (:typemodifiers ("inline") :arguments (("b" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1544 1552])) :type "void") (reparse-symbol classsubparts) [1519 1569]) ("private" label nil (reparse-symbol classsubparts) [1575 1583]) ("m_check" variable (:type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1593 1606])) :type "class") nil [1153 1609]) ("PurePostscriptBarcode" type (:superclasses ("PixmapBarcode") :members (("public" label nil (reparse-symbol classsubparts) [1665 1672]) ("PurePostscriptBarcode" function (:prototype-flag t :constructor-flag t :type ("PurePostscriptBarcode" type "class")) (reparse-symbol classsubparts) [1677 1701]) ("PurePostscriptBarcode" function (:prototype-flag t :destructor-flag t :type "void") (reparse-symbol classsubparts) [1706 1731]) ("init" function (:prototype-flag t :typemodifiers ("static") :type "void") (reparse-symbol classsubparts) [1884 1903]) ("initInfo" function (:prototype-flag t :typemodifiers ("static") :arguments (("info" variable (:pointer 1 :type ("TBarcodeInfoList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1932 1956])) :type "void") (reparse-symbol classsubparts) [1910 1957]) ("hasPurePostscriptBarcode" function (:prototype-flag t :typemodifiers ("static") :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1963 2002]) ("engine" function (:prototype-flag t :typemodifiers ("inline") :type ("EEngine" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2008 2038]) ("options" function (:prototype-flag t :pointer 1 :typemodifiers ("inline") :type ("BarkodeEngineOptions" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2044 2083]) ("private" label nil (reparse-symbol classsubparts) [2086 2094]) ("createPostscript" function (:prototype-flag t :typemodifiers ("virtual") :arguments (("postscript" variable (:pointer 2 :type "char") (reparse-symbol arg-sub-list) [2130 2148]) ("postscript_size" variable (:pointer 1 :type "long") (reparse-symbol arg-sub-list) [2149 2172])) :type ("bool" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2099 2173]) ("bbox" function (:prototype-flag t :typemodifiers ("virtual") :arguments (("postscript" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [2198 2221]) ("postscript_size" variable (:type "long") (reparse-symbol arg-sub-list) [2222 2244])) :type ("QRect" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2178 2245]) ("createProgram" function (:prototype-flag t :arguments (("prg" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2449 2464])) :type "void") (reparse-symbol classsubparts) [2429 2465]) ("private" label nil (reparse-symbol classsubparts) [2468 2476]) ("m_options" variable (:type ("PurePostscriptOptions" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2481 2513]) ("m_program" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2519 2537]) ("s_path" variable (:typemodifiers ("static") :type ("QString" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2543 2565])) :type "class") nil [1611 2568]) ("engine" function (:parent "PurePostscriptBarcode" :type ("EEngine" type (:type "class") nil nil)) nil [2570 2647]) ("options" function (:pointer 1 :parent "PurePostscriptBarcode" :type ("BarkodeEngineOptions" type (:type "class") nil nil)) nil [2649 2730])) + :file "purepostscript.h" + :pointmax 2763 + ) + (semanticdb-table "tokenprovider.cpp" + :major-mode 'c++-mode + :tags '(("tokenprovider.h" include nil nil [1029 1055]) ("sqltables.h" include nil nil [1056 1078]) ("kbarcodesettings.h" include nil nil [1079 1108]) ("barcodeitem.h" include nil nil [1110 1134]) ("textitem.h" include nil nil [1135 1156]) ("textlineitem.h" include nil nil [1157 1182]) ("qdatetime.h" include (:system-flag t) nil [1199 1221]) ("qpaintdevicemetrics.h" include (:system-flag t) nil [1222 1254]) ("qsqlquery.h" include (:system-flag t) nil [1255 1277]) ("qregexp.h" include (:system-flag t) nil [1278 1298]) ("qvaluelist.h" include (:system-flag t) nil [1299 1322]) ("time.h" include (:system-flag t) nil [1323 1340]) ("klocale.h" include (:system-flag t) nil [1342 1362]) ("kabc/addressee.h" include (:system-flag t) nil [1363 1390]) ("kjs/interpreter.h" include (:system-flag t) nil [1434 1462]) ("kjsembed/kjsembedpart.h" include (:system-flag t) nil [1469 1503]) ("NUM_FIELDS" variable (:constant-flag t :default-value (nil)) nil [1553 1574]) ("TOK_ARTICLE_NO_CUSTOMER" variable (:pointer 1 :constant-flag t :default-value "\"article_no_customer\"" :type "char") nil [1576 1636]) ("TOK_BARCODE_NO_CUSTOMER" variable (:pointer 1 :constant-flag t :default-value "\"barcode_no_customer\"" :type "char") nil [1637 1697]) ("TOK_ARTICLE_DESC" variable (:pointer 1 :constant-flag t :default-value "\"article_desc\"" :type "char") nil [1698 1744]) ("TOK_ARTICLE_NO" variable (:pointer 1 :constant-flag t :default-value "\"article_no\"" :type "char") nil [1745 1787]) ("TOK_CUSTOMER_NO" variable (:pointer 1 :constant-flag t :default-value "\"customer_no\"" :type "char") nil [1788 1832]) ("TOK_CUSTOEMR_NAME" variable (:pointer 1 :constant-flag t :default-value "\"customer_name\"" :type "char") nil [1833 1881]) ("TOK_BARCODE_NO" variable (:pointer 1 :constant-flag t :default-value "\"barcode_no\"" :type "char") nil [1882 1924]) ("TOK_BARCODE_NO_BASIC" variable (:pointer 1 :constant-flag t :default-value "\"barcode_no_basic\"" :type "char") nil [1925 1979]) ("TOK_GROUP" variable (:pointer 1 :constant-flag t :default-value "\"group\"" :type "char") nil [1980 2012]) ("TOK_ENCODING_TYPE" variable (:pointer 1 :constant-flag t :default-value "\"encoding_type\"" :type "char") nil [2013 2061]) ("TOK_ENCODING_TYPE_NAME" variable (:pointer 1 :constant-flag t :default-value "\"encoding_type_name\"" :type "char") nil [2062 2120]) ("TOK_LINE" variable (:pointer 1 :constant-flag t :default-value "\"line%1\"" :type "char") nil [2121 2153]) ("TOK_FIELD" variable (:pointer 1 :constant-flag t :default-value "\"field%1\"" :type "char") nil [2154 2188]) ("TOK_FILENAME" variable (:pointer 1 :constant-flag t :default-value "\"filename\"" :type "char") nil [2190 2228]) ("TOK_INDEX" variable (:pointer 1 :constant-flag t :default-value "\"index\"" :type "char") nil [2229 2261]) ("TOK_COL" variable (:pointer 1 :constant-flag t :default-value "\"col\"" :type "char") nil [2262 2290]) ("TOK_ROW" variable (:pointer 1 :constant-flag t :default-value "\"row\"" :type "char") nil [2291 2319]) ("TOK_PAGE" variable (:pointer 1 :constant-flag t :default-value "\"page\"" :type "char") nil [2320 2350]) ("TOK_RESOLUTION" variable (:pointer 1 :constant-flag t :default-value "\"resolution\"" :type "char") nil [2351 2393]) ("TOK_SERIAL" variable (:pointer 1 :constant-flag t :default-value "\"serial\"" :type "char") nil [2394 2428]) ("TOK_JS" variable (:pointer 1 :constant-flag t :default-value "\"js:\"" :type "char") nil [2430 2457]) ("TOK_SQL" variable (:pointer 1 :constant-flag t :default-value "\"sqlquery:\"" :type "char") nil [2458 2492]) ("TOK_VAR" variable (:pointer 1 :constant-flag t :default-value "\"$\"" :type "char") nil [2493 2519]) ("TOK_DATE" variable (:pointer 1 :constant-flag t :default-value "\"date\"" :type "char") nil [2521 2551]) ("TOK_DATE_a" variable (:pointer 1 :constant-flag t :default-value "\"date:%a\"" :type "char") nil [2552 2587]) ("TOK_DATE_A" variable (:pointer 1 :constant-flag t :default-value "\"date:%A\"" :type "char") nil [2588 2623]) ("TOK_DATE_b" variable (:pointer 1 :constant-flag t :default-value "\"date:%b\"" :type "char") nil [2624 2659]) ("TOK_DATE_B" variable (:pointer 1 :constant-flag t :default-value "\"date:%B\"" :type "char") nil [2660 2695]) ("TOK_DATE_c" variable (:pointer 1 :constant-flag t :default-value "\"date:%c\"" :type "char") nil [2696 2731]) ("TOK_DATE_C" variable (:pointer 1 :constant-flag t :default-value "\"date:%C\"" :type "char") nil [2732 2767]) ("TOK_DATE_d" variable (:pointer 1 :constant-flag t :default-value "\"date:%d\"" :type "char") nil [2768 2803]) ("TOK_DATE_D" variable (:pointer 1 :constant-flag t :default-value "\"date:%D\"" :type "char") nil [2804 2839]) ("TOK_DATE_e" variable (:pointer 1 :constant-flag t :default-value "\"date:%e\"" :type "char") nil [2840 2875]) ("TOK_DATE_F" variable (:pointer 1 :constant-flag t :default-value "\"date:%F\"" :type "char") nil [2876 2911]) ("TOK_DATE_g" variable (:pointer 1 :constant-flag t :default-value "\"date:%g\"" :type "char") nil [2912 2947]) ("TOK_DATE_G" variable (:pointer 1 :constant-flag t :default-value "\"date:%G\"" :type "char") nil [2948 2983]) ("TOK_DATE_H" variable (:pointer 1 :constant-flag t :default-value "\"date:%H\"" :type "char") nil [2984 3019]) ("TOK_DATE_I" variable (:pointer 1 :constant-flag t :default-value "\"date:%I\"" :type "char") nil [3020 3055]) ("TOK_DATE_J" variable (:pointer 1 :constant-flag t :default-value "\"date:%J\"" :type "char") nil [3056 3091]) ("TOK_DATE_m" variable (:pointer 1 :constant-flag t :default-value "\"date:%m\"" :type "char") nil [3092 3127]) ("TOK_DATE_M" variable (:pointer 1 :constant-flag t :default-value "\"date:%M\"" :type "char") nil [3128 3163]) ("TOK_DATE_p" variable (:pointer 1 :constant-flag t :default-value "\"date:%p\"" :type "char") nil [3164 3199]) ("TOK_DATE_r" variable (:pointer 1 :constant-flag t :default-value "\"date:%r\"" :type "char") nil [3200 3235]) ("TOK_DATE_R" variable (:pointer 1 :constant-flag t :default-value "\"date:%R\"" :type "char") nil [3236 3271]) ("TOK_DATE_S" variable (:pointer 1 :constant-flag t :default-value "\"date:%S\"" :type "char") nil [3272 3307]) ("TOK_DATE_T" variable (:pointer 1 :constant-flag t :default-value "\"date:%T\"" :type "char") nil [3308 3343]) ("TOK_DATE_u" variable (:pointer 1 :constant-flag t :default-value "\"date:%u\"" :type "char") nil [3344 3379]) ("TOK_DATE_U" variable (:pointer 1 :constant-flag t :default-value "\"date:%U\"" :type "char") nil [3380 3415]) ("TOK_DATE_V" variable (:pointer 1 :constant-flag t :default-value "\"date:%V\"" :type "char") nil [3416 3451]) ("TOK_DATE_w" variable (:pointer 1 :constant-flag t :default-value "\"date:%w\"" :type "char") nil [3452 3487]) ("TOK_DATE_W" variable (:pointer 1 :constant-flag t :default-value "\"date:%W\"" :type "char") nil [3488 3523]) ("TOK_DATE_x" variable (:pointer 1 :constant-flag t :default-value "\"date:%x\"" :type "char") nil [3524 3559]) ("TOK_DATE_X" variable (:pointer 1 :constant-flag t :default-value "\"date:%X\"" :type "char") nil [3560 3595]) ("TOK_DATE_y" variable (:pointer 1 :constant-flag t :default-value "\"date:%y\"" :type "char") nil [3596 3631]) ("TOK_DATE_Y" variable (:pointer 1 :constant-flag t :default-value "\"date:%Y\"" :type "char") nil [3632 3667]) ("TOK_DATE_z" variable (:pointer 1 :constant-flag t :default-value "\"date:%z\"" :type "char") nil [3668 3703]) ("TOK_DATE_Z" variable (:pointer 1 :constant-flag t :default-value "\"date:%Z\"" :type "char") nil [3704 3739]) ("TOK_ADDRESS_NAME" variable (:pointer 1 :constant-flag t :default-value "\"address_name\"" :type "char") nil [3741 3787]) ("TOK_ADDRESS_GIVEN_NAME" variable (:pointer 1 :constant-flag t :default-value "\"address_givenname\"" :type "char") nil [3788 3845]) ("TOK_ADDRESS_FAMILY_NAME" variable (:pointer 1 :constant-flag t :default-value "\"address_familyname\"" :type "char") nil [3846 3905]) ("TOK_ADDRESS_EMAIL" variable (:pointer 1 :constant-flag t :default-value "\"address_email\"" :type "char") nil [3906 3954]) ("TOK_ADDRESS_FULL_EMAIL" variable (:pointer 1 :constant-flag t :default-value "\"address_fullemail\"" :type "char") nil [3955 4012]) ("TOK_ADDRESS_PHONE_PREF" variable (:pointer 1 :constant-flag t :default-value "\"address_phone\"" :type "char") nil [4013 4066]) ("TOK_ADDRESS_PHONE_HOME" variable (:pointer 1 :constant-flag t :default-value "\"address_phonehome\"" :type "char") nil [4067 4124]) ("TOK_ADDRESS_PHONE_WORK" variable (:pointer 1 :constant-flag t :default-value "\"address_phonework\"" :type "char") nil [4125 4182]) ("TOK_ADDRESS_PHONE_MSG" variable (:pointer 1 :constant-flag t :default-value "\"address_phonemsg\"" :type "char") nil [4183 4238]) ("TOK_ADDRESS_PHONE_VOICE" variable (:pointer 1 :constant-flag t :default-value "\"address_phonevoice\"" :type "char") nil [4239 4298]) ("TOK_ADDRESS_PHONE_FAX" variable (:pointer 1 :constant-flag t :default-value "\"address_phonefax\"" :type "char") nil [4299 4354]) ("TOK_ADDRESS_PHONE_CELL" variable (:pointer 1 :constant-flag t :default-value "\"address_phonemobile\"" :type "char") nil [4355 4414]) ("TOK_ADDRESS_PHONE_VIDEO" variable (:pointer 1 :constant-flag t :default-value "\"address_phonevideo\"" :type "char") nil [4415 4474]) ("TOK_ADDRESS_PHONE_BBS" variable (:pointer 1 :constant-flag t :default-value "\"address_phonebbs\"" :type "char") nil [4475 4530]) ("TOK_ADDRESS_PHONE_MODEM" variable (:pointer 1 :constant-flag t :default-value "\"address_phonemodem\"" :type "char") nil [4531 4590]) ("TOK_ADDRESS_PHONE_CAR" variable (:pointer 1 :constant-flag t :default-value "\"address_phonecar\"" :type "char") nil [4591 4646]) ("TOK_ADDRESS_PHONE_ISDN" variable (:pointer 1 :constant-flag t :default-value "\"address_phoneisdn\"" :type "char") nil [4647 4704]) ("TOK_ADDRESS_PHONE_PCS" variable (:pointer 1 :constant-flag t :default-value "\"address_phonepcs\"" :type "char") nil [4705 4760]) ("TOK_ADDRESS_PHONE_PAGER" variable (:pointer 1 :constant-flag t :default-value "\"address_phonepager\"" :type "char") nil [4761 4820]) ("TOK_ADDRESS_ADDRESS_POB" variable (:pointer 1 :constant-flag t :default-value "\"address_postofficebox\"" :type "char") nil [4821 4883]) ("TOK_ADDRESS_ADDRESS_EXTENDED" variable (:pointer 1 :constant-flag t :default-value "\"address_extended\"" :type "char") nil [4884 4946]) ("TOK_ADDRESS_ADDRESS_STREET" variable (:pointer 1 :constant-flag t :default-value "\"address_street\"" :type "char") nil [4947 5005]) ("TOK_ADDRESS_ADDRESS_LOCALITY" variable (:pointer 1 :constant-flag t :default-value "\"address_locality\"" :type "char") nil [5006 5068]) ("TOK_ADDRESS_ADDRESS_REGION" variable (:pointer 1 :constant-flag t :default-value "\"address_region\"" :type "char") nil [5069 5127]) ("TOK_ADDRESS_ADDRESS_POSTALCODE" variable (:pointer 1 :constant-flag t :default-value "\"address_postalcode\"" :type "char") nil [5128 5194]) ("TOK_ADDRESS_ADDRESS_COUNTRY" variable (:pointer 1 :constant-flag t :default-value "\"address_country\"" :type "char") nil [5195 5255]) ("TOK_ADDRESS_ADDRESS_LABEL" variable (:pointer 1 :constant-flag t :default-value "\"address_label\"" :type "char") nil [5256 5312]) ("TOK_ADDRESS" variable (:pointer 1 :constant-flag t :default-value "\"address\"" :type "char") nil [5313 5349]) ("TOK_ADDRESS_URL" variable (:pointer 1 :constant-flag t :default-value "\"address_url\"" :type "char") nil [5357 5401]) ("TOK_ADDRESS_NICK" variable (:pointer 1 :constant-flag t :default-value "\"address_nick\"" :type "char") nil [5402 5448]) ("TOK_ADDRESS_ADDITIONAL_NAME" variable (:pointer 1 :constant-flag t :default-value "\"address_addtionalname\"" :type "char") nil [5449 5515]) ("TOK_ADDRESS_PREFIX" variable (:pointer 1 :constant-flag t :default-value "\"address_prefix\"" :type "char") nil [5516 5566]) ("TOK_ADDRESS_SUFFIX" variable (:pointer 1 :constant-flag t :default-value "\"address_suffix\"" :type "char") nil [5567 5617]) ("TOK_ADDRESS_BIRTHDAY" variable (:pointer 1 :constant-flag t :default-value "\"address_birthday\"" :type "char") nil [5618 5672]) ("TOK_ADDRESS_TITLE" variable (:pointer 1 :constant-flag t :default-value "\"address_title\"" :type "char") nil [5673 5721]) ("TOK_ADDRESS_ROLE" variable (:pointer 1 :constant-flag t :default-value "\"address_role\"" :type "char") nil [5722 5768]) ("TOK_ADDRESS_NOTE" variable (:pointer 1 :constant-flag t :default-value "\"address_note\"" :type "char") nil [5769 5815]) ("TOK_ADDRESS_ORGANIZATION" variable (:pointer 1 :constant-flag t :default-value "\"address_organization\"" :type "char") nil [5816 5878]) ("TokenProvider" function (:constructor-flag t :parent "TokenProvider" :arguments (("paintdevice" variable (:pointer 1 :type ("QPaintDevice" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5910 5937])) :type ("TokenProvider" type "class")) nil [5880 6579]) ("TokenProvider" function (:destructor-flag t :parent "TokenProvider" :type "void") nil [6581 6616]) ("TokenProvider::s_categories" variable (:type ("QValueList" type (:type "class") nil nil)) nil [6618 6670]) ("TokenProvider::s_captions" variable (:type ("QMap" type (:type "class") nil nil)) nil [6671 6738]) ("TokenProvider::s_interpreter" variable (:pointer 1 :default-value "NULL;" :type ("KJS::Interpreter" type (:type "class") nil nil)) nil [6759 6813]) ("TokenProvider::s_interpreter" variable (:pointer 1 :default-value "NULL;" :type ("KJSEmbed::KJSEmbedPart" type (:type "class") nil nil)) nil [6820 6880]) ("hasJavaScript" function (:parent "TokenProvider" :type ("bool" type (:type "class") nil nil)) nil [6905 7032]) ("getTokens" function (:pointer 1 :parent "TokenProvider" :type ("QValueList" type (:type "class") nil nil)) nil [7034 7143]) ("init" function (:parent "TokenProvider" :type "void") nil [7145 17408]) ("findBrackets" function (:parent "TokenProvider" :arguments (("text" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [17445 17460]) ("" variable (:type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [17461 17501])) :type "void") nil [17411 18736]) ("parse" function (:parent "TokenProvider" :arguments (("text" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [18768 18790])) :type ("QString" type (:type "class") nil nil)) nil [18738 18889]) ("listUserVars" function (:parent "TokenProvider" :type ("QStringList" type (:type "class") nil nil)) nil [18891 19537]) ("processUserVars" function (:parent "TokenProvider" :arguments (("t" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [19579 19598])) :type ("QString" type (:type "class") nil nil)) nil [19539 20032]) ("process" function (:parent "TokenProvider" :arguments (("t" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20066 20085])) :type ("QString" type (:type "class") nil nil)) nil [20034 24091]) ("processAddresses" function (:parent "TokenProvider" :arguments (("t" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [24134 24153])) :type ("QString" type (:type "class") nil nil)) nil [24093 29616]) ("query" function (:parent "TokenProvider" :arguments (("query" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [29648 29671])) :type ("QString" type (:type "class") nil nil)) nil [29618 29867]) ("jsParse" function (:parent "TokenProvider" :arguments (("script" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [29901 29925])) :type ("QString" type (:type "class") nil nil)) nil [29869 31283]) ("jsParseToBool" function (:parent "TokenProvider" :arguments (("script" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [31320 31344])) :type ("bool" type (:type "class") nil nil)) nil [31285 31681]) ("createSerial" function (:parent "TokenProvider" :constant-flag t :type ("QString" type (:type "class") nil nil)) nil [31683 32384]) ("unescapeText" function (:parent "TokenProvider" :arguments (("t" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [32423 32442])) :type ("QString" type (:type "class") nil nil)) nil [32386 32692]) ("escapeText" function (:parent "TokenProvider" :arguments (("t" variable (:constant-flag t :type ("QString" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [32729 32748])) :type ("QString" type (:type "class") nil nil)) nil [32694 33053])) + :file "tokenprovider.cpp" + :pointmax 33054 + ) + ) + :file "semantic.cache" + :semantic-tag-version "2.0pre3" + :semanticdb-version "2.0pre3" + ) diff --git a/kbarcode/smalldialogs.cpp b/kbarcode/smalldialogs.cpp new file mode 100644 index 0000000..232e2f0 --- /dev/null +++ b/kbarcode/smalldialogs.cpp @@ -0,0 +1,151 @@ +/*************************************************************************** + smalldialogs.cpp - description + ------------------- + begin : Son Jul 20 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "smalldialogs.h" +#include "sqltables.h" + +// Qt includes +#include +#include +#include + +// KDE includes +#include +#include +#include + + +using namespace DSSmallDialogs; + +AddAllDialog::AddAllDialog(QWidget *parent, const char *name ) + : KDialogBase( KDialogBase::Plain, i18n("Add Barcode_basic"), + KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent,name) +{ + QVBoxLayout* layout = new QVBoxLayout( plainPage(), 6, 6 ); + + group = new KLineEdit( plainPage() ); + number = new KIntNumInput( plainPage() ); + number->setLabel( i18n( "Number of labels:" ) ); + number->setRange( 1, 10000, 1, false ); + + layout->addWidget( new QLabel( i18n("Group:"), plainPage() ) ); + layout->addWidget( group ); + layout->addWidget( number ); +} + +QString AddAllDialog::groupName() const +{ + return group->text(); +} + +int AddAllDialog::numberLabels() const +{ + return number->value(); +} + +AddItemsDialog::AddItemsDialog(QWidget *parent, const char *name ) + : KDialogBase( KDialogBase::Plain, i18n("Add Items"), + KDialogBase::User1 | KDialogBase::Close, KDialogBase::User1, parent,name) +{ + init(); +} + +AddItemsDialog::AddItemsDialog( const QString & a, const QString & g, int c, QWidget* parent, const char* name ) + : KDialogBase( KDialogBase::Plain, i18n("Edit Item"), + KDialogBase::Ok| KDialogBase::Close, KDialogBase::Ok, parent,name) +{ + init(); + article->setText( a ); + group->setText( g ); + number->setValue( c ); +} + +void AddItemsDialog::init() +{ + plainPage()->setFrameStyle( QFrame::GroupBoxPanel | QFrame::Sunken ); + plainPage()->setLineWidth( 2 ); + + QHBoxLayout* layout = new QHBoxLayout( plainPage(), 6, 6 ); + + group = new KLineEdit( plainPage() ); + article = new KLineEdit( plainPage() ); + + number = new KIntNumInput( plainPage() ); + number->setLabel( i18n( "Number of labels:" ), KNumInput::AlignLeft | KNumInput::AlignVCenter ); + number->setRange( 1, 10000, 1, false ); + + layout->addWidget( number ); + layout->addWidget( new QLabel( i18n("Article:" ), plainPage() ) ); + layout->addWidget( article ); + layout->addWidget( new QLabel( i18n("Group:"), plainPage() ) ); + layout->addWidget( group ); + + setButtonText( KDialogBase::User1, i18n("&Add") ); + + setupSql(); + + connect( SqlTables::getInstance(), SIGNAL( tablesChanged() ), this, SLOT( setupSql() ) ); + connect( SqlTables::getInstance(), SIGNAL( connectedSQL() ), this, SLOT( setupSql() ) ); +} + +void AddItemsDialog::slotUser1() +{ + emit add( article->text(), group->text(), number->value() ); + + number->setValue( 1 ); + article->setText( "" ); + group->setText( "" ); + article->setFocus(); +} + +void AddItemsDialog::setupSql() +{ + SqlTables* tables = SqlTables::getInstance(); + if( !tables->isConnected() ) + return; + + KCompletion* comp = article->completionObject(); + comp->clear(); + QSqlQuery query( "select article_no from " TABLE_BASIC " order by article_no" ); + QStringList slist; + while ( query.next() ) + slist.append( query.value(0).toString() ); + + comp->setItems( slist ); +} + +void AddItemsDialog::setGroupCompletion( KCompletion* c ) +{ + group->setCompletionObject( c ); +} + +int AddItemsDialog::count() const +{ + return number->value(); +} + +const QString AddItemsDialog::articleNo() const +{ + return article->text(); +} + +const QString AddItemsDialog::groupName() const +{ + return group->text(); +} + +#include "smalldialogs.moc" diff --git a/kbarcode/smalldialogs.h b/kbarcode/smalldialogs.h new file mode 100644 index 0000000..6687b64 --- /dev/null +++ b/kbarcode/smalldialogs.h @@ -0,0 +1,72 @@ +/*************************************************************************** + smalldialogs.h - description + ------------------- + begin : Son Jul 20 2003 + copyright : (C) 2003 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef SMALLDIALOGS_H +#define SMALLDIALOGS_H + +#include +#include + +class KCompletion; +class KIntNumInput; +class KLineEdit; + +namespace DSSmallDialogs { + + class AddAllDialog : public KDialogBase { + Q_OBJECT + public: + AddAllDialog(QWidget *parent=0, const char *name=0); + + QString groupName() const; + int numberLabels() const; + + protected: + KLineEdit* group; + KIntNumInput* number; + }; + + class AddItemsDialog : public KDialogBase { + Q_OBJECT + public: + AddItemsDialog( QWidget* parent = 0, const char* name = 0 ); + AddItemsDialog( const QString & a, const QString & g, int c, QWidget* parent = 0, const char* name = 0 ); + + void setGroupCompletion( KCompletion* c ); + + int count() const; + const QString articleNo() const; + const QString groupName() const; + + signals: + void add( const QString & article, const QString & group, int count); + + private slots: + void setupSql(); + + protected: + KLineEdit* article; + KLineEdit* group; + KIntNumInput* number; + + void slotUser1(); + void init(); + }; + +} + +#endif diff --git a/kbarcode/sqltables.cpp b/kbarcode/sqltables.cpp new file mode 100644 index 0000000..7852683 --- /dev/null +++ b/kbarcode/sqltables.cpp @@ -0,0 +1,654 @@ +/*************************************************************************** + sqltables.cpp - description + ------------------- + begin : Son Dez 29 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "sqltables.h" +#include "definition.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include + +QMap drivers; + +class MySqlDescription : public SqlDescription { + public: + virtual const QString initdb( QString ) const { return "mysql"; } + virtual const QString autoIncrement() const { return "int(11) NOT NULL auto_increment"; } + virtual const QString showColumns( const QString & table ) const { return "SHOW COLUMNS FROM " + table; } +}; + +class PostgreSQLDescription : public SqlDescription { + public: + virtual const QString initdb( QString ) const { return "template1"; } + virtual const QString autoIncrement() const { return "serial NOT NULL"; } + virtual const QString showColumns( const QString & table ) const { + return "select a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), " + "a.attnotnull, a.atthasdef, a.attnum, substring(d.adsrc for 128) " + "from pg_catalog.pg_attribute a " + "inner join pg_catalog.pg_class c on c.oid = a.attrelid " + "left join pg_catalog.pg_attrdef d on d.adrelid = c.oid and a.attnum = " + "d.adnum " + "where a.attnum > 0 and not a.attisdropped and c.relname ~ '^" + table + "$';"; + } +}; + +/** should work for ODBC, too */ +class SQLiteDescription : public SqlDescription { + public: + virtual const QString initdb( QString db = QString::null ) const { return db; } + virtual const QString autoIncrement() const { return "serial NOT NULL"; } + virtual const QString showColumns( const QString & table ) const { return "SHOW COLUMNS FROM " + table; } +}; + +SqlTables::SqlTables( QObject* parent ) + : QObject( parent, "sqltables" ) +{ + drivers.insert( "QMYSQL3", new MySqlDescription() ); + drivers.insert( "QPSQL7", new PostgreSQLDescription() ); + /* The same driver plugin is used for QDBC and SQLite */ + drivers.insert( "QSQLITE", new SQLiteDescription() ); + drivers.insert( "QODBC3", new SQLiteDescription() ); + + db = NULL; + connected = false; + loadConfig(); + + connect( kapp, SIGNAL( aboutToQuit() ), this, SLOT( saveConfig() ) ); +} + +SqlTables::~SqlTables() +{ +} + +SqlTables* SqlTables::instance = NULL; + +SqlTables* SqlTables::getInstance() +{ + if( !instance ) + instance = new SqlTables(); + + return instance; +} + +const SqlDescription* SqlTables::driver() const +{ + return drivers[sqldata.driver]; +} +bool SqlTables::connectMySQL() +{ + db = QSqlDatabase::addDatabase( sqldata.driver ); + + db->setDatabaseName( sqldata.database ); + db->setUserName( sqldata.username ); + db->setPassword( sqldata.password ); + db->setHostName( sqldata.hostname ); + + if( !db->open() ) + KMessageBox::error( 0, i18n("Unable to open database: ") + sqldata.database + "
" + + db->lastError().databaseText() + "
"); + + connected = db->open(); + if( connected ) { + updateTables(); + emit connectedSQL(); + // be sure that we have a clean list of producers + Definition::updateProducer(); + } + + return connected; +} + +bool SqlTables::newTables() +{ + return newTables( sqldata.username, sqldata.password, sqldata.hostname, sqldata.database, sqldata.driver ); +} + +bool SqlTables::newTables( const QString & username, const QString & password, const QString & hostname, const QString & database, const QString & driver ) +{ + if( KMessageBox::warningContinueCancel( 0, + i18n("We are going to re-create the tables '") + + QString( TABLE_BASIC "', '" TABLE_CUSTOMER "', '" + TABLE_CUSTOMER_TEXT) +i18n("' and '") + QString(TABLE_LABEL_DEF "'")) == KMessageBox::Cancel ) + return false; + + if( !drivers[driver] ) + return false; + + QSqlDatabase*dbase = QSqlDatabase::addDatabase(driver, drivers[driver]->initdb( database ) ); + dbase->setDatabaseName( drivers[driver]->initdb( database ) ); + dbase->setUserName( username ); + dbase->setPassword( password ); + dbase->setHostName( hostname ); + + if(dbase->open()) { + + if (driver != "QSQLITE") + { + bool found = false; + QSqlQuery existing("SHOW DATABASES LIKE '" + database + "';"); + while( existing.next() ) + found = true; + + QSqlQuery firstquery( NULL, dbase ); + if( !found && !firstquery.exec("CREATE DATABASE " + database + ";")) { + if( KMessageBox::warningContinueCancel( 0, i18n("Can't create database ")+ database + i18n("
You can continue if the database exists already.
") + + firstquery.lastError().databaseText() ) == KMessageBox::Cancel ) { + dbase->close(); + QSqlDatabase::removeDatabase(drivers[driver]->initdb( database )); + return false; + } + } + } + dbase->close(); + QSqlDatabase::removeDatabase(drivers[driver]->initdb( database )); + + // The database is created, now connect to the one specified by the user + dbase = QSqlDatabase::addDatabase(driver, database ); + dbase->setDatabaseName( database ); + dbase->setUserName( username ); + dbase->setPassword( password ); + dbase->setHostName( hostname ); + if(!dbase->open() || !dbase->isOpen()) { + KMessageBox::error( 0, i18n("KBarcode could not create the required database. Please create it manually.") + dbase->lastError().databaseText() ); + QSqlDatabase::removeDatabase( database ); + return false; + } + + + QSqlQuery query( NULL, dbase ); + + // barcode_basic + query.exec("DROP TABLE " TABLE_BASIC ); + exec( &query, "CREATE TABLE " TABLE_BASIC " (" + " uid " + drivers[driver]->autoIncrement() + "," + " article_no varchar(50) DEFAULT NULL," + " article_desc varchar(50) DEFAULT NULL," + " barcode_no TEXT DEFAULT NULL," + " encoding_type varchar(50) DEFAULT NULL," + " field0 varchar(50) DEFAULT NULL," + " field1 varchar(50) DEFAULT NULL," + " field2 varchar(50) DEFAULT NULL," + " field3 varchar(50) DEFAULT NULL," + " field4 varchar(50) DEFAULT NULL," + " field5 varchar(50) DEFAULT NULL," + " field6 varchar(50) DEFAULT NULL," + " field7 varchar(50) DEFAULT NULL," + " field8 varchar(50) DEFAULT NULL," + " field9 varchar(50) DEFAULT NULL," + " PRIMARY KEY (uid)" + ");" ); + + // customer + query.exec("DROP TABLE " TABLE_CUSTOMER ); + exec( &query, "CREATE TABLE " TABLE_CUSTOMER " (" + " uid " + drivers[driver]->autoIncrement() + " ," + " customer_no varchar(20) DEFAULT NULL," + " customer_name varchar(20) DEFAULT NULL," + " PRIMARY KEY (uid)" + ");" ); + + // customer_text + query.exec("DROP TABLE " TABLE_CUSTOMER_TEXT ); + exec( &query, "CREATE TABLE " TABLE_CUSTOMER_TEXT " (" + " uid " + drivers[driver]->autoIncrement() + "," + " customer_no varchar(20) DEFAULT NULL," + " encoding_type varchar(50) DEFAULT NULL," + " article_no varchar(50) DEFAULT NULL," + " article_no_customer varchar(50) NULL," + " barcode_no TEXT DEFAULT NULL," + " line0 varchar(50) DEFAULT NULL," + " line1 varchar(50) DEFAULT NULL," + " line2 varchar(50) DEFAULT NULL," + " line3 varchar(50) DEFAULT NULL," + " line4 varchar(50) DEFAULT NULL," + " line5 varchar(50) DEFAULT NULL," + " line6 varchar(50) DEFAULT NULL," + " line7 varchar(50) DEFAULT NULL," + " line8 varchar(50) DEFAULT NULL," + " line9 varchar(50) DEFAULT NULL," + " PRIMARY KEY (uid)" + ");" ); + + // label_def + query.exec("DROP TABLE " TABLE_LABEL_DEF ); + exec( &query, "CREATE TABLE " TABLE_LABEL_DEF " (" + " label_no " + drivers[driver]->autoIncrement() + "," + " manufacture varchar(255) DEFAULT NULL," + " type varchar(255) DEFAULT NULL," + " paper char(1) DEFAULT NULL," + " gap_top NUMERIC(10,4) NULL," + " gap_left NUMERIC(10,4) NULL," + " height NUMERIC(10,4) NULL," + " width NUMERIC(10,4) NULL," + " gap_v NUMERIC(10,4) NULL," + " gap_h NUMERIC(10,4) NULL," + " number_h int DEFAULT NULL," //smalint(6) + " number_v int DEFAULT NULL," //smalint(6) + " paper_type varchar(30) DEFAULT NULL," + " compatibility varchar(10) DEFAULT NULL," // keep compatibility with older versions, was "remark text" + " PRIMARY KEY (label_no)" + ");" ); + + dbase->close(); + QSqlDatabase::removeDatabase( database ); + KMessageBox::information( 0, i18n("Created table ")+database+i18n(" successfully!") ); + } else { + dbase->close(); + QSqlDatabase::removeDatabase(drivers[driver]->initdb( database )); + KMessageBox::sorry( 0, i18n("Can't connect to database.") ); + return false; + } + + return true; +} + +void SqlTables::importLabelDef() +{ + if( KMessageBox::warningContinueCancel( 0, i18n("We are going to delete the complete table: " ) + TABLE_LABEL_DEF ) == + KMessageBox::Cancel ) + return; + + QSqlQuery query( QString::null, db ); + exec( &query, "delete from " TABLE_LABEL_DEF ); + + QString f = locateLocal( "data", "kbarcode/labeldefinitions.sql" ); + if( !QFile::exists( f ) ) { + KConfig* config = kapp->config(); + config->setGroup( "Definitions" ); + f = config->readEntry( "defpath", locate( "data", "kbarcode/labeldefinitions.sql" ) ); + } + + importData( f, db ); + + Definition::updateProducer(); +} + +void SqlTables::importExampleData() +{ + if( KMessageBox::warningContinueCancel( 0, + i18n("We are going to delete the complete tables: " ) + QString( TABLE_BASIC ", " TABLE_CUSTOMER ", " TABLE_CUSTOMER_TEXT ) ) == + KMessageBox::Cancel ) + return; + + importData( locate("appdata", "exampledata.sql"), db ); +} + +void SqlTables::importData( const QString & filename, QSqlDatabase* db ) +{ + if( !db ) { + qDebug("Can't import data, dabase not open!"); + return; + } + + if( filename.isEmpty() || !db->isOpen() ) // quick escape + { + KMessageBox::error( NULL, i18n("Data file for import not found. Continuing without importing data. Please check your KBarcode installation.") ); + return; + } + + QFile data( filename); + QProgressDialog* dlg = new QProgressDialog( i18n("SQL import progress:"), QString::null, data.size(), 0, "dlg", true ); + + if( data.open( IO_ReadOnly ) ) { + QString s; + QSqlQuery query( QString::null, db ); + while( data.readLine( s, 1024 ) != -1 ) + if( !s.isEmpty() ) { + dlg->setProgress( dlg->progress() + s.length() ); + exec( &query, s ); + } + } else + KMessageBox::sorry( 0, i18n("Can't open the data file containing the label definitions.") ); + + dlg->close( true ); + data.close(); +} + +void SqlTables::exec( QSqlQuery* query, const QString & text ) +{ + if( !query->exec( text ) ) + KMessageBox::sorry( 0, i18n("Can't execute command:
") + text + "
" + query->lastError().databaseText(), "sqlexecerror" ); +} + +void SqlTables::loadConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("SQL"); + sqldata.username = config->readEntry("username", "root"); + sqldata.password = config->readEntry("password", "" ); + sqldata.hostname = config->readEntry("hostname", "localhost" ); + sqldata.database = config->readEntry("database", "kbarcode" ); + sqldata.driver = config->readEntry("driver", "QMYSQL3" ); + sqldata.autoconnect = config->readBoolEntry("autoconnect", false ); +} + +void SqlTables::saveConfig() +{ + KConfig* config = kapp->config(); + + config->setGroup("SQL"); + config->writeEntry("username", sqldata.username ); + config->writeEntry("password", sqldata.password ); + config->writeEntry("hostname", sqldata.hostname ); + config->writeEntry("database", sqldata.database ); + config->writeEntry("driver", sqldata.driver ); + config->writeEntry("autoconnect", sqldata.autoconnect ); + + config->sync(); +} + +void SqlTables::updateTables() +{ + /* Older versions of KBarcode did only + * support MySQL. As a reason, databases + * do not need to be updated for other DBs + * as they have already been created with the most + * recent database structures. + */ + if( sqldata.driver != "QMYSQL3" ) + return; + + bool changed = false; + // check for field0 - field9 (1.4.0) + QStringList fields; + for( unsigned int i = 0; i < 10; i++ ) + fields.append( QString("field%1").arg( i ) ); + + QSqlQuery query("SHOW FIELDS FROM " TABLE_BASIC ); + while ( query.next() ) + if( fields.grep( query.value( 0 ).toString(), false ).count() ) { + fields.remove( query.value( 0 ).toString() ); + } + + if( fields.count() ) { + QSqlQuery q; + for( unsigned int i = 0; i < 10; i++ ) + q.exec("ALTER TABLE " TABLE_BASIC " ADD " + fields[i] + " varchar(50)"); + + qDebug("changing fields"); + changed = true; + } + + // change barcode_no from varchar to TEXT (1.5.0) + QSqlQuery query2("SHOW FIELDS FROM " TABLE_BASIC ); + while( query2.next() ) + if( query2.value( 0 ).toString() == "barcode_no" && query2.value(1) == "varchar(50)" ) { + query2.exec( "ALTER TABLE " TABLE_BASIC " CHANGE barcode_no barcode_no TEXT" ); + changed = true; + } + + // change barcode_no from varchar to TEXT (1.5.0) + QSqlQuery query3("SHOW FIELDS FROM " TABLE_CUSTOMER_TEXT ); + while( query3.next() ) + if( query3.value( 0 ).toString() == "barcode_no" && query3.value(1) == "varchar(50)" ) { + query3.exec( "ALTER TABLE " TABLE_CUSTOMER_TEXT " CHANGE barcode_no barcode_no TEXT" ); + changed = true; + } + + // change NUMERIC DEFAULT TO NUMERIC(10,4) (1.6.1) + QStringList update; + update << "gap_top" << "gap_left" << "height" << "width" << "gap_v" << "gap_h"; + QSqlQuery query4("SHOW FIELDS FROM " TABLE_LABEL_DEF ); + while( query4.next() ) + if( update.contains( query4.value( 0 ).toString() ) && query4.value(1).toString() == "decimal(10,0)" ) { + QSqlQuery q; + q.exec( QString("ALTER TABLE " TABLE_LABEL_DEF " CHANGE ") + + query4.value( 0 ).toString() + " " + query4.value( 0 ).toString() + " NUMERIC(10,4)" ); + changed = true; + } + + if( changed ) + KMessageBox::information( 0, i18n("The SQL tables of KBarcode have changed since the last version. " + "KBarcode updated them without any loss of data." ) ); +} + +bool SqlTables::testSettings( const QString & username, const QString & password, const QString & hostname, const QString & database, const QString & driver ) +{ + QSqlDatabase* db = QSqlDatabase::addDatabase( driver ); + if( !drivers[driver] ) + return false; + + db->setDatabaseName( database ); + db->setUserName( username ); + db->setPassword( password ); + db->setHostName( hostname ); + + if( !db->open() ) + { + QSqlDatabase::removeDatabase( database ); + } + else + { + KMessageBox::information( 0, i18n("Connected successfully to your database") ); + db->close(); + QSqlDatabase::removeDatabase( database ); + return true; + } + + db = QSqlDatabase::addDatabase( driver ); + + db->setDatabaseName( drivers[driver]->initdb( database ) ); + + db->setUserName( username ); + db->setPassword( password ); + db->setHostName( hostname ); + + if( !db->open() ) { + KMessageBox::error( 0, i18n("Connection failed:
") + database + "
" + + db->lastError().databaseText() + "
" ); + QSqlDatabase::removeDatabase(drivers[driver]->initdb( database )); + return false; + } else { + KMessageBox::information( 0, i18n("Connected successfully to your database") ); + db->close(); + QSqlDatabase::removeDatabase(drivers[driver]->initdb( database )); + return true; + } + +} + +const QString SqlTables::getBarcodeMaxLength( const QString & name ) +{ + if( SqlTables::isConnected() ) + { + QSqlQuery query("select uid, (length(barcode_no)) as LEN from " TABLE_BASIC + " where encoding_type = '" + name +"' ORDER by LEN DESC LIMIT 1" ); + + while( query.next() ) { + QSqlQuery queryuid("select barcode_no from barcode_basic where uid = '" + + query.value( 0 ).toString() + "'" ); + while( queryuid.next() ) + if(!queryuid.value( 0 ).toString().isEmpty()) + return queryuid.value( 0 ).toString(); + } + + QSqlQuery query1("select uid, (length(barcode_no)) as LEN from " TABLE_CUSTOMER_TEXT + " where encoding_type = '" + name +"' ORDER by LEN DESC LIMIT 1" ); + + while( query1.next() ) { + QSqlQuery queryuid("select barcode_no from customer_text where uid = '" + + query1.value( 0 ).toString() + "'" ); + while( queryuid.next() ) + if(!queryuid.value( 0 ).toString().isEmpty()) + return queryuid.value( 0 ).toString(); + } + } + + return "1234567"; +} + +SqlWidget::SqlWidget( bool showlabel, QWidget* parent, const char* name ) + : QWidget( parent, name ) +{ + QVBoxLayout* layout = new QVBoxLayout( this ); + + QGroupBox* groupDatabase = new QGroupBox( this ); + groupDatabase->setTitle( i18n( "Database Settings" ) ); + groupDatabase->setColumnLayout(0, Qt::Vertical ); + groupDatabase->layout()->setSpacing( 6 ); + groupDatabase->layout()->setMargin( 11 ); + QVBoxLayout* groupDatabaseLayout = new QVBoxLayout( groupDatabase->layout() ); + groupDatabaseLayout->setAlignment( Qt::AlignTop ); + + QGridLayout* grid = new QGridLayout( 2, 2 ); + + QLabel* label = new QLabel( groupDatabase ); + label->setText( i18n("Username :") ); + grid->addWidget( label, 0, 0 ); + + m_username = new KLineEdit( groupDatabase ); + grid->addWidget( m_username, 0, 1 ); + + label = new QLabel( groupDatabase ); + label->setText( i18n("Password :") ); + grid->addWidget( label, 1, 0 ); + + m_password = new KLineEdit( groupDatabase ); + m_password->setEchoMode( KLineEdit::Password ); + grid->addWidget( m_password, 1, 1 ); + + label = new QLabel( groupDatabase ); + label->setText( i18n("Database :") ); + grid->addWidget( label, 2, 0 ); + + m_database = new KLineEdit( "kbarcode", groupDatabase ); + grid->addWidget( m_database, 2, 1 ); + + label = new QLabel( groupDatabase ); + label->setText( i18n("Host :") ); + grid->addWidget( label, 3, 0 ); + + m_hostname = new KLineEdit( "localhost", groupDatabase ); + grid->addWidget( m_hostname, 3, 1 ); + + label = new QLabel( groupDatabase ); + label->setText( i18n("Driver :") ); + grid->addWidget( label, 4, 0 ); + + m_driver = new KComboBox( false, groupDatabase ); + QStringList drList = QSqlDatabase::drivers(); + QStringList::Iterator it = drList.begin(); + while( it != drList.end() ) { + m_driver->insertItem( *it ); + ++it; + } + grid->addWidget( m_driver, 4, 1 ); + groupDatabaseLayout->addLayout( grid ); + + m_autoconnect = new QCheckBox( i18n("&Autoconnect on program start"), groupDatabase ); + groupDatabaseLayout->addWidget( m_autoconnect ); + + buttonTest = new KPushButton( groupDatabase, "buttonTest" ); + buttonTest->setText( i18n( "&Test Settings" ) ); + + groupDatabaseLayout->addWidget( buttonTest ); + if( showlabel ) + groupDatabaseLayout->addWidget( new QLabel( i18n("You have to test your database settings before you can procede."), groupDatabase ) ); + + layout->add( groupDatabase ); + + connect( buttonTest, SIGNAL( clicked() ), this, SLOT( testSettings() ) ); + + const mysqldata & sqldata = SqlTables::getInstance()->getData(); + m_username->setText( sqldata.username ); + m_password->setText( sqldata.password ); + m_hostname->setText( sqldata.hostname ); + m_database->setText( sqldata.database ); + m_autoconnect->setChecked( sqldata.autoconnect ); + for( int i = 0; i < m_driver->count(); i++ ) + if( m_driver->text(i) == sqldata.driver ) + m_driver->setCurrentItem( i ); +} + +SqlWidget::~SqlWidget() +{ +} + +void SqlWidget::save( bool usedb ) +{ + mysqldata sqldata = SqlTables::getInstance()->getData(); + sqldata.username = m_username->text(); + sqldata.password = m_password->text(); + sqldata.hostname = m_hostname ->text(); + sqldata.database = m_database->text(); + sqldata.driver = m_driver->currentText(); + sqldata.autoconnect = ( usedb ? m_autoconnect->isChecked() : false ); + SqlTables::getInstance()->setData( sqldata ); +} + +void SqlWidget::testSettings() +{ + emit databaseWorking( + SqlTables::getInstance()->testSettings( m_username->text(), m_password->text(), + m_hostname->text(), m_database->text(), + m_driver->currentText() ) ); +} + +const QString SqlWidget::username() const +{ + return m_username->text(); +} + +const QString SqlWidget::driver() const +{ + return m_driver->currentText(); +} + +const QString SqlWidget::database() const +{ + return m_database->text(); +} + +const QString SqlWidget::hostname() const +{ + return m_hostname->text(); +} + +const QString SqlWidget::password() const +{ + return m_password->text(); +} + +bool SqlWidget::autoconnect() const +{ + return m_autoconnect->isChecked(); +} + +int SqlWidget::driverCount() const +{ + return m_driver->count(); +} + + +#include "sqltables.moc" diff --git a/kbarcode/sqltables.h b/kbarcode/sqltables.h new file mode 100644 index 0000000..d78fd21 --- /dev/null +++ b/kbarcode/sqltables.h @@ -0,0 +1,222 @@ +/*************************************************************************** + sqltables.h - description + ------------------- + begin : Son Dez 29 2002 + copyright : (C) 2002 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef SQLTABLES_H +#define SQLTABLES_H + +#include +#include +#include + + +/* Change these values to match your environment: */ +#define TABLE_CUSTOMER "customer" +#define TABLE_CUSTOMER_TEXT "customer_text" +#define TABLE_LABEL_DEF "label_def" +#define TABLE_BASIC "barcode_basic" +/* -------- */ + +// a macro to support QString::replace( QString, QString ) +// also on QT 3.0.x +#if QT_VERSION <= 0x030100 + #include + #define DSREPLACE( x ) QRegExp( x ) +#else + #define DSREPLACE( x ) x +#endif + +// Holds all information +// necessary for connecting +// to a database +typedef struct mysqldata { + QString username; + QString password; + QString hostname; // localhost + QString database; // kbarcode + QString driver; // QMYSQL3 + bool autoconnect; + + void operator=( const mysqldata & rhs ) { + username = rhs.username; + password = rhs.password; + hostname = rhs.hostname; + database = rhs.database; + driver = rhs.driver; + + autoconnect = rhs.autoconnect; + } +}; + + +/** + * This class describes a SQL database (e.g. MySQL or PostgreSQL) + * and its features. + * @author Dominik Seichter + */ +class SqlDescription { + public: + /** return the name of the database we can always + * use to connect to this database. + */ + virtual const QString initdb( QString ) const = 0; + + /** return the auto_increment or serial command used for this db. + */ + virtual const QString autoIncrement() const = 0; + + /** return the command to show all fields of table for this db. + */ + virtual const QString showColumns( const QString & table ) const = 0; +}; + +class QSqlDatabase; +class QSqlQuery; +/** + * This class is used to access a database, create it and save its settings to the + * application configuration file. Also the labeldefinitions and exmplate data + * are imported using this class. + * + * @short This singleton is used to access a database in KBarcode. + * @author Dominik Seichter + */ +class SqlTables : public QObject { + Q_OBJECT + public: + /** get a mysqldata object which contains the current database settings. + * this object is for all sql databases, not only for mysql. The name is just a + * relict from the past ;-) + * @return mysqldata* + */ + const mysqldata & getData() const { + return sqldata; + } + + /** Set the database settings + */ + void setData( const mysqldata & data ) { + sqldata = data; + } + + /** get an instance of this singleton class. Always use this method as there is + * no public constructor. + * @return SqlTables* + */ + static SqlTables* getInstance(); + + /** returns true if KBarcode is connected to a database at the moment. Returns false if not. + * @return bool + */ + static bool isConnected() { + return getInstance()->connected; + } + + const SqlDescription* driver() const; + + public slots: + const QString getBarcodeMaxLength( const QString & name ); + + void loadConfig(); + void saveConfig(); + + /** Connect to a SQL database using breviously configured + * database settings. + * @return bool returns true on success + */ + bool connectMySQL(); + + bool newTables(); + bool newTables( const QString & username, const QString & password, const QString & hostname, const QString & database, const QString & driver ); + void importLabelDef(); + void importExampleData(); + void importData( const QString & filename, QSqlDatabase* db ); + bool testSettings( const QString & username, const QString & password, const QString & hostname, const QString & database, const QString & driver ); + + inline QSqlDatabase* database() const; + + signals: + void tablesChanged(); + void connectedSQL(); + + private: + SqlTables( QObject* parent = 0 ); + ~SqlTables(); + + void exec( QSqlQuery* query, const QString & text ); + void updateTables(); + + bool connected; + + QSqlDatabase* db; + mysqldata sqldata; + + static SqlTables* instance; +}; + +inline QSqlDatabase* SqlTables::database() const +{ + return db; +} + +class KComboBox; +class KLineEdit; +class KPushButton; +class QCheckBox; +/** A widget for configuring a SQL connection. + * It has child widgets for entering data like the + * user name, database name, host name, password + * and the driver. Optionally the user can also + * test if his settings will work. + * + * @author Dominik Seichter + */ +class SqlWidget : public QWidget { + Q_OBJECT + public: + SqlWidget( bool showlabel, QWidget* parent = 0, const char* name = 0 ); + ~SqlWidget(); + + const QString username() const; + const QString driver() const; + const QString database() const; + const QString hostname() const; + const QString password() const; + bool autoconnect() const; + + int driverCount() const; + + void save( bool usedb = true ); + + signals: + void databaseWorking( bool b ); + + private slots: + void testSettings(); + + private: + KComboBox* m_driver; + + KLineEdit* m_username; + KLineEdit* m_database; + KLineEdit* m_hostname; + KLineEdit* m_password; + + QCheckBox* m_autoconnect; + + KPushButton* buttonTest; +}; + +#endif diff --git a/kbarcode/tbarcode2.cpp b/kbarcode/tbarcode2.cpp new file mode 100644 index 0000000..a07ff41 --- /dev/null +++ b/kbarcode/tbarcode2.cpp @@ -0,0 +1,158 @@ +/*************************************************************************** + tbarcode2.cpp - description + ------------------- + begin : Mon Feb 20 2006 + copyright : (C) 2006 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include "tbarcode2.h" +#include "barkode.h" + +#include + +#include +#include + +#include +#include + +TBarcodeOptions::TBarcodeOptions() +{ + defaults(); +} + +void TBarcodeOptions::defaults() +{ + m_escape = false; + m_above = false; + m_autocorrect = false; + m_checksum = 0; + m_modulewidth = 0.353; + m_height = 20; +} + +void TBarcodeOptions::load( const QDomElement* tag ) +{ + this->setModuleWidth( tag->attribute( "tbarcode.modulewidth", "0.353" ).toDouble() ); + this->setEscape( tag->attribute( "tbarcode.escape", "0" ).toInt() ); + this->setAbove( tag->attribute( "tbarcode.above", "0" ).toInt() ); + this->setAutocorrect( tag->attribute ( "tbarcode.autocorrect", "0" ).toInt() ); + this->setCheckSum( tag->attribute( "tbarcode.checksum", "0" ).toInt() ); + this->setHeight( tag->attribute( "tbarcode.height", "0" ).toInt() ); +} + +void TBarcodeOptions::save( QDomElement* tag ) +{ + tag->setAttribute( "tbarcode.modulewidth", this->moduleWidth() ); + tag->setAttribute( "tbarcode.escape", this->escape() ); + tag->setAttribute( "tbarcode.above", this->above() ); + tag->setAttribute( "tbarcode.autocorrect", this->autocorrect() ); + tag->setAttribute( "tbarcode.checksum", this->checksum() ); + tag->setAttribute( "tbarcode.height", this->height() ); +} + +const TBarcodeOptions& TBarcodeOptions::operator=( const BarkodeEngineOptions& rhs ) +{ + const TBarcodeOptions* tbarcode = (dynamic_cast(&rhs)); + + this->m_escape = tbarcode->m_escape; + this->m_above = tbarcode->m_above; + this->m_autocorrect = tbarcode->m_autocorrect; + this->m_checksum = tbarcode->m_checksum; + this->m_modulewidth = tbarcode->m_modulewidth; + this->m_height = tbarcode->m_height; + + return *this; +} + +TBarcode2::TBarcode2() + : PixmapBarcode() +{ + +} + +TBarcode2::~TBarcode2() +{ + +} + +const TBarcode2 & TBarcode2::operator=( const BarkodeEngine & rhs ) +{ + const TBarcode2* barcode = dynamic_cast(&rhs); + + if( barcode ) + { + m_options = barcode->m_options; + } + + return *this; +} + +bool TBarcode2::createPostscript( char** postscript, long* postscript_size ) +{ + QString cmd; + const char* text; + + const TBarcodeOptions* tbarcode = (dynamic_cast(barkode->engine()->options())); + if( !tbarcode ) + return false; + + if( !barkode->textVisible() ) + text = "hide"; + else if( tbarcode->above() ) + text = "above"; + else + text = "below"; + + cmd = cmd.sprintf( "tbarcode -f PS -b %s -d %s -t %s --translation=%s --autocorrect=%s --modulewidth=%.3f -h %i --checkdigit=%i --72dpiraster\n", + barkode->type().latin1(), KShellProcess::quote( barkode->parsedValue() ).latin1(), + text, tbarcode->escape() ? "on" : "off", + tbarcode->autocorrect() ? "on" : "off", + tbarcode->moduleWidth(), + tbarcode->height(), + tbarcode->checksum() ); + + qDebug( "Cmd = " + cmd ); + if( !readFromPipe( cmd.latin1(), postscript, postscript_size ) ) + return false; + + return true; +} + +QRect TBarcode2::bbox( const char* postscript, long postscript_size ) +{ + const char* gs_bbox = "gs -sDEVICE=bbox -sNOPAUSE -q %1 -c showpage quit 2>&1"; + + char* buffer = NULL; + long len = 0; + QRect size; + + KTempFile psfile( QString::null, ".ps" ); + psfile.file()->writeBlock( postscript, postscript_size ); + psfile.file()->close(); + + if( !readFromPipe( QString( gs_bbox ).arg( psfile.file()->name() ).latin1(), &buffer, &len ) || !len ) + { + psfile.unlink(); + return QRect( 0, 0, 0, 0 ); + } + else + psfile.unlink(); + + size = PixmapBarcode::bbox( buffer, len ); + free( buffer ); + + return size; + +} + diff --git a/kbarcode/tbarcode2.h b/kbarcode/tbarcode2.h new file mode 100644 index 0000000..30b70d9 --- /dev/null +++ b/kbarcode/tbarcode2.h @@ -0,0 +1,89 @@ +/*************************************************************************** + tbarcode2.h - description + ------------------- + begin : Mon Feb 20 2006 + copyright : (C) 2006 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef TBARCODE2_H +#define TBARCODE2_H + +#include "pixmapbarcode.h" + +class QDomElement; + +/** A small class which contains all the options + * which can be configured for tbarcode + */ +class TBarcodeOptions : public BarkodeEngineOptions { + public: + TBarcodeOptions(); + + const TBarcodeOptions& operator=( const BarkodeEngineOptions& rhs ); + void defaults(); + + void load( const QDomElement* tag ); + void save( QDomElement* tag ); + + inline bool escape() const { return m_escape; } + inline bool above() const { return m_above; } + inline bool autocorrect() const { return m_autocorrect; } + inline int checksum() const { return m_checksum; } + inline double moduleWidth() const { return m_modulewidth; } + inline int height() const { return m_height; } + + inline void setEscape( bool b ) { m_escape = b; } + inline void setAbove( bool b ) { m_above = b; } + inline void setAutocorrect( bool b ) { m_autocorrect = b; } + inline void setModuleWidth( double d ) { m_modulewidth = d; } + inline void setCheckSum( int i ) { m_checksum = i; } + inline void setHeight( int i ) { m_height = i; } + private: + bool m_escape; + bool m_above; + bool m_autocorrect; + double m_modulewidth; + int m_checksum; + int m_height; +}; + +class TBarcode2 : public PixmapBarcode { + public: + TBarcode2(); + ~TBarcode2(); + + const TBarcode2 & operator=( const BarkodeEngine & rhs ); + + inline EEngine engine() const; + + inline BarkodeEngineOptions* options(); + + private: + virtual bool createPostscript( char** postscript, long* postscript_size ); + virtual QRect bbox( const char* postscript, long postscript_size ); + + private: + TBarcodeOptions m_options; +}; + +EEngine TBarcode2::engine() const +{ + return TBARCODE2; +} + +BarkodeEngineOptions* TBarcode2::options() +{ + return &m_options; +} + +#endif /* TBARCODE2_H */ diff --git a/kbarcode/tcanvasitem.cpp b/kbarcode/tcanvasitem.cpp new file mode 100644 index 0000000..f770a63 --- /dev/null +++ b/kbarcode/tcanvasitem.cpp @@ -0,0 +1,221 @@ +/*************************************************************************** + tcanvasitem.cpp - description + ------------------- + begin : Do Sep 2 2004 + copyright : (C) 2004 by Dominik Seichter + email : domseichter@web.de + ***************************************************************************/ + +/*************************************************************************** + + 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. + + ***************************************************************************/ + +#include "tcanvasitem.h" +#include "mycanvasitem.h" +#include "mycanvasview.h" +#include "imageitem.h" + +#include +#include + +TCanvasItem::TCanvasItem( MyCanvasView* cv ) + : QCanvasRectangle( cv->canvas() ), + ReferenceCounted() +{ + m_view = cv; + m_item = NULL; + show(); +} + +TCanvasItem::~TCanvasItem() +{ + if( m_item ) + delete m_item; +} + +void TCanvasItem::setZ( double z ) +{ + QCanvasRectangle::setZ( z ); + + if( m_item ) + m_item->setZ( (int)z ); +} + +void TCanvasItem::setSize( int width, int height ) +{ + QCanvasRectangle::setSize( width, height ); + + if( m_item ) + { + m_item->setSize( width, height ); + + if( m_item->rtti() == eRtti_Image ) + { + ImageItem* img = static_cast(m_item); + img->updateImage(); + } + + update(); + } +} + +void TCanvasItem::setSizeMM( int w, int h ) +{ + if( m_item ) + { + m_item->setSizeMM( w, h ); + QCanvasRectangle::setSize( m_item->boundingRect().width(), m_item->boundingRect().height() ); + } +} + +void TCanvasItem::moveBy( double dx, double dy ) +{ + QCanvasRectangle::moveBy( dx, dy ); + + if( m_item ) + { + m_item->move( (int)x() - m_view->getTranslation().x(), (int)y() - m_view->getTranslation().y() ); + update(); + } +} + +void TCanvasItem::moveByMM( int x, int y ) +{ + moveMM( m_item->rectMM().x() + x, m_item->rectMM().y() + y ); +} + +void TCanvasItem::moveMM( int x, int y ) +{ + if( m_item ) + { + LabelUtils l; + // the QCanvasRectangle::move is done before the real move + // as we get dancing TCanvasItems on the screen otherwise + QCanvasRectangle::move( l.mmToPixel( x / 1000.0, m_view, LabelUtils::DpiX ) + m_view->getTranslation().x(), + l.mmToPixel( y / 1000.0, m_view, LabelUtils::DpiY ) + m_view->getTranslation().y() ); + m_item->moveMM( x, y ); + } +} + +void TCanvasItem::drawShape (QPainter & painter) +{ + painter.save(); + + if( m_item ) + { + if( z() != (int)m_item->z() ) + QCanvasRectangle::setZ( m_item->z() ); + + painter.save(); + painter.setClipRect( boundingRect(), QPainter::CoordPainter ); + painter.translate( m_view->getTranslation().x(), m_view->getTranslation().y() ); + m_item->draw( &painter ); + painter.restore(); + } + + // draw edges + if( isSelected() ) { + const QPixmap* spot = SpotProvider::getInstance()->spot(); + painter.translate( x(), y() ); + + // top left + painter.drawPixmap( 0, 0, *spot ); + // bottom left + painter.drawPixmap( 0, height()-SPOTSIZE, *spot ); + // top right + painter.drawPixmap( width()-SPOTSIZE, 0, *spot ); + // bottom left + painter.drawPixmap( width()-SPOTSIZE, height()-SPOTSIZE, *spot ); + + if( (width() - 2 * SPOTSIZE ) / 2 > SPOTSIZE ) { + // top middle + painter.drawPixmap( (width()-SPOTSIZE)/2, 0, *spot ); + // bottom middle + painter.drawPixmap( (width()-SPOTSIZE)/2, height()-SPOTSIZE, *spot ); + } + + if( (height() - 2 * SPOTSIZE ) / 2 > SPOTSIZE ) { + // left middle + painter.drawPixmap( 0, (height()-SPOTSIZE)/2, *spot ); + // right middle + painter.drawPixmap( width() - SPOTSIZE, (height()-SPOTSIZE)/2, *spot ); + } + } + painter.restore(); +} + +void TCanvasItem::setItem (DocumentItem* item) +{ + if( m_item ) + m_item->setCanvasItem( NULL ); + + m_item = item; + + if( m_item ) + { + m_item->setCanvasItem( this ); + this->setZ( m_item->z() ); + + QCanvasRectangle::move( m_item->boundingRect().x() + m_view->getTranslation().x(), m_item->boundingRect().y() + m_view->getTranslation().y() ); + QCanvasRectangle::setSize( m_item->boundingRect().width(), m_item->boundingRect().height() ); + update(); + } +} + +DocumentItem* TCanvasItem::item () const +{ + return m_item; +} + +void TCanvasItem::update() +{ + QCanvasRectangle::update(); +} + +int TCanvasItem::rtti() const +{ + if( m_item ) + return m_item->rtti(); + else + return 0; +} + +MyCanvasView* TCanvasItem::canvasView() const +{ + return m_view; +} + + + +void TCanvasItem::show() +{ + if (!isVisible()) + { + this->addRef(); + ((QCanvasItem*) this)->show(); + } +} + +void TCanvasItem::hide() +{ + if (refCount()==1) + { + if (isVisible()) + { + this->remRef(); + } + } + else + { + if (isVisible()) + { + ((QCanvasItem*) this)->hide(); + this->remRef(); + } + } +} diff --git a/kbarcode/tcanvasitem.h b/kbarcode/tcanvasitem.h new file mode 100644 index 0000000..7493fa8 --- /dev/null +++ b/kbarcode/tcanvasitem.h @@ -0,0 +1,57 @@ + +#ifndef TCANVASITEM_H +#define TCANVASITEM_H +#include +#include + +#include "documentitem.h" +#include "referencecounted.h" + +class MyCanvasView; +/** + * Class TCanvasItem + * Represents a DocumentItem on a QCanvas. + * This class is also responsible for drawing + * the drag marks provided by SpotProvider. + * + * The class is also ReferenceCounted!!! + */ +class TCanvasItem : public QCanvasRectangle, public ReferenceCounted { +public: + + TCanvasItem ( MyCanvasView* cv ); + ~TCanvasItem ( ); + + void update(); + + int rtti() const; + + void setZ( double z ); + void moveBy( double x, double y ); + void setSize( int width, int height ); + + void moveMM( int x, int y ); + void moveByMM( int x, int y ); + void setSizeMM( int w, int h ); + + void show(); + void hide(); + + void setItem (DocumentItem* item); + DocumentItem* item () const; + + MyCanvasView* canvasView() const; + +protected: + /** + * + * @param painter + */ + void drawShape ( QPainter & p ); + +private: + DocumentItem* m_item; + MyCanvasView* m_view; +}; +#endif //TCANVASITEM_H + diff --git a/kbarcode/tec.cpp b/kbarcode/tec.cpp new file mode 100644 index 0000000..174806e --- /dev/null +++ b/kbarcode/tec.cpp @@ -0,0 +1,658 @@ +// +// C++ Implementation: tec +// +// Description: +// +// +// Author: Dominik Seichter , (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "tec.h" +#include "kbarcodesettings.h" +#include "tokenprovider.h" + +// Other includes +#include +#include +#include +#include +#include +#include + +// QT includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAXDATASIZE 32550 + +QString tec452(const QString &url, int count, const QString &art, const QString &group, const QString &id) +{ + QString filename; + QString result; + int countBar=0; + int countText=0; + +// if( url.isEmpty() ) { +// return open(); +// } + + filename = url; + //setCaption( filename, false ); + + QFile f( filename ); + if ( !f.open( IO_ReadOnly ) ) + return false; + + //clearLabel(); + + QDomDocument doc( "KBarcodeLabel" ); + if ( !doc.setContent( &f ) ) { + f.close(); + return false; + } + f.close(); + + QDomNode n = doc.documentElement().firstChild(); + // this should not be neccessary, + // but