diff options
author | (no author) <(no author)@f5e0f49d-192f-0410-a22d-a8d8700d0965> | 2002-08-21 02:27:32 +0000 |
---|---|---|
committer | (no author) <(no author)@f5e0f49d-192f-0410-a22d-a8d8700d0965> | 2002-08-21 02:27:32 +0000 |
commit | 80226360c0bd03dc2fb5c22f4e8311570dc5749d (patch) | |
tree | be36cfe64cd72d4c3b8bd0251fab2b0db0c99580 | |
parent | f6ff99094d3186251143d610868179191c9ebc51 (diff) |
This commit was manufactured by cvs2svn to create branch 'vendor'.
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/branches/vendor@40 f5e0f49d-192f-0410-a22d-a8d8700d0965
255 files changed, 73536 insertions, 0 deletions
diff --git a/glabels2/AUTHORS b/glabels2/AUTHORS new file mode 100644 index 0000000..9eb13bb --- /dev/null +++ b/glabels2/AUTHORS @@ -0,0 +1,73 @@ +gLabels Author +============== + +Jim Evins <evins@snaught.com> + +Acknowledgments +=============== + +Contributors: + Akkana <akkana@shallowsky.com> + nestor di <nestordi@usuarios.retecal.es> -- excellent splash screen + that first appeared in + 0.4.3: + + +The GNU Barcode Library provides a large chunk of the barcode functionality +and is distributed with glabels. See ./barcode-0.98/README for more +information. The author: + + Alessandro Rubini <rubini@gnu.org> + + +I borrowed the hacktext canvas item from libgnomeprint to render text that +is faithful to the final printed product. Original authors of the hacktext +canvas item: + + Federico Mena <federico@nuclecu.unam.mx>, + Raph Levien <raph@acm.org>, + Lauris Kaplinski <lauris@helixcode.com> + + +I borrowed quite a bit of code from gedit2 to create the bonobo-mdi shell for +gLabels. The authors of gedit2: + + Paolo Maggi <maggi@athena.polito.it> + Chema Celorio <chema@ximian.com> + James Willcox <jwillcox@cs.indiana.edu> + Federico Mena Quintero <federico@ximian.com> + + +Translations: + + Olivier Berger <oberger@april.org> -- French + Marcus Bauer <m@7n7.de> -- German + Takeshi AIHANA <aihana@gnome.gr.jp> -- Japanese + Paulo Rogério Ormenese <pormenese@uol.com.br> -- Brazilian Portuguese + + +The following people have submitted label templates or information about +particular products: + + Hap <hap1@home.net> + Olivier Berger <oberger@april.org> + Marcus Bauer <m@7n7.de> + Jochen Hein <jochen@jochen.org> + Jonathan Buzzard <jonathan@buzzard.org.uk> + Jeff Davis <jdavis@hess.com> + Ludger Solbach <soulman@zhadum.de> + Darren Ross <darren@freebirdtech.com> + George Mitchell <ghmitch@neteze.com> + Douglas Bollinger <dcb@321.net> + Tim Jackson <tim@timj.co.uk> + John Stoffel <john@stoffel.org> + Dany De Bontridder <dany.db@chello.be> + Andy Longton <alongton@metamark.com> + Bostjan Muller <neonatus@neonatus.net> + John Helms <jhelms@pczplus.com> + no-exit <no-exit@plunge.net> + Mozilla from marela <mozilla@marela.com> + Holger <holger@lange-online.net> + + +And many others for their many helpful suggestions and bug reports -- thanks. diff --git a/glabels2/COPYING b/glabels2/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/glabels2/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/glabels2/ChangeLog diff --git a/glabels2/INSTALL b/glabels2/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/glabels2/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/glabels2/Makefile.am b/glabels2/Makefile.am new file mode 100644 index 0000000..74f2a8d --- /dev/null +++ b/glabels2/Makefile.am @@ -0,0 +1,58 @@ +## Process this file with automake to produce Makefile.in + +LIB_BARCODE_DIR = barcode-0.98 + +SUBDIRS = po src doc + +EXTRA_DIST = \ + glabels.desktop glabels.spec.in glabels.spec + +Applicationsdir = $(datadir)/gnome/apps/Applications +Applications_DATA = glabels.desktop + +pixmapdir=$(datadir)/pixmaps/glabels +configdir=$(datadir)/glabels + +install-data-local: + @$(NORMAL_INSTALL) + if test -d $(srcdir)/pixmaps; then \ + $(mkinstalldirs) $(pixmapdir); \ + for pixmap in $(srcdir)/pixmaps/*; do \ + if test -f $$pixmap; then \ + $(INSTALL_DATA) $$pixmap $(pixmapdir); \ + fi \ + done \ + fi + if test -d $(srcdir)/data; then \ + $(mkinstalldirs) $(configdir); \ + for file in $(srcdir)/data/*.template; do \ + if test -f $$file; then \ + $(INSTALL_DATA) $$file $(configdir); \ + fi \ + done \ + fi + +dist-hook: + if test -d pixmaps; then \ + mkdir $(distdir)/pixmaps; \ + for pixmap in pixmaps/*; do \ + if test -f $$pixmap; then \ + cp -p $$pixmap $(distdir)/pixmaps; \ + fi \ + done \ + fi + if test -d data; then \ + mkdir $(distdir)/data; \ + for file in data/*.template; do \ + if test -f $$file; then \ + cp -p $$file $(distdir)/data; \ + fi \ + done \ + fi + if test -d $(LIB_BARCODE_DIR); then \ + if test -f $(LIB_BARCODE_DIR)/Makefile; then \ + (cd $(LIB_BARCODE_DIR); $(MAKE) distclean); \ + fi; \ + mkdir $(distdir)/$(LIB_BARCODE_DIR); \ + cp -rp $(LIB_BARCODE_DIR)/* $(distdir)/$(LIB_BARCODE_DIR); \ + fi diff --git a/glabels2/Makefile.in b/glabels2/Makefile.in new file mode 100644 index 0000000..ccf2591 --- /dev/null +++ b/glabels2/Makefile.in @@ -0,0 +1,452 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +LIB_BARCODE_DIR = barcode-0.98 + +SUBDIRS = po src doc + +EXTRA_DIST = glabels.desktop glabels.spec.in glabels.spec + + +Applicationsdir = $(datadir)/gnome/apps/Applications +Applications_DATA = glabels.desktop + +pixmapdir = $(datadir)/pixmaps/glabels +configdir = $(datadir)/glabels +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = glabels.spec +DATA = $(Applications_DATA) + +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in \ +configure configure.in glabels.spec.in install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: +glabels.spec: $(top_builddir)/config.status glabels.spec.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +install-ApplicationsDATA: $(Applications_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(Applicationsdir) + @list='$(Applications_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(Applicationsdir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(Applicationsdir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(Applicationsdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(Applicationsdir)/$$p; \ + fi; fi; \ + done + +uninstall-ApplicationsDATA: + @$(NORMAL_UNINSTALL) + list='$(Applications_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(Applicationsdir)/$$p; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" != "." || dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: install-ApplicationsDATA install-data-local +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-ApplicationsDATA +uninstall: uninstall-recursive +all-am: Makefile $(DATA) config.h +all-redirect: all-recursive-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(Applicationsdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +uninstall-ApplicationsDATA install-ApplicationsDATA \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-local install-data-am \ +install-data install-am install uninstall-am uninstall all-redirect \ +all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +install-data-local: + @$(NORMAL_INSTALL) + if test -d $(srcdir)/pixmaps; then \ + $(mkinstalldirs) $(pixmapdir); \ + for pixmap in $(srcdir)/pixmaps/*; do \ + if test -f $$pixmap; then \ + $(INSTALL_DATA) $$pixmap $(pixmapdir); \ + fi \ + done \ + fi + if test -d $(srcdir)/data; then \ + $(mkinstalldirs) $(configdir); \ + for file in $(srcdir)/data/*.template; do \ + if test -f $$file; then \ + $(INSTALL_DATA) $$file $(configdir); \ + fi \ + done \ + fi + +dist-hook: + if test -d pixmaps; then \ + mkdir $(distdir)/pixmaps; \ + for pixmap in pixmaps/*; do \ + if test -f $$pixmap; then \ + cp -p $$pixmap $(distdir)/pixmaps; \ + fi \ + done \ + fi + if test -d data; then \ + mkdir $(distdir)/data; \ + for file in data/*.template; do \ + if test -f $$file; then \ + cp -p $$file $(distdir)/data; \ + fi \ + done \ + fi + if test -d $(LIB_BARCODE_DIR); then \ + if test -f $(LIB_BARCODE_DIR)/Makefile; then \ + (cd $(LIB_BARCODE_DIR); $(MAKE) distclean); \ + fi; \ + mkdir $(distdir)/$(LIB_BARCODE_DIR); \ + cp -rp $(LIB_BARCODE_DIR)/* $(distdir)/$(LIB_BARCODE_DIR); \ + fi + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/NEWS b/glabels2/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/glabels2/NEWS diff --git a/glabels2/README b/glabels2/README new file mode 100644 index 0000000..b7e1715 --- /dev/null +++ b/glabels2/README @@ -0,0 +1,83 @@ +Copyright +========= + + gLabels - a GNOME-based label and business card creation program + + Copyright (C) 2001-2002 Jim Evins + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more details see the file COPYING. + + + +What is gLabels +=============== + +gLabels is a small stand-alone program for creating labels and business +cards using a laser or ink-jet printer. + +System Requirements +=================== + +GTK+-2.0.x +LIBGNOMEUI-2.0.x +LIBXML-2.4.x +LIBGNOMEPRINT-1.115 +LIBGNOMEPRINTUI-1.115 +LIBGNOMECANVAS-2.0.x +GDK-PIXBUF-2.0.x + +All of these libraries are available as part of Gnome 2.0.1 + +Usage notes: +============ +gLabels is still in its early stages of development and thus lacks any +"real" documentation. Most folks have found it fairly easy to use, at +least for its simple composition features. Beginning with version 0.4.x, +gLabels has a document-merge capability that might not be as intuitive +as these other features. + +The first step to performing a document merge is to prepare a source +document that contains your merge data. This data could be mailing +addresses or any other data that you wish to create unique labels or +cards for. Currently only a simple back-end for text files exists -- +others are planned. The currently supported text-file format is very +simple: each line is a record; fields are delimited by tabs, +commas, or colons; and newlines can be embedded into fields by using +the "\n" entity. This file could be created using any text editor or +could be created by another program or script. + +A label must then be configured to "point at" this data file. This is +accomplished with the "merge properties" dialog. This dialog is used +to select the exact data file format and file name (location). Customized +field keys can also be defined (the default keys are the column numbers). + +Finally, once the label has been configured for a data file, field keys +can be inserted into text and barcode objects in their property dialogs. + +Now that your label is configured, gLabels will print a unique label for +each record in your source document -- substituting fields from each +record for field keys in the all text and barcode objects. + +Beginning with 0.4.3, a simple CLI front-end called "glabels-batch" is +provided to print previously created glabels files from a shell, +other programs or scripts. Do a "glabels-batch --help" for usage +information. + +Author and Acknowledgments: +=========================== + +See the AUTHORS file. diff --git a/glabels2/TODO b/glabels2/TODO new file mode 100644 index 0000000..2252025 --- /dev/null +++ b/glabels2/TODO @@ -0,0 +1,189 @@ + +Development plan +---------------- +This development plan sets a specific set of milestones for future +versions of glabels. Although subject to change, milestones leading +to version 2.0 are fairly well defined. + +Basically the goal of version 1.90 is to port all current +features/capabilities to the GNOME 2.0 platform, clean up the architecture, +and create a bonobo-mdi shell. + +The goal for version 1.92 is to improve several user interface capabilities +and add drawing capabilities. + +The goal for version 2.0 is to realize the fully developed template feature +set, add tools for creating and downloading new templates, and add inline +images to glabels files. + +The goals for version 2.2 and beyond is to add sophisticated text effects +and support vector images. + + +Detailed Outline: +----------------- + +VERSION 1.89: Development testbed for VERSION 1.90 + +VERSION 1.90: + + Architecture Design + + - Port to Gnome 2.0 Platform + + - Create a new MDI shell based on bonoboMDI (see gedit2). + + - Migrate to a more faithful MVC architecture: + - Migrate models (labels, label objects, and templates) + to real objects + - Views should track models + + Label File format changes: + - <object type="text" ...> rather than <Text ...> + + - a label should include a template or "Sheet" tag instead + of just the name of the media type, so that obsolete names + don't render the label file useless. this should be created + and parsed by functions from the template module. + + - compatibility with old file formats + + - make sure that the format does not preclude the additions + planned in future releases and that these additions do + not break labels created with this version. Namely, image + filenames from merge data, inline images, object rotation, + object flipping, text effects, and rounded rectangles. + + Other: + - Add preferences options: + - MDI style [*] + - object defaults (colors, line widths, fonts) + + [*] These only need to be supported through gconf. + + + - Support all paper sizes that gnome-print knows about + + - Recent documents + + +VERSION 1.91: Development testbed for VERSION 1.92 + +VERSION 1.92: + + Template File format: + - Allow multiple layouts per label type. This will support + odd labels that are not layed out in a grid. For instance + one oddball label, or label laid out in a running-bond: + + +------+ +------+ + | | | | + +------+ +------+ + +------+ +------+ + | | | | + +------+ +------+ + ... + + This is not multiple label types per sheet. (see below) + + - Add invisible markup to templates, e.g. folds or other + helpful lines. + + Other: + - Status bar showing: + - % Zoom + - X, Y position + - mode and parameters (size and origin during creation) + + - Undo, Redo capability + + - Image filenames from merge fields. When adding inline + image date in the next version, this capability must + remain valid. + + - Drawing features: + - object rotation and flipping functions. + - configurable grid. Also add a "snap-to" capability. + - object alignment capabilities. + - resizing of barcodes on canvas. (Must keep barcodes + within "legal" limits) + + - Add rounding option to rectangles + + - Place property dialogs in a single dockable window (1 per + MDI/app window). Move dialogs associated with view, + when a new MDI/app window is created. + + - Change label types on-the-fly. This should probably be + some form of property of the label. Perhaps, a right-click + away from any selection. + + + +VERSION 1.93: Development testbed for VERSION 2.0 + +VERSION 2.0: + + Label File format changes: + - external images should be put inline somehow so that the + label file will not be rendered useless if on a different + machine or the original image file is renamed, moved or + deleted. + + Features: + - Create a druid for creating new label templates. + As part of the druid allow test sheets to be printed + and the new labels e-mailed to me (at the user's request). + Include a mini-preview, as the label is constructed. + + - Along those same lines, create a druid to download new + templates from a central repository, much like in GBonds. + +VERSION 2.1: Development testbed for VERSION 2.2 + +VERSION 2.2: + + Template File format: + - Allow multiple label styles per template. For instance + a sheet may contain a CD label, and cover label. This + may cause problems for document merges -- labels could be + considered grouped for document merges when their numbers + match or they could have document merge applied to them + independently but in parallel. Arrange in a tabbed + notebook, or as multiple canvases arranged in view? + + - support for the import of vector graphics formats such as EPS or SVG. + + - Text effects. (follow contour, shadows, ...) + + + +Odds and ends WISHLIST for future versions: + + - Ability to select/unselect individual records during a merge-print. + + - Add additional "merge" backends. Candidates include: + vCard + generic XML + freedb (CDDB) for CD labels + + - Capability to edit text in-place. + + - Add facility for tweaking output (origin). This should really be + part of the underlying print system but is currently difficult to + accomplish, so I may want to add the hack. + + - Make text items rich. I.e. allow multiple characteristics to + exist within a single object. + + - Add a mini style preview for barcode properties (possibly text too?). + + - Eye candy: Create a custom widget to replace spin buttons for + positioning and sizing that have arrows in the proper direction. + Really bad ASCII art: + + <- X -> + + ->||<- W |<-->| + + diff --git a/glabels2/acconfig.h b/glabels2/acconfig.h new file mode 100644 index 0000000..7e95887 --- /dev/null +++ b/glabels2/acconfig.h @@ -0,0 +1,13 @@ +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef PACKAGE +#undef VERSION +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR +#undef GETTEXT_PACKAGE +#undef HACKTEXT diff --git a/glabels2/aclocal.m4 b/glabels2/aclocal.m4 new file mode 100644 index 0000000..d406fd9 --- /dev/null +++ b/glabels2/aclocal.m4 @@ -0,0 +1,847 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN([AM_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<<am_indx=1 +for am_file in <<$1>>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +dnl +dnl GNOME_PLATFORM_GNOME_2(default, [force]) +dnl +dnl If the first parameter is `yes', then the default is +dnl the GNOME 2.x platform, otherwise the GNOME 1.x one. +dnl +dnl If the optional second parameter is `force', then use +dnl the default value without command line argument. +dnl + +AC_DEFUN([GNOME_PLATFORM_GNOME_2],[ + AC_REQUIRE([GNOME_REQUIRE_PKGCONFIG]) + + if test x$1 = xyes ; then + platform_gnome_2_default=yes + else + platform_gnome_2_default=no + fi + if test x$2 = xforce ; then + platform_gnome_2="$platform_gnome_2_default"; + else + AC_ARG_ENABLE(platform-gnome-2, [ --enable-platform-gnome-2 enable GNOME 2.x platform [default=no]],[platform_gnome_2="$enableval"],[platform_gnome_2="$platform_gnome_2_default"]) + fi + + AM_CONDITIONAL(PLATFORM_GNOME_2, test $platform_gnome_2 = yes) + + AC_MSG_CHECKING(for GNOME Platform) + if test $platform_gnome_2 = yes; then + AC_MSG_RESULT(GNOME 2.x) + GNOME_INTERFACE_VERSION=2 + GNOME_REQUIRE_PKGCONFIG + else + AC_MSG_RESULT(GNOME 1.x) + GNOME_INTERFACE_VERSION=1 + fi + AC_SUBST(GNOME_INTERFACE_VERSION) +]) + +dnl +dnl GNOME_CHECK_PKGCONFIG (script-if-enabled, [failflag]) +dnl +AC_DEFUN([GNOME_CHECK_PKGCONFIG],[ + AC_PATH_PROG(PKG_CONFIG, pkg-config) + have_pkgconfig=no + if test -x "$PKG_CONFIG" ; then + have_pkgconfig=yes + else + PKG_CONFIG= + fi + AC_MSG_CHECKING(for pkg-config) + pkgconfig_required_version=0.8.0 + if test x$have_pkgconfig = xyes ; then + $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version + if test $? -ne 0; then + echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + have_pkgconfig=no + fi + fi + if test x$have_pkgconfig = xyes ; then + AC_MSG_RESULT(yes) + else + PKG_CONFIG= + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR([ +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig.]) + fi + fi + AC_SUBST(PKG_CONFIG) + + AC_PROVIDE([GNOME_REQUIRE_PKGCONFIG]) +]) + +dnl +dnl GNOME_REQUIRE_PKGCONFIG +dnl +AC_DEFUN([GNOME_REQUIRE_PKGCONFIG],[ + GNOME_CHECK_PKGCONFIG([], fail) +]) + +#serial 1 +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN([AM_PROG_CC_STDC], +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + dnl ****************************** + dnl More compiler warnings + dnl ****************************** + + if test -z "$1" ; then + default_compile_warnings=no + else + default_compile_warnings="$1" + fi + + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes/maximum/error] Turn on compiler warnings.], [enable_compile_warnings="$enableval"],[enable_compile_warnings="$default_compile_warnings"]) + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall -Wunused" + ;; + yes) + warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" + ;; + maximum|error) + warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wsign-promo -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_RESULT($has_option) + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) + ;; + esac + CFLAGS="$realsave_CFLAGS" + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + AC_MSG_RESULT($warning_flags) + + AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + + WARN_CFLAGS="$warning_flags $complCFLAGS" + AC_SUBST(WARN_CFLAGS) +]) + +dnl For C++, do basically the same thing. + +AC_DEFUN([GNOME_CXX_WARNINGS],[ + AC_ARG_ENABLE(cxx-warnings, + [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) + warnCXXFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + if test "x$enable_cxx_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCXXFLAGS="-Wall -Wno-unused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_cxx_warnings" = "xyes"; then + warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual" + fi + fi + fi + AC_MSG_RESULT($warnCXXFLAGS) + + AC_ARG_ENABLE(iso-cxx, + [ --enable-iso-cxx Try to warn if code is not ISO C++ ],, + enable_iso_cxx=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) + complCXXFLAGS= + if test "x$enable_iso_cxx" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CXXFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; + esac + + case " $CXXFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCXXFLAGS) + if test "x$cxxflags_set" != "xyes"; then + CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" + cxxflags_set=yes + AC_SUBST(cxxflags_set) + fi +]) + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + +# Macro to add for using GNU gettext. +# Ulrich Drepper <drepper@cygnus.com>, 1995. +# +# Modified to never use included libintl. +# Owen Taylor <otaylor@redhat.com>, 12/15/1998 +# +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. +# +# +# If you make changes to this file, you MUST update the copy in +# acinclude.m4. [ aclocal dies on duplicate macros, so if +# we run 'aclocal -I macros/' then we'll run into problems +# once we've installed glib-gettext.m4 :-( ] +# + +# serial 5 + +AC_DEFUN(AM_GLIB_WITH_NLS, + dnl NLS is obligatory + [USE_NLS=yes + AC_SUBST(USE_NLS) + + dnl Figure out what method + nls_cv_force_use_gnu_gettext="no" + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If gettext or catgets are available (in this order) we + dnl use this. Else we have to fall back to GNU NLS library. + dnl catgets is only used if permitted by option --with-catgets. + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, + [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")], + gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)]) + + if test "$gt_cv_func_dgettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for dgettext in libintl], + gt_cv_func_dgettext_libintl, + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes, + gt_cv_func_dgettext_libintl=no)], + gt_cv_func_dgettext_libintl=no)]) + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + LIBS="$LIBS -lintl"; + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT,1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_CHECK_FUNCS(dcgettext) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + INSTOBJEXT=.mo + fi + fi + + # Added by Martin Baulig 12/15/98 for libc5 systems + if test "$gt_cv_func_dgettext_libc" != "yes" \ + && test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS=-lintl + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + dnl Neither gettext nor catgets in included in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" != "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [always defined to indicate that i18n is enabled]) + else + dnl Unset this variable since we use the non-zero value as a flag. + CATOBJEXT= + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLDEPS) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +AC_DEFUN(AM_GLIB_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h sys/param.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +strdup __argz_count __argz_stringify __argz_next]) + + AM_LC_MESSAGES + AM_GLIB_WITH_NLS + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl Determine which catalog format we have (if any is needed) + dnl For now we know about two different formats: + dnl Linux libc-5 and the normal X/Open format + test -d po || mkdir po + if test "$CATOBJEXT" = ".cat"; then + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) + + dnl Transform the SED scripts while copying because some dumb SEDs + dnl cannot handle comments. + sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed + fi + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + + +# Search path for a program which passes the given test. +# Ulrich Drepper <drepper@cygnus.com>, 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# Check whether LC_MESSAGES is available in <locale.h>. +# Ulrich Drepper <drepper@cygnus.com>, 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 2 + +AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [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 defines LC_MESSAGES.]) + fi + fi]) + diff --git a/glabels2/barcode-0.98/COPYING b/glabels2/barcode-0.98/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/glabels2/barcode-0.98/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/glabels2/barcode-0.98/ChangeLog b/glabels2/barcode-0.98/ChangeLog new file mode 100644 index 0000000..024706d --- /dev/null +++ b/glabels2/barcode-0.98/ChangeLog @@ -0,0 +1,460 @@ +2002-03-01 Alessandro Rubini <rubini@linux.it> + + * library.c (Barcode_Encode): handle bitsets separately, like + in Barcode_Print (otherwise, you might loose NO_CHECKSUM). + + * debian/changelog: moved to 0.98 (but should fix all debian/ stuff) + + * contrib/barcode-for-delphi.tar.gz: new, contributed by Michael Geddes + + * contrib/barcode-for-delphi.tar.gz.README: short info for file above + + * main.c (main): allow "-g" to set size of code in a table as well + -- suggested and initiallt implemented by Joachim Reichelt. + (main): fixed missing "Page: 1 1" in postscript for tables + (main): for tables don't use Encode_and_Print, use a local + unrolled version, so the default margin can be removed and + we avoid problems with negative xoff in the output phase + (first column may be offset, as noted by Karl Magnus Kolstoe) + + * doc/doc.barcode: documented change above. + + * README: removed refernces to systemy.it, I'm no more there + Added link to FreeBSD ports tree and GLabels + Organized as sections with titles + + * contrib/barcode-SVG.tar.gz: new contribution, by David J. Humphreys + + * contrib/barcode-SVG.tar.gz.README: short description of file above + + * contrib/grab-0.0.4.tar.gz: new program, by Tuukka Toivonen. + + * contrib/grab-0.0.4.tar.gz.README: short description of file above + +2002-03-01 Boszormenyi Zoltan <zboszor@externet.hu> + + * barcode.spec: new file + +2002-02-27 Alessandro Rubini <rubini@linux.it> + + * bookland/bookland.py: updated to version 0.92 by Judah Milgram + +2001-11-13 Alessandro Rubini <rubini@linux.it> + + * README: Added a pointer to the Windows port. + +2001-11-09 Cloyce D. Spradling <cloyce@headgear.org> + + * code128.c (Barcode_128b_verify): prototype fix (unsigned char). + + * ps.c (Barcode_ps_print): the comment for ascii codes must only + be printed if ascii is being printed (benign bug). + +2001-11-06 Christoph Pross <c.pross@beck-ipc.com> + + * pcl.c (Barcode_pcl_print): bugfix: bars were misplaced + +2001-10-16 Nathan D. Holmes <nh412124@ursa.cosd.fedex.com> + + ====> Version 0.97 released to ftp.systemy.it and ftp.gnu.org + + * code93.c: new file (I modified something as well - Alessandro) + + * doc/doc.barcode (Supported Encodings): added docs for code93 + + * main.c: added code93 names + + * Makefile.in (LIBOBJECTS): added code93.o + + * library.c: added code93 entry points + +2001-10-16 Alessandro Rubini <rubini@linux.it> + + * doc/manpager: added (trivial) support for @itemize, added copyright + + * sample.c (main): accept -P to create PCL output + + * doc/doc.barcode (PCL Output): added the section, using text + provided by Andrea Scopece and turning it into texinfo. + Removed also a few extra newlines that made bad man pages + +2001-10-16 Andrea Scopece <a.scopece@vizzavi.it> + + * barcode.h: added BARCODE_OUT_PCL and BARCODE_OUT_PCL_III + + * library.c (Barcode_Print): use BARCODE_OUT_PCL to select pcl_print() + + * Makefile.in (LIBOBJECTS): added pcl.o + + * pcl.c: new file, with PCL output support + +2001-10-16 Alessandro Rubini <rubini@linux.it> + + * doc/doc.barcode (Supported Encodings): added documentation for + EAN and UPC with checksum, as coded by mr. Böszörményi (below) + +2001-10-16 Boszormenyi Zoltan <zboszor@externet.hu> + + * ean.c: + + I found that barcode-0.96 does not correctly encodes UPC-E. + This was mainly because in upc_e_to_a() the switch() branches + all ended without "break;". + + Printing UPC-E did not print the leading encoding number and + the trailing UPC-A checksum. Now it does. + + Accept EAN-13 and EAN-8 with and without the checksum. + So always treat 7 and 12 digit sequences as valid EAN codes + and accept 8 and 13 digit sequences as valid EAN codes when + the last digit is the same as the calculated one. + + Accept UPC-A as above (11 or 12 digit sequences.) + + Accepts UPC-E as: + 6 digit sequence: the middle part of the code (leading '0' assumed) + 7 digit sequence: the middle part and either a leading '0' or '1', + or a trailing UPC-A checksum. In that case, leading '0' assumed. + 8 digit sequence: a leading '0' or '1', middle part, checksum + + UPC-A, UPC-E, EAN-13, and EAN-8 may all include + an additional barcode to the right of the main barcode. + + As a 7 or a 12 digit sequence may be ambiguous, please remember + that EAN is checked before UPC if you specified BARCODE_ANY. + +2001-08-20 Alessandro Rubini <rubini@linux.it> + + * sample.c (main): added upc-e and ean-8 samples + +2001-08-11 Boszormenyi Zoltan <zboszor@externet.hu> + + * ps.c (Barcode_ps_print): don't output "showpage" in EPS mode + +2001-08-11 Alessandro Rubini <rubini@linux.it> + + * README: Changed host names, added barcode-commit list. + +2000-11-29 Alessandro Rubini <rubini@morgana.systemy.it> + + * doc/doc.barcode (The Field List): 1pt == 0.352mm, not 0.0352 + (thanks to Stephen Irven for reporting) + +2000-11-09 Alessandro Rubini <rubini@morgana.systemy.it> + + ====> Version 0.96 released to ftp.systemy.it and ftp.gnu.org + + * doc/Makefile.in ($(TARGET).html): fixed bug introduced on Sep 08 + + * doc/doc.barcode (top): correctly deal with "makeinfo --html" + +2000-11-08 Alessandro Rubini <rubini@morgana.systemy.it> + + * README: new network pointers added + + * codabar.c (Barcode_cbr_encode): don't print ascii text for the + checksum. + + * doc/doc.barcode (The Intermediate Representaion): new section + Documented the new encodings by Leonid. + Promoted two sections to chapters + Added Leonid in the AUTHORS section of the manpage. + + * Makefile.in: don't remove docs in distclean, as the distribution + now includes the docs + +2000-11-07 Alessandro Rubini <rubini@morgana.systemy.it> + + * Makefile.in (clean): don't remove docs, do that only in distclean + + * doc/Makefile.in: a new life for the former Makefile (to build + with both gmake and pmake with features added on 2000-09-08) + + * configure.in: use $MAKE in checking for gmake if set + (to allow testing with BSD make) + Check if makeinfo can manage html, used for doc/Makefile.in + +2000-11-07 Leonid A. Broukhis <leob@mailcom.com> + + * code128.c (Barcode_encode_as): fixed a bug that prevented F + symbols to be correctly encoded. + + * plessey.c: new file, for Plessey encoding. + + * msi.c: new file, for MSI encoding. + + * codabar.c: new file, for CodaBar encoding. + + * code128.c (Barcode_128raw_encode): new encoding + (Barcode_128raw_verify): checker for new encoding + + * barcode.h, library.c, main.c: added code128raw, codabar, + MSI and Plessey + +2000-11-07 Hans Schou <chlor@schou.dk> + + * contrib/barcodeps-0.1.tgz: new file, sent to Alessandro on Oct 7 + +2000-10-10 Alessandro Rubini <rubini@morgana.systemy.it> + + * doc/manpager: use gsub instead of gensub, even though it may + leas to problems with some input. This achieves compatibility + with the original awk, so gawk is not needed any more + +2000-10-02 Alessandro Rubini <rubini@morgana.systemy.it> + + * ps.c (Barcode_ps_print): add a backslash in front of '(' too. + Suggested by H Y <hlyi@yahoo.com>. + (Barcode_ps_print): use ps arrays to get compact (and prettier) + PostScript output. Suggested by Hans Schou <chlor@schou.dk>. + + * main.c (get_geometry): accept "+offset+offset" to keep default size. + Suggested by Godmar Back <gback@cs.utah.edu>. + +2000-09-16 Alessandro Rubini <rubini@morgana.systemy.it> + + * ps.c (Barcode_ps_print): use "half text height" instead of + "two text heights" as minimum bar height. Suggested by + Oliver Vecernik <vecernik@aon.at>. + +2000-09-14 Alessandro Rubini <rubini@morgana.systemy.it> + + * barcode.h: added the standard ``extern "C"'' stuff for C++ + (bug reported by Dany Pardo <dani@minerva.enpl.es>) + +2000-09-08 Andrea Ferraris <andrea@gnu.systemy.it> + + * doc/Makefile: added support for pdf and html via makeinfo + + * doc/doc.barcode: added a missing trailing dot in an xref + +2000-08-28 Alessandro Rubini <rubini@morgana.systemy.it> + + * i25.c (Barcode_i25_encode): fixed checksum calculation + (thanks to Hans Schou <chlor@schou.dk> for reporting) + +2000-05-19 Alessandro Rubini <rubini@morgana.systemy.it> + + ====> Version 0.95.1 released to ftp.prosa.it + + * code128.c (Barcode_128_make_array): use code C if encoding 2 digits + +2000-05-08 Alessandro Rubini <rubini@morgana.systemy.it> + + * cmdline.c (commandline_errormsg): removed "?:" gcc extension + + * configure.in: added checks for unistd.h and strcasecmp, as + windows doesn't have them (thanks Marten Karl) + +2000-04-21 Alessandro Rubini <rubini@morgana.systemy.it> + + * doc/Makefile: modified to build with both gmake and pmake + + * Makefile: modified to build with both gmake and pmake + +2000-04-20 Alessandro Rubini <rubini@morgana.systemy.it> + + * Makefile.in (.depend): removed gmake-specific features. + Thanks to Jukka A. Ukkonen for reporting. + + * configure.in: detect gmake and avoid its features if not there + + * ps.c (Barcode_ps_print): fix: codes with (relatively) short bars + were enlarged in height instead of reduced in width (also + the enlarging was wrong). Thanks to Rob Seace for reporting. + +2000-04-09 Alessandro Rubini <rubini@morgana.systemy.it> + + * code128.c (Barcode_128_encode): removed extra messages to stderr, + forgot in the code when I finished code128 support + + * doc/doc.barcode: bugfix: in the description of geometry, the unit + of measure is configurable + +2000-02-03 Alessandro Rubini <rubini@morgana.systemy.it> + +====> Version 0.95 released to ftp.prosa.it and ftp.gnu.org + +2000-01-26 Alessandro Rubini <rubini@morgana.systemy.it> + + * code128.c (Barcode_128_encode): new encoding: full-featured code128 + + * README: added reference to original ftp site + +2000-01-05 Alessandro Rubini <rubini@morgana.systemy.it> + + * main.c (get_page_geometry): avoid using snprintf(), missing in HP/UX + + * code39.c (Barcode_39_verify): added missing parens (a syntax error, + but only apparent where islower() is not a macro). Thanks to + Alexandre Oliva for finding it out. + +2000-01-04 Alessandro Rubini <rubini@morgana.systemy.it> + + * doc/doc.barcode (The API): removed spurious "flags" argument + from description of Barcode_Encode_and_Print(). + Thanks to Willy Wittesaele for noting the error. + +1999-12-24 Alessandro Rubini <rubini@morgana.systemy.it> + + * main.c (get_geometry): fixed the y margin (thanks to Steve Kunath) + +====> Version 0.94 released to ftp.prosa.it and ftp.gnu.org + +1999-10-24 Alessandro Rubini <rubini@morgana.systemy.it> + + * INSTALL: added instructions to install on a Debian GNU/Linux system + + * debian/*: edited information for proper Debian support + + * debian/rules (binary-arch): new file, from "deb-make" + + * Makefile.in (install): added "-m 0644" to install non-executables + + * code128.c (Barcode_128b_encode): fixed checksum calculation. + +====> Version 0.93 released to ftp.prosa.it and ftp.gnu.org + +1999-09-26 Alessandro Rubini <rubini@morgana.systemy.it> + + * doc/doc.barcode: fixed the rendering of complex options (-g and -t) + Removed extra "table of contents" heading in the ps output + Changed attribution on cover page + + * main.c (get_table and others): be more specific in error msgs + (get_page_geometry): numeric specification is according to "-u" + (get_table): accept unsymmetric margin specification + (option_table): added "-u" to accept "cm", "mm", "in", "pt" + (get_page_geometry): bugfix: numeric spec was always consideder mm + + * cmdline.c (commandline): don't always print help + + * Makefile.in ($(INFO)): added missing dependency: distributed docs + formats were out of date with distributed doc source. + +1999-09-13 Alessandro Rubini <rubini@amelia.prosa.it> + + * main.c (main): print tables: y used xmargin (Tim Withers,Jon Bakken) + +1999-09-06 Alessandro Rubini <rubini@plinio.prosa.it> + + * Makefile.in: prevent -Wall when compiling getopt. + + * i25.c, ean.c, ps.c: switched to unsigned char, to prevent warnings + on newer gcc's (thanks Al Piszcz) + +====> Version 0.92 released to ftp.prosa.it and ftp.gnu.org + +1999-08-31 Alessandro Rubini <rubini@plinio.prosa.it> + + * i25.c: the right guard was thinner than other bars + + * doc/doc.barcode: spelling and manpage fixes (thanks Joachim Schaaf) + +====> Version 0.91.4 released to ftp.prosa.it + +1999-08-23 Thad Floryan <thad@thadlabs.com> + + * main.c (strerror): replacement strerror selected by autoconf + +1999-08-06 Alessandro Rubini <rubini@morgana.systemy.it> + + * changed all "ENODATA" in "EINVAL", as some system miss ENODATA + + * Makefile.in (all): removed ".depend" from all, as it needs gcc + + * i25.c (Barcode_i25_encode): fixed wrong free() in an unlinely path + + * ean.c (Barcode_ean_encode): don't use sprintf's result, as some + systems return a char pointer instead of the number of chars. + + * configure.in: new file, as autoconf support is being added + +====> Version 0.91.3 released to ftp.prosa.it + +1999-08-05 Alessandro Rubini <rubini@morgana.systemy.it> + + * code128.c (Barcode_128c_encode): fixed malloc of textinfo (was short) + + * i25.c (Barcode_i25_encode): new encoding: interleaved 2 of 5 + + * ean.c (Barcode_ean_encode): enlarged static "text", to fit add-5 + + * code128.c (Barcode_128b_encode): new encoding: 128-B + +====> Version 0.91.2 released to ftp.prosa.it + +1999-08-04 Alessandro Rubini <rubini@morgana.systemy.it> + + * bookland/bookland.py: upgraded to version 0.06 (Judas Milgram) + + * ean.c (Barcode_ean_encode): fixed layout of 1st/last digit in UPC-A + + * code128.c (Barcode_128c_encode): fixed checksum calculation + +====> Version 0.91.1 released to ftp.prosa.it + +1999-07-09 Alessandro Rubini <rubini@morgana.systemy.it> + + * sample.c (main): due changes to show code128-C + + * code128.c (Barcode_128c_encode): implemented code 128-C + + * ps.c (Barcode_ps_print): Accept float position and font size + + * code39.c (Barcode_39_encode): reduced font (looked too big) + +====> Version 0.91 released to both ftp.prosa.it and ftp.gnu.org + +1999-07-08 Alessandro Rubini <rubini@morgana.systemy.it> + + * ps.c (Barcode_ps_print): shrink all the bars by 0.15 points + (Barcode_ps_print): Use Helvetica as font, not Courier-Bold + (Barcode_ps_print): remember previous font to make shorter ps output + +1999-07-07 Alessandro Rubini <rubini@morgana.systemy.it> + + * bookland/bookland.py: new enntry, by Judah Milgram. + + * ean.c (Barcode_isbn_verify): fixed bug with "-X" codes (thanks Judah) + +====> Version 0.90.3 released to ftp.prosa.it/pub/software + +1999-07-07 Alessandro Rubini <rubini@morgana.systemy.it> + + * doc/doc.barcode: fixed the "BUGS" section (remove fixed stuff) + + * ean.c (Barcode_ean_encode): added '+' markers in partial and textinfo + + * ps.c (Barcode_ps_print): added support for text over bars ('+' mode) + +====> Version 0.90.2, internal checkpoint + +1999-07-06 Alessandro Rubini <rubini@morgana.systemy.it> + + * Makefile: dirty autodetect of libpaper + + * main.c (get_page_geometry): parse a cmdline argument (mcm@glisco.it) + (main): added "--version" + (main): added diagnostic message for unencodable strings + +====> Version 0.90.1 released to ftp.prosa.it/pub/software + +1999-07-03 Alessandro Rubini <rubini@morgana.systemy.it> + + * barcode.h: removed BARCODE_OUT_PG_* as only the library doesn't + need to hack with the page size. + + * ean.c (Barcode_ean_encode): supplemental 2 and 5 encodings (no text) + + * library.c: use unsigned char all over the place, to prevent warnings + +1999-07-01 Alessandro Rubini <rubini@morgana.systemy.it> + + * ean.c: added EAN-8 and UPC-E support + + * Updated the address of the FSF in any source file + + * README: new file. + +====> Version 0.90 is the first public release. No Changelog up to now. diff --git a/glabels2/barcode-0.98/INSTALL b/glabels2/barcode-0.98/INSTALL new file mode 100644 index 0000000..5a6cb87 --- /dev/null +++ b/glabels2/barcode-0.98/INSTALL @@ -0,0 +1,31 @@ + +Installing on generic Unix systems +---------------------------------- + +The package includes both a library and a standalone program. +To install everything try + + ./configure && make && make install + +To uninstall, try + + make uninstall + +You may have problems compiling the package on non-GNUish systems, +because the tool currently uses both gmake and gawk features, and I have +no access to non-gnu systems. If your operating system isn't able to +compile barcode and you are willing to help porting, feel free to call me. + + +Installing on Debian/GNU systems +-------------------------------- + +The suggested installation here includes creation of a Debian package: + + debian/rules binary + +Then, just install using dpkg: + + dpkg -i ../barcode-0.98_*.deb + +(the "*" here will represent your architecture: "i386", "alpha", "sparc", ...) diff --git a/glabels2/barcode-0.98/Makefile.in b/glabels2/barcode-0.98/Makefile.in new file mode 100644 index 0000000..848aa26 --- /dev/null +++ b/glabels2/barcode-0.98/Makefile.in @@ -0,0 +1,141 @@ +# +# This Makefile should run fine with both pmake and gmake +# + +CC = @CC@ +CFLAGS = @CFLAGS@ @DEFS@ @NO_GETOPT@ @NO_LIBPAPER@ @NO_STRERROR@ +RANLIB = @RANLIB@ + +INSTALL = @INSTALL@ + +LDFLAGS = -L. -l$(TARGET) @LIBPAPER@ + +prefix = @prefix@ +BINDIR = $(prefix)/bin +LIBDIR = $(prefix)/lib +INCDIR = $(prefix)/include +MAN1DIR = $(prefix)/man/man1 +MAN3DIR = $(prefix)/man/man3 +INFODIR = $(prefix)/info + +# getopt may be installed or not, if not take our copy +GETOPT_O = @GETOPT_O@ + +TARGET = barcode +LIBRARY = lib$(TARGET).a +MAN1 = $(TARGET).1 +MAN3 = $(TARGET).3 +INFO = doc/$(TARGET).info +HEADER = $(TARGET).h + +LIBOBJECTS = library.o ean.o code128.o code39.o code93.o i25.o \ + msi.o plessey.o codabar.o \ + ps.o pcl.o +EXEOBJECTS = main.o cmdline.o $(GETOPT_O) +ALLSOURCES = $(LIBOBJECTS:.o=.c) $(EXEOBJECT:.o=.c) + + +#Hmm... "RM" is undefined in pmake +RM = rm + +all: $(TARGET) $(LIBRARY) $(MAN1) $(MAN3) $(INFO) sample + +$(TARGET): $(LIBRARY) $(EXEOBJECTS) + $(CC) $(CFLAGS) $(EXEOBJECTS) $(LDFLAGS) -o $(TARGET) + +sample: sample.o $(LIBRARY) + $(CC) $(CFLAGS) sample.o $(LDFLAGS) -o $@ + +# Avoid the standard CFLAGS, to avoid -Wall and -DNO_GETOPT +compat/getopt.o: compat/getopt.c + $(CC) -O -c compat/getopt.c -o $@ + +$(LIBRARY): $(LIBOBJECTS) + $(AR) r $(LIBRARY) $(LIBOBJECTS) + $(RANLIB) $(LIBRARY) + +$(MAN1) $(MAN3): doc/doc.$(TARGET) + awk -f doc/manpager doc/doc.$(TARGET) + + +# Unfortunately, pmake has no "-C". Also, "pmake -n" doesn't follow the cd. +$(INFO): doc/doc.$(TARGET) + cd doc && $(MAKE) + +install: + $(INSTALL) -d $(BINDIR) $(INCDIR) $(LIBDIR) $(MAN1DIR) \ + $(MAN3DIR) $(INFODIR) + $(INSTALL) -c $(TARGET) $(BINDIR) + $(INSTALL) -c -m 0644 $(HEADER) $(INCDIR) + $(INSTALL) -c -m 0644 $(LIBRARY) $(LIBDIR) + $(INSTALL) -c -m 0644 $(MAN1) $(MAN1DIR) + $(INSTALL) -c -m 0644 $(MAN3) $(MAN3DIR) + $(INSTALL) -c -m 0644 $(INFO) $(INFODIR) + +uninstall: + $(RM) -f $(BINDIR)/$(TARGET) + $(RM) -f $(INCDIR)/$(HEADER) + $(RM) -f $(LIBDIR)/$(LIBRARY) + $(RM) -f $(MAN1DIR)/$(MAN1) + $(RM) -f $(MAN3DIR)/$(MAN3) + $(RM) -f $(INDODIR)/$(INFO) + +#Make clean keeps the compiled documents +clean: + $(RM) -f *.o */*.o *~ */*~ $(TARGET) $(LIBRARY) + $(RM) -f $(MAN1) $(MAN3) core sample + cd doc && $(MAKE) terse + $(RM) -f .depend + +distclean: clean + if [ -f build ]; then debian/rules clean; fi + # remove the configure stuff as well + $(RM) -f Makefile config.h config.log config.status config.cache \ + doc/Makefile + +cleanest: clean + cd doc && $(MAKE) clean + +Makefile: Makefile.in configure + ./configure + +configure: configure.in + autoconf + +.depend: $(ALLSOURCES) + $(CC) $(CFLAGS) -MM $(ALLSOURCES) > $@ + +depend: .depend + +tar: + @if [ "x" = "x$(RELEASE)" ]; then \ + n=`basename \`pwd\``; cd ..; tar cvf - $$n | gzip > $$n.tar.gz; \ + echo 'you can set a numeric $$(RELEASE) to make a named tar'; \ + else \ + if [ -d ../$(TARGET)-$(RELEASE) ]; then \ + rm -rf ../$(TARGET)-$(RELEASE); \ + fi; \ + mkdir ../$(TARGET)-$(RELEASE) || exit 1; \ + cp -a . ../$(TARGET)-$(RELEASE) && cd .. && \ + tar --exclude '*/CVS*' \ + -cvzf $(TARGET)-$(RELEASE).tar.gz $(TARGET)-$(RELEASE); \ + fi + +# print the version, as I usually forget to update it when distributing +printv: + @grep -n VERSION $(HEADER) /dev/null + @grep -n set.version doc/doc.$(TARGET) /dev/null + @grep -n dpkg.-i INSTALL /dev/null + +# and this is how I make the distribution +distrib: $(INFO) distclean tar printv + + +.PHONY: all install uninstall mostlyclean clean disclean depend \ + tar printv distrib + +# Only if make is gmake, have a rule to conditionally include .depend +@GMAKEDEPEND0@ +@GMAKEDEPEND1@ +@GMAKEDEPEND2@ + diff --git a/glabels2/barcode-0.98/README b/glabels2/barcode-0.98/README new file mode 100644 index 0000000..d3ae2a7 --- /dev/null +++ b/glabels2/barcode-0.98/README @@ -0,0 +1,93 @@ + +NETWORK LINKS +============= + +This is GNU-barcode. The latest release can be downloaded from ftp.gnu.org +and mirrors: + ftp://ftp.gnu.org/pub/gnu/barcode/ + +It is also available from my own ftp/http server + ftp://ar.linux.it/pub/barcode/ + http://ar.linux.it/pub/barcode/ (same as above). + +The current source tree is available by anonymous CVS. See + http://ar.linux.it/software/#cvs + +Plesae note that ar.linux.it/pub/barcode also includes CVS snapshots, +semi-atumatically taken when I commit stuff to CVS. Note that CVS +snapshots include "CVS/" directories, so you can then "cvs update" for +further updates. + +The documentation is online at: + http://ar.linux.it/software/barcode + +The MS-Windows port is maintained at: + http://gnuwin32.sourceforge.net/packages/barcode.htm + +It as also been included in the FreeBSD ports tree in the "graphics" section. +This means /usr/ports/graphics/barcode. It's thus available from: + http://www.freebsd.org/ports/graphics.html + +GLabels, at http://snaught.com/glabels/, uses barcode internally, too. + +DESCRIPTION +=========== + +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +The package is released as both a library and a command-line frontend, +so that you can include barcode-generation into your application. The +program is released in the hope that is proves useful but without any +warranty, according to the GPL Licence (see ./COPYING). + +If you're specifically interested in making an ISBN (Bookland EAN) +symbol, you might try to get "bookland.py" by Judah Milgram +(http://www.cgpp.com/bookland/, whose version 0.92 is also included in +the directory "bookland" within this package, for your convenience). +While my main target is flexibility his main target is strict +adherence to the standards. Bookland is free software like the barcode +library and will probabily have its role in the GNU project. +Bookland.py is a self-documenting program, you'll enjoy browsing its +source code. + +Other contributed patches and/or software are available in the +contrib/ directory. + +Please take the "no-warranty" disclaimer seriously: even though I +spent reasonable efforts to make sure the output is useable in +production you should verify it suits your needs as a faulty bar can +cost you a bundle, and you'll be on your own. It's up to you to verify +that the symbol is valid (and, obviously, I'd like to know about any +problem you encounter). [This paragraph copied verbatim from bookland.py] + + +ACKNOWLEDGMENTS +=============== + +I would like to thank both Judah Milgram and Michele Comitini +(mcm@glisco.it) for their help with this tool, as well as Jim Westveer +for introducing me to Debian packaging. Several encodings have been +implemented by Leonid A. Broukhis (leob@mailcom.com). + + +MAILING LISTS +============= + +There is a mailing list where development is coordinated, called +barcode@lists.linux.it . To get subscribed you should + echo subscribe | mail barcode-request@lists.linux.it +or anything equivalent. + +To receive notification of CVS commit messages, please subscribe to +barcode-commit@ar.linux.it, by issuing: + echo subscribe | mail barcode-commit-request@ar.linux.it + +(if you guess, "ar" or "arcana" is my own server, while lists.linux.it +is the mail server of the italian association of gnu/linux users). + +/alessandro (rubini@gnu.org) + diff --git a/glabels2/barcode-0.98/TODO b/glabels2/barcode-0.98/TODO new file mode 100644 index 0000000..c91c79c --- /dev/null +++ b/glabels2/barcode-0.98/TODO @@ -0,0 +1,23 @@ + + Possible enhancements that I'd like to add + +* verbose mode, printing position information to stderr + +* document how a new encoding standard can be added + +* add Barcode_String, which has been contributed + +* EAN128 (as agreed with Dani Pardo) + +* Postnet and associated encoding-specific bar definitions + +* Use texinfo 4 with images + +* shrink the bars to account for ink spreading + + Currently, small barcodes don't get rendered well. While + version 0.91 and later subtracts 0.15 points from the size of + the bars (I found that this makes good results for small + bars), a smart alghorithm to shrink the bars is needed to get + lighter prints at small sizes without loosing readability. + diff --git a/glabels2/barcode-0.98/barcode.h b/glabels2/barcode-0.98/barcode.h new file mode 100644 index 0000000..6b9bdf4 --- /dev/null +++ b/glabels2/barcode-0.98/barcode.h @@ -0,0 +1,119 @@ +/* + * barcode.h -- definitions for libbarcode + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _BARCODE_H_ +#define _BARCODE_H_ + +#include <stdio.h> + +#define BARCODE_VERSION "0.98" +#define BARCODE_VERSION_INT 9800 + +/* + * The object + */ +struct Barcode_Item { + int flags; /* type of encoding and decoding */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text positioning */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ +}; + +/* + * The flags field + */ +#define BARCODE_DEFAULT_FLAGS 0x00000000 + +#define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ +#define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ +#define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ + +#define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ +#define BARCODE_OUT_EPS 0x00001000 +#define BARCODE_OUT_PS 0x00002000 +#define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ +/* PCL_III 0x00008000 */ +#define BARCODE_OUT_PCL_III 0x0000C000 +#define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ + +enum { + BARCODE_ANY = 0, /* choose best-fit */ + BARCODE_EAN, + BARCODE_UPC, /* upc == 12-digit ean */ + BARCODE_ISBN, /* isbn numbers (still EAN13) */ + BARCODE_39, /* code 39 */ + BARCODE_128, /* code 128 (a,b,c: autoselection) */ + BARCODE_128C, /* code 128 (compact form for digits) */ + BARCODE_128B, /* code 128, full printable ascii */ + BARCODE_I25, /* interleaved 2 of 5 (only digits) */ + BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ + BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ + BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ + BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ + BARCODE_93 /* code 93 (by Nathan D. Holmes) */ +}; + +#define BARCODE_DEFAULT_MARGIN 10 + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Create and destroy barcode structures + */ +extern struct Barcode_Item *Barcode_Create(char *text); +extern int Barcode_Delete(struct Barcode_Item *bc); + +/* + * Encode and print + */ +extern int Barcode_Encode(struct Barcode_Item *bc, int flags); +extern int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); + +/* + * Choose the position + */ +extern int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef); + +/* + * Do it all in one step + */ +extern int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags); + + +/* + * Return current version (integer and string) + */ +extern int Barcode_Version(char *versionname); + +#ifdef __cplusplus +} +#endif + +#endif /* _BARCODE_H_ */ diff --git a/glabels2/barcode-0.98/barcode.spec b/glabels2/barcode-0.98/barcode.spec new file mode 100644 index 0000000..eccb602 --- /dev/null +++ b/glabels2/barcode-0.98/barcode.spec @@ -0,0 +1,84 @@ +%define name barcode +%define ver 0.98 +%define rel 1 +%define prefix /usr +%define sysconfdir /etc + +Summary: GNU barcode +Name: %name +Version: %ver +Release: %rel +Copyright: GPL +Group: Applications/Productivity +Source: ftp://ar.linux.it/pub/barcode/%name-%{ver}.tar.gz +BuildRoot: /var/tmp/%name-%{ver}-root +URL: http://gnu.systemy.it/software/barcode +Prefix: %prefix + +%description +This is GNU-barcode. +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +%package devel +Summary: GNU barcode files for development +Group: Development/Libraries + +%description devel +This is GNU-barcode. +The package is meant to solve most needs in barcode creation with a +conventional printer. It can create printouts for the conventional +product tagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, as well +as a few other formats. Ouput is generated as either Postscript or +Encapsulated Postscript (other back-ends may be added if needed). + +This package contain the C header, the static library and man page +for development. + +%prep +%setup + +%ifarch alpha + ARCH_FLAGS="--host=alpha-redhat-linux" +%endif + +export -n LANG LINGUAS LC_ALL +if [ ! -f configure ]; then + CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh $ARCH_FLAGS --prefix=%{prefix} --sysconfdir=%{sysconfdir} +else + CFLAGS="$RPM_OPT_FLAGS" ./configure $ARCH_FLAGS --prefix=%{prefix} --sysconfdir=%{sysconfdir} +fi + +%build +export -n LANG LINGUAS LC_ALL + +if [ "$SMP" != "" ]; then + (make "MAKE=make -k -j $SMP"; exit 0) + make +else + make +fi + +%install +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{prefix} sysconfdir=$RPM_BUILD_ROOT%{sysconfdir} install + +%clean +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc COPYING ChangeLog INSTALL README TODO doc/*.html doc/*.pdf doc/*.ps + +%attr(0755,root,root) %{prefix}/bin/barcode +%attr(0644,root,root) %{prefix}/info/barcode.info* +%attr(0644,root,root) %{prefix}/man/man1/barcode.1* + +%files devel +%attr(0644,root,root) %{prefix}/include/barcode.h +%attr(0644,root,root) %{prefix}/lib/libbarcode.a +%attr(0644,root,root) %{prefix}/man/man3/barcode.3* diff --git a/glabels2/barcode-0.98/bookland/bookland.py b/glabels2/barcode-0.98/bookland/bookland.py new file mode 100644 index 0000000..373587c --- /dev/null +++ b/glabels2/barcode-0.98/bookland/bookland.py @@ -0,0 +1,884 @@ +#!/usr/local/bin/python + +MYNAME="bookland.py" +MYVERSION="0.92" +COPYRIGHT="(C) 1999-2001 J. Milgram" +DATE = "Jan. 2002" +MAINTAINER = "bookland-bugs@cgpp.com" + +# Copyright (C) 1999,2000 Judah Milgram +# +# bookland.py - generate Bookland EAN symbol for ISBN encoding +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +# +# ============================================================================== +# +# usage: bookland.py [ISBN] [price-code] > output.eps +# +# ISBN - the ISBN, with or without check digit, with or without hyphens. +# default: 1-56592-197-6 ("Programming Python"). If the check digit +# is provided on the command line, it is verified. If not, it is +# calculated. It's up to you to get the hyphenation right - it's +# important, and something the program can't calculate for you. +# +# price - the five digit add-on code. Usually used to indicate the price, +# in which case the first digit indicates the currency (4=$CAN, +# 5=$US, etc.). The remaining digits indicate the price, with +# decimal point assumed to be between the digit 3 and 4. +# For example: $US 6.95 = 50695, $CAN 35.00 = 43500. Instead of a +# price code, a 5 digit add-on ranging from 90000-98999 can be +# used for internal purposes. BISG recommends just using 90000 if +# you don't want to specify a price. Add-ons ranging from 99000 to +# 99999 have been reserved for special use. +# +# An Encapsulated Postscript file (eps) is sent to standard out. This may in turn +# be converted to other formats using the pbmplus package. You may have trouble +# getting the OCRB to map correctly. If you already have the font, you can look in +# the Fontmap file to see what your system calls it, and edit the fontnames accordingly +# (see below). If you don't have it, you might find it on your DOS system. You +# need a .pfa/.pfb (Type 1) or .ttf (TrueType). Your Postscript interpreter might +# or might not be able to deal with TrueType. In any event, in an emergency, you +# might get away with Helvetica. Note that as of 1990 BISG no longer requires the +# ISBN to be printed in OCR-A. +# +# Take the "no-warranty" disclaimer seriously. Going to print with a faulty bar +# can cost you a bundle, and you'll be on your own. It's up to you to verify that +# the symbol is valid. If you need "corporate accountability", try the Book +# Industry Study Group at (212) 929-1393 or the US ISBN Agency at (908) 665-6770 +# and ask for a list of commercial vendors. Outside the US, don't know. +# +# Feedback welcome. If you discover a case where the program generates a faulty +# symbol, I definitely want to hear about it - write me at milgram@cgpp.com or +# P.O. Box 8376, Langley Park, MD 20787, USA +# +# INSTALLATION: +# +# If you have a Python interpreter on your system, you're done. Just put this file +# somewhere in your path and give it execute permission. If you haven't installed +# Python, see http://www.python.org. It has been ported to Macs, DOS, and MS-Windows. +# +# ABOUT THE BOOKLAND EAN +# +# The most difficult part of this project was finding the documents that define +# the Bookland EAN. There appears to be no single, authoritative source that +# provides all the information required. Some good sources: +# +# [1] "Machine-Readable Coding Guidelines for the U.S. Book Industry", Book +# Industry Study Group, New York, Jan., 1992. (212) 929-1393 +# [2] "UPC Symbol Specification Manual", Uniform Code Council Inc., +# Dayton, Ohio, January 1986 (May 1995 Reprint). (937) 435-3870; I found it +# at http://www.uc-council.org/d36-t.htm +# [3] "EAN Identification for Retail/Trade Items", EAN International. I found it +# in Feb. 1999 at http://www.ean.be/html/Numbering.html +# [4] "Hyphenation Instructions", web page at: +# http://www.isbn.org/standards/home/isbn/international/hyphenation-instructions.asp +# +# The starting point of the exercise is the ISBN, assigned by the national ISBN +# Agency. This is a 10 digit number, the last being a check digit. The ISBN is +# converted to a 13 digit EAN number. The first three digits of the EAN-13 indicate +# the country or region. A prefix of 978 has been assigned to books, regardless +# of country of origin (hence, "Bookland") [3]. The remaining ten digits are the +# first 9 digits of the ISBN followed by the EAN-13 check digit. +# +# It seems the EAN-13 check digit can be calculated using the same algorithm as the +# UPC Version A number. Note that the EAN-13 check digit is always between 0 and 9, +# compare with ISBN check digit which can range to 10 ("X"). See Reference [2], +# Section 2 and Appendix G for details of creation of the EAN-13 symbol. Table 2 of +# Appendix G provides a good comparison of the UPC-A and EAN-13 symbols. +# +# The 5 digit add-on (here called, "UPC5") is defined in Ref. [2] Appendix D. +# The ">" to the right of the five digit code serves to enforce the "quiet zone" to +# the right of the bar pattern. Can't remember where I read that. It's probably +# optional. According to [1], in the UK, three horizontal bars appear over price +# add-ons. Haven't implemented that here. The UPC5 encoding is based on UPC-A and +# UPC-E. +# +# According to [2], Section 3, the EAN-13 numbers and 5-digit add-ons are supposed +# to be printed in OCR-B. The ISBN itself is printed above the EAN-13 symbol. At +# one time it was to be printed in OCR-A, but as of 1990 this requirement has been +# dropped [1], and I assume this means you can use any font you like. +# +# SEE ALSO: +# +# "TinyHelp 5 - Making ISBN Barcodes", D. Byram-Wigfield. Another approach to making +# the ISBN barcode symbol. I saw it at +# http://www.cappella.demon.co.uk/index.html/ +# but haven't tried it. +# +# "XBarcode" - nice open-source X-Windows program for generating all sorts of bar codes. +# It does much more than this program, but didn't seem to do the UPC +# 5-digit add-on or do the ISBN->EAN13 calculation (as of v. 2.11). Might +# have made more sense to add this capability, but I needed a Python project. +# In any event, their license forbids distribution in modified form! +# +# HYPHENATION +# +# bookland.py includes automatic hyphenation for ISBN's in group 0 and 1 +# (English-language). This is based on my reading of Ref [4]. If in doubt, +# users can use the "-y" option to force the program to accept the hyphenation +# as input. For other ISBN groups and for ISMN's, no hyphenation is performed +# other than to ensure a hyphen is placed after the group identifier and before +# the check digit. +# +# ABOUT THE ISMN: +# +# See the ISMN Users' Manual, 3rd Edition, 1998, ISBN 3-88053-070-X, published by +# the International ISMN Agency, Staatsbibliothek Preussischer Kulturbesitz, Berlin. +# I found my copy at http://www.ismn.spk-berlin.de/download/ISMNmanual.pdf +# +# An ISMN is just like an ISBN, except: +# - first character is an "M" +# - the "M" counts as a "3" for computing the ISMN check digit (last digit) +# - the checksum weights are 3,1,3,1,3,1,3,1,3, sum to be divisible by "10". This +# means the last character is always a numerical digit, never an "X". +# - the EAN number is "979" plus the *entire* ten character ISMN, except the +# "M" is replaced by "0". Note this means the ISMN checksum is identical to the +# corresponding EAN-13 checksum (excercise left to the reader). +# +# When bookland.py detects an "M" in the first position of the ISBN, it interprets +# it as an ISMN and proceeds accordingly. The 5-digit price code symbol is suppressed. +# +# BAR WIDTH REDUCTIONS +# +# Starting Version 0.92, the widths of the individual bars can be reduced using the +# "-r" option (units are inches). This is to compensate for bleed during printing. +# I don't know when it's a good idea to actually use this; in any event consult with +# your printer first. If not input, it defaults to zero (no reduction). +# +# ABOUT PYTHON +# +# See http://www.python.org +# +# TO DO: +# +# - Generalize to more bar codes, starting with UPC-A and UPC-E. "Plain" EAN13 is +# already built in, could add command line argument to generate that instead of +# Bookland. +# - Make font sizes and placement easier to configure - not sure I have it right. +# Does human-readable 5-digit code take wider font spacing? +# - Clean up bounding box stuff. +# - Bells and whistles. +# - GUI? +# +# HISTORY: +# +# 1/2002 - v 0.92 add ISMN support (thanks to Lars-Henrik Nysten for this suggestion) +# re-wrote bar generation to preclude possibility of white hairlines +# between adjacent black modules. Thanks to Tero Lindfors for +# reporting this bug. +# new -o option to write eps to file rather than stdout +# new -x option for "check only" (verifies check digit) +# new -r option for bar width reduction (compensate for print bleed) +# new -s option to scale module (bar) height (Lars-Henrik Nysten again) +# can suppress UPC-5 price code by entering empty string. (thanks to +# Jacques Du Pasquier for this suggestion) +# re-wrote ISBN/ISMN sanity checks +# lowercase alphas ("x" for ISBN and "m" for ISMN) now ok on input +# fix "long" command line options. +# 10/2001 - v 0.91 add -z option for quiet zone ">" +# add -f option for fonts +# re-write command line parsing to use getopt +# 1/2000 - v 0.09 eliminate use of eval +# 9/99 - v 0.08 accomodate different versions of OCRB by fitting +# all strings to prescribed width. Thanks to Toby Gadd +# for reporting this problem and Peter Deutsch for +# help finding the fix. +# 7/99 -v0.05-0.07 improve error handling. +# 3/27/99 - v0.04 add "--help" and "--version". +# 3/13/99 - v0.03, do a showpage at end (it's allowed) +# fixed checksum calculations for certain cases +# 2/7/99 - v0.02, fixed LH parity pattern for EAN13. It's not the check digit! +# 2/7/99 - initial release +# ================================================================================ + +# +# barCodeSymbol - the whole printed symbol, including bar code(s) and product code(s). +# UPC, UPCA, UPC5, EAN13 - the number itself, with check digit, string representation, +# and barcode bits +# + +import re # we should get rid of regsub and regex in favor of re + # hope there's no conflict. +import string +import sys +import regsub +from regex_syntax import * +import regex +regex.set_syntax(RE_SYNTAX_AWK) +from types import * + +BooklandError = "Something wrong" + + +A="A";B="B";C="C";O="O";E="E" +UPCABITS = [{O:"0001101",E:"1110010"}, + {O:"0011001",E:"1100110"}, + {O:"0010011",E:"1101100"}, + {O:"0111101",E:"1000010"}, + {O:"0100011",E:"1011100"}, + {O:"0110001",E:"1001110"}, + {O:"0101111",E:"1010000"}, + {O:"0111011",E:"1000100"}, + {O:"0110111",E:"1001000"}, + {O:"0001011",E:"1110100"}] +UPCAPARITY = [ "OOOOOOEEEEEE" ] * 10 +UPCEBITS = [{O:"0001101",E:"0100111"}, + {O:"0011001",E:"0110011"}, + {O:"0010011",E:"0011011"}, + {O:"0111101",E:"0100001"}, + {O:"0100011",E:"0011101"}, + {O:"0110001",E:"0111001"}, + {O:"0101111",E:"0000101"}, + {O:"0111011",E:"0010001"}, + {O:"0110111",E:"0001001"}, + {O:"0001011",E:"0010111"}] +# what about UPCEPARITY? Don't need for isbn. +UPC5BITS = UPCEBITS +UPC5PARITY = ["EEOOO","EOEOO","EOOEO","EOOOE","OEEOO", + "OOEEO","OOOEE","OEOEO","OEOOE","OOEOE"] +EAN13BITS = [{A:"0001101", B:"0100111", C:"1110010"}, + {A:"0011001", B:"0110011", C:"1100110"}, + {A:"0010011", B:"0011011", C:"1101100"}, + {A:"0111101", B:"0100001", C:"1000010"}, + {A:"0100011", B:"0011101", C:"1011100"}, + {A:"0110001", B:"0111001", C:"1001110"}, + {A:"0101111", B:"0000101", C:"1010000"}, + {A:"0111011", B:"0010001", C:"1000100"}, + {A:"0110111", B:"0001001", C:"1001000"}, + {A:"0001011", B:"0010111", C:"1110100"}] +EAN13PARITY = map(lambda x: x+"CCCCCC", + ["AAAAAA","AABABB","AABBAB","AABBBA","ABAABB", + "ABBAAB","ABBBAA","ABABAB","ABABBA","ABBABA"]) + +PSFORMAT = "%.6f" +# Default fonts. +# Fonts might have a different name on your system. +# Edit if required. +ISBNFONT = "OCRB" # Doesn't have to be OCR-B +EAN13FONT = "OCRB" +UPC5FONT = "OCRB" + +class psfile: + + def __init__(self): + self.x0 = 100; self.y0 = 100 + self.lines=[] + self.bb=[self.x0,self.y0,self.x0,self.y0] + + def orbb(self,arg): + self.bb[0] = min(self.bb[0],self.x0+arg[0]) + self.bb[1] = min(self.bb[1],self.y0+arg[1]) + self.bb[2] = max(self.bb[2],self.x0+arg[2]) + self.bb[3] = max(self.bb[3],self.y0+arg[3]) + + def translate(self,dx,dy): + self.x0 = self.x0 + dx + self.y0 = self.y0 + dy + return "%d %d translate 0 0 moveto" % (dx,dy) + + def out(self,file=None): + if file: + outfid=open(file,"w") + else: + outfid=sys.stdout + for line in self.lines: + outfid.write("%s\n"%line) + outfid.close() + + def do(self,arg): + self.lines = self.lines + arg + + def setbb(self): + for i in range(len(self.lines)): + if self.lines[i]=="%%BoundingBox: TBD": + self.lines[i]= "%%BoundingBox:" + \ + " %d"%self.bb[0] + \ + " %d"%self.bb[1] + \ + " %d"%self.bb[2] + \ + " %d"%self.bb[3] + return + + def header(self,title,comments,ean13font,isbnfont,upc5font): + for i in range(len(comments)): + comments[i] = regsub.gsub("^","% ",comments[i]) + # There's a more elegant way to do the bounding box line: + return [ "%!PS-Adobe-2.0 EPSF-1.2", + "%%Creator: " + MYNAME + " " + MYVERSION + " " + DATE, + "%%Title: " + title, + "%%BoundingBox: TBD", + "%%EndComments" ] +\ + comments + \ + [ "\n% These font names might be different on your system:", + "/ean13font { /" + ean13font + " findfont 10 scalefont setfont } def", + "/isbnfont { /" + isbnfont + " findfont 8 scalefont setfont } def", + "/upc5font { /" + upc5font +" findfont 14 scalefont setfont } def\n", + "/nextModule { moduleWidth 0 rmoveto } def", + "% The following shenanigans is to deal with different implementations", + "% of same font having different char sizes and spacing.", + "% function fitstring:", + "% usage: width string font fitstring", + "% set font, scaled so that string exactly fits desired width", + "% leave string on stack", + "/fitstring { dup findfont 1 scalefont setfont % w s f", + "3 1 roll % f w s", + "dup stringwidth pop % f w s sw", + "3 2 roll exch div % f s x", + "3 2 roll findfont exch scalefont setfont", + "} def", + "/barHeight { 72 } def", + "/nextModule { moduleWidth 0 rmoveto } def", + "/topcentershow {dup stringwidth pop neg 2 div -9 rmoveto show} def", + "/toprightshow {dup stringwidth pop neg -9 rmoveto show} def", + "/bottomcentershow {dup stringwidth pop neg 2 div 0 rmoveto show} def", + "/bottomrightshow {dup stringwidth pop neg 0 rmoveto show} def", + "/W { moduleWidth mul 0 rmoveto } def", + "/B { dup moduleWidth mul 2 div 0 rmoveto", + "dup moduleWidth mul barWidthReduction sub setlinewidth", + "0 barHeight rlineto 0 barHeight neg rmoveto", + "currentpoint stroke moveto", + "moduleWidth mul 2 div 0 rmoveto } def", + "/L { dup moduleWidth mul 2 div 0 rmoveto", + "dup moduleWidth mul barWidthReduction sub setlinewidth", + "0 -5 rmoveto 0 5 rlineto", + "0 barHeight rlineto 0 barHeight neg rmoveto", + "currentpoint stroke moveto", + "moduleWidth mul 2 div 0 rmoveto } def", + self.x0,self.y0,"translate", + "0 0 moveto" ] + + def trailer(self): + return ["stroke","% showpage supposedly OK in EPS", + "showpage","\n% Good luck!"] + + +class UPC: + + # Includes UPC-A, UPC-E, EAN-13 (sorry), UPC-5 et al. + + def __init__(self,arg): + # arg is a string, either: + # - product code including checksum + # - same, with hyphens (hyphens not verified) + # - same, but with last digit (checksum) dropped, possibly leaving a + # trailing hyphen. + # If checksum is included, it will be verified. + # N.B. "integer" representation is still a string! Just has no hyphens. + + self.s=arg + self.verifyChars(self.s) + self.n = regsub.gsub("-","",self.s) # create "integer" representation + self.x = self.checkDigit(self.n) # always calculate check digit + if len(self.n) == self.ndigits: + self.verifyCheckDigit() # if check digit given, verify it + elif len(self.n) == self.ndigits-1: + self.tackonCheckDigit() # tack on check digit + else: + raise BooklandError, "UPC: wrong number of digits in \"" + self.s + "\"" + + def setbits(self,arg): # UPC (all) + self.bits="" + parityPattern=self.parityPattern() + bitchar=self.bitchar() + for p in range(len(arg)): + digit=int(arg[p]) + # maybe better to define parityPattern with a leading blank? + parity=parityPattern[p] + bit=bitchar[digit][parity] + self.bits=self.bits + bit + + def verifyChars(self,s): # UPC (all) + # Trailing hyphen allowed. + nevergood = "--|^-|[^0-9-]" + ierr=regex.search(nevergood,s) + if ierr != -1: + raise BooklandError, \ + "UPCA: in %s: illegal characters beginning with: %s" % (s,s[ierr]) + + def verifyCheckDigit(self): # UPC (all) + # first verify correct number of digits. + soll=self.checkDigit(self.n) + ist=self.s[-1:] + if ist != soll: + raise BooklandError, "For %s checksum %s is wrong, should be %s" % \ + (self.s,ist,soll) + + def xstring(self,p): # UPC (all) + return "%d" % p + + def tackonCheckDigit(self): + self.n = self.n + self.x # UPC (all) + self.s = self.s + self.x + +class UPCA(UPC): + + def __init__(self,arg): + UPC.__init__(self,arg) + self.setbits(self.n[1:]) # skip first digit + + def parityPattern(self): + return UPCAPARITY[int(self.x)] + def bitchar(self): + return UPCABITS + + def checkDigit(self,arg): # UPCA/EAN13 + weight=[1,3]*6; magic=10; sum = 0 + for i in range(12): # checksum based on first 12 digits. + sum = sum + int(arg[i]) * weight[i] + z = ( magic - (sum % magic) ) % magic + if z < 0 or z >= magic: + raise BooklandError, "UPC checkDigit: something wrong." + return self.xstring(z) + + +class ISBN: + # Includes ISMN, if the plan falls together. + def __init__(self,arg): + self.ndigits=10 # Includes check digit! + self.s=string.upper(arg) + self.n=re.sub("[ -]","",self.s) # "integer" representation + # In ISMN, I allow spaces in place of hyphens. See ISMN User's manual. + if re.match("^M( |-)?\d(( |-)?\d){7,7}(-| )?\d?$",self.s): + # ISMN + self.name="ISMN" + self.n=re.sub("^M","3",self.n) + self.weight=[3,1,3,1,3,1,3,1,3] + self.magic=10 + elif re.match("^\d-?\d(-?\d){7,7}-?(\d|X)?$",self.s): + # ISBN + self.name="ISBN" + self.weight=[10,9,8,7,6,5,4,3,2] + self.magic=11 + else: + raise BooklandError, "%s invalid (hyphenation, characters, or length)" % self.s + self.x = self.checkDigit() + if len(self.n) == self.ndigits: + self.verifyCheckDigit() # if check digit given, verify it + elif len(self.n) == self.ndigits-1: + self.tackonCheckDigit() # tack on check digit + else: + raise BooklandError, "%s failed. Please report as bug" % self.s + + + def checkDigit(self): # ISBN and ISMN; UPCA/EAN13 similar but for weights etc. + # now that we're checking regex's in init, we don't have to check the + # argument at all. (used to check length and bad characters) + sum = 0 + for i in range(9): # checksum based on first nine digits. + sum = sum + int(self.n[i]) * self.weight[i] + z = ( self.magic - (sum % self.magic) ) % self.magic + if z < 0 or z >= self.magic: + raise BooklandError, \ + "%s: checksum %d is wrong - please report as bug" % (self.s,z) + return self.xstring(z) + + def xstring(self,p): + if p == 10: + return "X" + else: + return "%d" % p + + def tackonCheckDigit(self): + if self.s[-1:] == "-": + # Already have a trailing hyphen + self.s = self.s + self.x + else: + self.s = self.s + "-" + self.x + + def verifyCheckDigit(self): # UPC A; EAN13 + # first verify correct number of digits. + soll=self.x + ist=self.s[-1:] + if ist != soll: raise BooklandError, \ + "For %s checksum %s is wrong, should be %s\n" % (self.s,ist,soll) + +class Bar: + # a run of adjacent modules of identical value. + def __init__(self,val): + self.val=val + if not self.val in "L01": + raise BooklandError, "bar bit: %s, pls report as a bug" % self.val + self.width=1 + if self.val=="1": + self.color="Black" + elif self.val=="0": + self.color="White" + elif self.val=="L": + self.color="Long Black" + def __cmp__(self,other): + if self.val==other or (self.val=="L" and other=="1"): + return 0 + else: + return 1 + def inc(self): + self.width=self.width+1 + def pslines(self): + if self.val=="L": + rval = [ "%d L " % self.width ] + elif self.val=="1": + rval = [ "%d B " % self.width ] + else: + rval = [ "%d W " % self.width ] + return rval + def __repr__(self): + return "%s bar of width %d" % (self.color,self.width) + +class barCodeSymbol: + + def __init__(self): + self.patternWidth = len(self.bits)*self.moduleWidth + # Anything else? + + def bitsComment(self): + return [ "%% Bits:\n%% %s" % self.bits ] + + def psbars(self): + # new version, try to prevent all hairlines between adjacent modules. + bars = [] + bar=Bar(self.bits[0]) + for bit in self.bits[1:]: + if bit==bar: + bar.inc() + else: + bars.append(bar) + bar=Bar(bit) + bars.append(bar) + rval = ["0 0 moveto"] + for bar in bars: + rval = rval + bar.pslines() + rval = rval + [ "stroke" ] + return rval + + def psbarsold(self): + psbits=regsub.gsub("1","I ",self.bits) + psbits=regsub.gsub("0","O ",psbits) + psbits=regsub.gsub("L","L ",psbits) + linewidth=50 + p=0; j=linewidth; m=len(psbits); psbarlines=[]; blanks="^ | $" + while p <= m: + j = min(linewidth,m-p) + psbarlines = psbarlines + [ regsub.gsub(blanks,"",psbits[p:p+j]) ] + p=p+linewidth + return [ "0 0 moveto" ] + psbarlines + [ "stroke" ] + + def psSetBarHeight(self): + return [ "/barHeight { " + PSFORMAT % self.moduleHeight + " 72 mul } def" ] + + def psSetBarWidthReduction(self): + return [ "/barWidthReduction { " + \ + PSFORMAT % self.barWidthReduction + " 72 mul } def" ] + + def psSetModuleWidth(self): + rval = [ "/moduleWidth { " + PSFORMAT % self.moduleWidth + " 72 mul } def" ] + return rval + + def psBottomRightText(self,text,font): + # this is specifically for the upc5 price code. + # this is all starting to get messy. + return [ PSFORMAT % self.patternWidth + " 72 mul dup 2 div", + PSFORMAT % self.moduleHeight + " 72 mul 2 add moveto", + "(" + text + ") /" + font + " fitstring bottomcentershow" ] + + def psTopCenterText(self,text,font): + # the text at the top center of the bar pattern (i.e. the ISBN) + return [ PSFORMAT % self.patternWidth + " 72 mul dup 2 div", + PSFORMAT % self.moduleHeight + " 72 mul 3 add moveto", + " (" + text + ") /" + font + " fitstring bottomcentershow" ] + + def psFittedText(self,width,text,font): + return [ PSFORMAT % width + " (" + text + ") " + font + " fitstring" ] + + # This is optional; serves to enforce quiet zone to right of UPC 5 add-on + def psGreaterThan(self,font): + return [ PSFORMAT % self.patternWidth + " 72 mul", + PSFORMAT % self.moduleHeight + " 72 mul 2 add moveto", + "/%s (>) show" % font ] + +class EAN13Symbol(barCodeSymbol): + + def __init__(self,arg,font=EAN13FONT,heightMultiplier=1,barWidthReduction=0): + # arg is a string with the EAN product code + self.barWidthReduction=barWidthReduction + self.ean13 = EAN13(arg) + self.moduleWidth = 0.0130 + specModuleHeight = 1.00 + self.moduleHeight = 1.00 * heightMultiplier + self.bits = self.ean13.bits + barCodeSymbol.__init__(self) + self.font=font + + def bb(self): + return [ -12, -10, self.patternWidth*72+10, self.moduleHeight*72+12 ] + + def pslines(self): + return self.bitsComment() + \ + self.psSetModuleWidth() + \ + self.psSetBarWidthReduction() + \ + self.psSetBarHeight() + \ + self.psbars() + \ + self.psLRDigitLines() + + def psLRDigitLines(self): + # 24 = 3+6*7/2 + # 70 = 3+6*7+4+6*7/2 "4" so we center on the "L" bars (the rightmost of + # the center guard bars is an "O". + # "5" in check digit is the five-module spacing recommended by [2], section 3. + return [ "% We do the left digits first and leave the font scaled", + "% as is for the 9-digit and the right-digits.", + "% EAN13 Left Digits:", + "moduleWidth 24 mul 0 moveto", + "moduleWidth 40 mul (" + self.ean13.leftDigits + ") ", + "/" + self.font + " fitstring topcentershow", + "\n% EAN13 human-readable number", + "% The \"9\" digit (only when encoding ISBN's and ISMN's, I think):", + "-5 0 moveto (" + self.ean13.n[0] + ") toprightshow", + "% EAN13 Right Digits:", + "moduleWidth 70 mul 0 moveto", + "moduleWidth 40 mul (" + self.ean13.rightDigits + ") topcentershow" ] + +class EAN13(UPCA): + + def __init__(self,arg): + self.ndigits=13 # Includes check digit! + UPCA.__init__(self,arg) + leftBits = self.bits[0:42] + rightBits = self.bits[42:] + leftGuard="L0L" + rightGuard="L0L" + center="0L0L0" + self.bits = leftGuard + leftBits + center + rightBits + rightGuard + self.leftDigits = self.n[1:7] + self.rightDigits = self.n[7:13] + + def parityPattern(self): + # N.B. parity pattern based on leftmost digit, the UCC Spec calls this + # the "13th" digit. It's not the check digit! + return EAN13PARITY[int(self.n[0])] + def bitchar(self): + return EAN13BITS + +class UPC5Symbol(barCodeSymbol): + + def __init__(self,arg,heightMultiplier=1,barWidthReduction=0): + # arg is a string with the 5 digit add-on. + self.barWidthReduction=barWidthReduction + self.upc5 = UPC5(arg) + self.moduleWidth = 0.0130 + specModuleHeight = 0.852 + self.moduleHeight = 0.852 * heightMultiplier + self.bits = self.upc5.bits + barCodeSymbol.__init__(self) + + def pslines(self): + return self.bitsComment() + \ + self.psSetModuleWidth() + \ + self.psSetBarHeight() + \ + self.psbars() + + def bb(self): + # Note quiet zone is there even if we don't print the ">". + return [ 0, 0, self.patternWidth*72+10, self.moduleHeight*72+10 ] + +UPC5Error = "Something wrong with 5-digit price code add-on." +class UPC5(UPC): + + def __init__(self,arg): + self.ndigits=5 # Includes check digit! + p=re.search("[^0-9]",arg) + if p: + badchar=arg[p.start()] + raise UPC5Error, "\"%s\" is wrong. The character \"%s\" is not allowed. Price code add-on should contain %d digits and nothing else. Or leave blank to suppress the UPC-5 code." % (arg,badchar,self.ndigits) + elif len(arg) != self.ndigits: + raise UPC5Error, \ + "\"%s\" is wrong. Price code add-on should have exactly %d digits." % (arg,self.ndigits) + UPC.__init__(self,arg) + self.setbits(self.n) + leftGuard="1011" + # no right guard for UPC 5-digit add-on + # Have to insert pesky delineators: + delineator = "01" + self.bits = leftGuard + \ + self.bits[0:7] + delineator + \ + self.bits[7:14] + delineator + \ + self.bits[14:21] + delineator + \ + self.bits[21:28] + delineator + \ + self.bits[28:35] + + def checkDigit(self,arg): # UPC5 + weight=[3,9,3,9,3]; sum = 0 + for i in range(5): + sum = sum + int(arg[i]) * weight[i] + return self.xstring(sum % 10) + + def verifyCheckDigit(self): # UPC2/5 checksum not in number + return + + def parityPattern(self): + return UPC5PARITY[int(self.x)] + def bitchar(self): + return UPC5BITS + +class bookland(barCodeSymbol): + + def __init__(self,isbn,price="",*rest): + + + # Some defaults: + ean13font=EAN13FONT + isbnfont=ISBNFONT + upc5font = UPC5FONT + zone=None + heightMultiplier=1.0 + commandLine="" + barWidthReduction=0 + + # Maybe different fonts: + if len(rest)>0: + font=rest[0] + if font: + ean13font=font + isbnfont=font + upc5font=font + if len(rest)>1: + zone=rest[1] + if len(rest)>2: + heightMultiplier=float(rest[2]) + if len(rest) > 3: + commandLine=rest[3] + if len(rest) > 4: + barWidthReduction=float(rest[4]) + + # Initial setup: + + self.ps = psfile() + self.isbn = ISBN(isbn) + + # Header, EAN13 bars, EAN13 number, and ISBN: + + if self.isbn.name=="ISMN": + self.ean13Symbol = EAN13Symbol("9790"+self.isbn.n[1:9],ean13font,heightMultiplier,barWidthReduction) + elif self.isbn.name=="ISBN": + self.ean13Symbol = EAN13Symbol("978"+self.isbn.n[:9],ean13font,heightMultiplier,barWidthReduction) + else: + raise BooklandError, "Internal error doing %s, please report as bug" % isbn + + self.ps.orbb(self.ean13Symbol.bb()) + comments = ["", + " This is free software and comes with NO WARRANTY WHATSOVER", + " Think twice before going to press with this bar code!", + "", + "Command line: %s" % commandLine, + "" ] + self.ps.lines = self.ps.header(self.isbn.s,comments,ean13font,isbnfont,upc5font) + \ + [ "ean13font" ] + \ + self.ean13Symbol.pslines() +\ + [ "isbnfont" ] + \ + self.ean13Symbol.psTopCenterText("%s %s" % (self.isbn.name,self.isbn.s),isbnfont) + + # 5-digit add-on: (optional for ISBN only) + BLANK=re.compile("^ *$") + if self.isbn.name=="ISBN" and not BLANK.match(price): + # 105 = 95 + 10; 10 = separation (min is 9) + translate=[ self.ps.translate( self.ean13Symbol.moduleWidth * 72 * 105, 0 ) ] + self.upc5Symbol = UPC5Symbol(price,heightMultiplier,barWidthReduction) + self.ps.orbb(self.upc5Symbol.bb()) + self.ps.lines = self.ps.lines + \ + translate + \ + self.upc5Symbol.pslines() + \ + [ "upc5font" ] +\ + self.upc5Symbol.psBottomRightText(price,upc5font) + if zone: self.ps.lines=self.ps.lines + self.upc5Symbol.psGreaterThan(upc5font) + else: + self.ps.lines.append("%% Skipping UPC-5 price code symbol per request") + + self.ps.lines=self.ps.lines + self.ps.trailer() + + # Can now set bounding box. + + self.ps.setbb() + +# Here we go ... + +if __name__ == '__main__': + + def printUsage(): + print "Usage: bookland [-h|--help] [-v|--version] [-x|--check] [-f|--font=<font>] [-s|--height=<height scale>] [-r|--reduction=<reduction factor>] [-o|outfile=<filename>] [-z|--quietzone] [<isbn>|<isbn> <price>]" + print "Report bugs to " + MAINTAINER + + def printVersion(): + sys.stderr.write("%s version %s %s.\n" % (MYNAME,MYVERSION,COPYRIGHT)) + sys.stderr.write("Bugs to %s\n" % MAINTAINER) + sys.stderr.write("This is free software and comes with NO WARRANTY\n") + + import getopt + try: + opts,args = getopt.getopt(sys.argv[1:], + "xr:s:uvf:hzo:", + ["reduction=","outfile=","height=","noupc", + "check","version","help","font=","quietzone"]) + except: + printUsage() + sys.exit(0) + + # some initial defaults: + isbn = "1-56592-197-6" # Mark Lutz, "Programming Python", + # O'Reilly, Sebastopol CA, 1996 + price = "90000" + font=None + zone=None + checkonly=None + outfile=None + heightMultiplier=1 + commandLine = string.join(sys.argv) + barWidthReduction = 0 + + # parse command line: + for opt,val in opts: + if opt in ("-v","--version"): + printVersion() + sys.exit(0) + elif opt in ("-h","--help"): + printUsage() + sys.exit(0) + elif opt in ("-f","--font"): + font=val + elif opt in ("-z","--quietzone"): + zone=1 + elif opt in ("-x","--check"): + checkonly=1 + elif opt in ("-s","--height"): + heightMultiplier = float(val) + elif opt in ("-r","--reduction"): + barWidthReduction = val + elif opt in ("-o","--outfile"): + outfile=val + if len(args)==1: + isbn=args[0] + elif len(args)==2: + isbn=args[0] + price=args[1] + + # Do stuff. + + printVersion() + try: + b = bookland(isbn,price,font,zone,heightMultiplier, + commandLine,barWidthReduction) + if not checkonly: b.ps.out(outfile) + if outfile: + sys.stderr.write("Output written to %s\n" % outfile) + except BooklandError, message: + sys.stderr.write(BooklandError + ": " + message + "\n") + sys.exit(1) diff --git a/glabels2/barcode-0.98/cmdline.c b/glabels2/barcode-0.98/cmdline.c new file mode 100644 index 0000000..a69a825 --- /dev/null +++ b/glabels2/barcode-0.98/cmdline.c @@ -0,0 +1,177 @@ +/* + * cmdline.c -- parse a command line using getopt, environment and defaults + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Changes: + * Michele Comitini (mcm@glisco.it): better handling of numeric type args. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef NO_GETOPT + /* use replacement */ + #include "compat/getopt.h" +#else + #include <getopt.h> +#endif + +#include "cmdline.h" + +/* In case of error, print help string and return error (-1) */ +int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead) +{ + char *buffer; + char *buffer2; + int len; + struct commandline *ptr; + + if (!messagehead) { + fprintf(f,"%s: Error in cmdline\nPossible options:\n",prgname); + } else { + fprintf(f,"%s: %s",prgname,messagehead); + } + + for (ptr = args; ptr->option; ptr++) { + if (ptr->descrip) { + len = strlen(ptr->descrip); + len += ptr->default_v ? strlen(ptr->default_v) : 6; + len += ptr->env ? strlen(ptr->env) : 6; + buffer2 = malloc(len+3); /* 3 to be safe :) */ + len += 32; + if (buffer2) { + buffer = malloc(len); + if (buffer) { + sprintf(buffer2, ptr->descrip, + ptr->default_v ? ptr->default_v : "(none)", + ptr->env ? ptr->env : "(none)"); + sprintf(buffer, " -%c %s %s", ptr->option, + ptr->type ? "<arg>" : " ", buffer2); + fprintf(f, "%s\n",buffer); + free(buffer); + } + free(buffer2); + } + } + } + return -1; +} + +/* + * Associate formats to type. + */ +struct type_fmt { + enum option_type type; + char *fmt; +}; +static struct type_fmt formats[] = { + {CMDLINE_I, "%i%s"}, /* the trailing "%s" is used for error check */ + {CMDLINE_D, "%d%s"}, + {CMDLINE_X, "%x%s"}, + {CMDLINE_O, "%o%s"}, + {CMDLINE_F, "%lf%s"}, + {CMDLINE_P, "%p%s"}, + {0, NULL} /* If we get here, it's CMDLINE_S: no sscanf buf strcpy() */ +}; + + +/* Parse one argument (default or provided) */ +static int commandline_oneopt(struct commandline *ptr, char *value) +{ + struct type_fmt *tptr; + char *trash = value ? strdup(value) : NULL; + + /* convert it, if needed */ + if ((ptr->type != CMDLINE_NONE) && ptr->result) { + for (tptr = formats; tptr->type; tptr++) + if (tptr->type == ptr->type) + break; + if (!tptr->type) /* not found: it is a string */ + *(char **)(ptr->result) = value; + else + if (sscanf(value, tptr->fmt, ptr->result, trash)!=1) { + free(trash); + return -1; + } + } + if (trash) + free(trash); + + if ((ptr->type == CMDLINE_NONE) && ptr->result) /* no type, just count */ + (*(int *)(ptr->result))++; + + /* call the function, if needed */ + if (ptr->fun) { + if (ptr->type) { + if (ptr->result) return ptr->fun(ptr->result); /* converted */ + return ptr->fun(value); /* type, but not converted */ + } + return ptr->fun(NULL); /* no type: just call it */ + } + return 0; +} + +/* The main function */ +int commandline(struct commandline *args, int argc, char **argv, + char *errorhead) +{ + struct commandline *ptr; + char *getopt_desc = (char *)calloc(512, 1); + int desc_offset = 0; + int opt, retval; + char *value; + + /* Build getopt string and process defaults values */ + for (ptr = args; ptr->option; ptr++) { + getopt_desc[desc_offset++] = ptr->option; + if (ptr->type) getopt_desc[desc_offset++] = ':'; + + value = NULL; + if (ptr->env) + value = getenv(ptr->env); + if (!value) + value = ptr->default_v; + if (value && (retval = commandline_oneopt(ptr, value))) { + /* + * if the function returns a specific (not -1) value, it already + * printed its message, so avoid the generic help + */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + + /* Run getopt and process material */ + while ((opt = getopt(argc, argv, getopt_desc)) != -1) { + for (ptr = args; ptr->option; ptr++) + if (opt == ptr->option) + break; + if (!ptr->option) /* unknown option */ + return commandline_errormsg(stderr, args, argv[0], errorhead); + if ( (retval = commandline_oneopt(ptr, optarg)) ) { /* wrong arg */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + return 0; +} diff --git a/glabels2/barcode-0.98/cmdline.h b/glabels2/barcode-0.98/cmdline.h new file mode 100644 index 0000000..6931991 --- /dev/null +++ b/glabels2/barcode-0.98/cmdline.h @@ -0,0 +1,58 @@ +/* + * cmdline.h -- generic commandline editing (uses getopt, only short) + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* + * The options may have different arguments of different type + */ +enum option_type { + CMDLINE_NONE=0, /* no argument after option */ + CMDLINE_I, /* integer (any base) */ + CMDLINE_D, /* decimal integer */ + CMDLINE_X, /* hex integer */ + CMDLINE_O, /* octal integer */ + CMDLINE_S, /* string */ + CMDLINE_F, /* double float */ + CMDLINE_P, /* pointer */ +}; + + +struct commandline { + int option; /* Single byte: option id */ + int type; /* Type of argument, used in sscanf */ + void *result; /* Store data here, if non null */ + int (*fun)(void *); /* Call if defined: arg is "result" or input string */ + char *env; /* Where to get runtime defaults, may be NULL */ + char *default_v; /* The compile-time default, may be NULL */ + char *descrip; /* For err msg. May have %s's for default and env */ +}; + +/* returns: 0 or -1. "optarg" is global (see getopt) */ +extern int commandline(struct commandline *args, + int argc, char **argv, char *errorhead); + +/* prints an error message based on "args" */ +extern int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead); + + + + diff --git a/glabels2/barcode-0.98/codabar.c b/glabels2/barcode-0.98/codabar.c new file mode 100644 index 0000000..7065b9e --- /dev/null +++ b/glabels2/barcode-0.98/codabar.c @@ -0,0 +1,182 @@ +/* + * codabar.c -- encoding for Codabar + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "-$:/.+ABCD"; + +#define CODE_A 16 +#define CODE_B 17 + +#define NARROW 12 +#define WIDE 14 + +/* Patterns */ +static char *patterns[] = { +"1111133","1111331","1113113","3311111","1131131", +"3111131","1311113","1311311","1331111","3113111", +"1113311","1133111","3111313","3131113","3131311", +"1131313","1133131","1313113","1113133","1113331" }; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it. + * If the first character is a letter (A to D), the last one must be too; + * no other character should be a letter. + */ +int Barcode_cbr_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + int startpresent = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + char * pos; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + pos = strchr(alphabet,toupper(text[i])); + if (!pos) + return -1; + if (i == 0 && pos - alphabet >= CODE_A) + startpresent = 1; + else if (pos - alphabet >= CODE_A && + (!startpresent || i != strlen(text) - 1)) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr,"1%s", /* separator */ patterns[code]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_cbr_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0, startpresent; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("codabar"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 8 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen + check) +term */ + textinfo = malloc(10*(strlen(text) + 1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + ptr = partial; + textptr = textinfo; + textpos = 0; + usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1; + /* if no start character specified, A is used as a start character */ + if (!isalpha(text[0])) { + add_one(ptr, CODE_A); + ptr += strlen(ptr); + textpos = WIDE; + checksum = CODE_A; + startpresent = 0; + } else { + startpresent = 1; + } + for (i=0; i<strlen(text); i++) { + c = strchr(alphabet, toupper(text[i])); + if (!c) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + textpos += code < 12 ? NARROW : WIDE; + textptr += strlen(textptr); + ptr += strlen(ptr); + checksum += code; + if (startpresent && usesum && i == strlen(text) - 2) { + /* stuff a check symbol before the stop */ + c = strchr(alphabet, toupper(text[i+1])); + if (!c) /* impossible */ + continue; + code = c - alphabet; + checksum += code; + + /* Complement to a multiple of 16 */ + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + } + if (!startpresent) { + if (usesum) { + /* if no start character specified, B is used as a stop char */ + checksum += CODE_B; + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + add_one(ptr, CODE_B); + } + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/code128.c b/glabels2/barcode-0.98/code128.c new file mode 100644 index 0000000..cebba54 --- /dev/null +++ b/glabels2/barcode-0.98/code128.c @@ -0,0 +1,607 @@ +/* + * code128.c -- encoding for code128 (A, B, C) + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + +static char *codeset[] = { + "212222", "222122", "222221", "121223", "121322", /* 0 - 4 */ + "131222", "122213", "122312", "132212", "221213", + "221312", "231212", "112232", "122132", "122231", /* 10 - 14 */ + "113222", "123122", "123221", "223211", "221132", + "221231", "213212", "223112", "312131", "311222", /* 20 - 24 */ + "321122", "321221", "312212", "322112", "322211", + "212123", "212321", "232121", "111323", "131123", /* 30 - 34 */ + "131321", "112313", "132113", "132311", "211313", + "231113", "231311", "112133", "112331", "132131", /* 40 - 44 */ + "113123", "113321", "133121", "313121", "211331", + "231131", "213113", "213311", "213131", "311123", /* 50 - 54 */ + "311321", "331121", "312113", "312311", "332111", + "314111", "221411", "431111", "111224", "111422", /* 60 - 64 */ + "121124", "121421", "141122", "141221", "112214", + "112412", "122114", "122411", "142112", "142211", /* 70 - 74 */ + "241211", "221114", "413111", "241112", "134111", + "111242", "121142", "121241", "114212", "124112", /* 80 - 84 */ + "124211", "411212", "421112", "421211", "212141", + "214121", "412121", "111143", "111341", "131141", /* 90 - 94 */ + "114113", "114311", "411113", "411311", "113141", + "114131", "311141", "411131", "b1a4a2", "b1a2a4", /* 100 - 104 */ + "b1a2c2", "b3c1a1b" +}; + +#define START_A 103 +#define START_B 104 +#define START_C 105 +#define STOP 106 +#define SHIFT 98 /* only A and B */ +#define CODE_A 101 /* only B and C */ +#define CODE_B 100 /* only A and C */ +#define CODE_C 99 /* only A and B */ +#define FUNC_1 102 /* all of them */ +#define FUNC_2 97 /* only A and B */ +#define FUNC_3 96 /* only A and B */ +/* FUNC_4 is CODE_A when in A and CODE_B when in B */ + +#define SYMBOL_WID 11 /* all of them are 11-bar wide */ + +/* + * code 128-b includes all printable ascii chars + */ + +int Barcode_128b_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && *text>=32 && !(*text&0x80)) + text++; + if (*text) + return -1; /* a non-ascii char */ + return 0; /* ok */ +} + +int Barcode_128b_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128-B"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + /* up to now, it was the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_B]); + checksum += START_B; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; i<strlen(text); i++) { + if ( text[i] < 32 || (text[i] & 0x80)) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = text[i]-32; + strcat(partial, codeset[code]); + checksum += code * (i+1); /* first * 1 + second * 2 + third * 3... */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + +/* + * code 128-c is only digits, but two per symbol + */ + +int Barcode_128c_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + /* must be an even number of digits */ + if (strlen(text)%2) + return -1; + /* and must be all digits */ + for (; *text; text++) + if (!isdigit(*text)) + return -1; + return 0; +} + +int Barcode_128c_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128-C"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 3) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * strlen +term */ + textinfo = malloc(12*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_C]); + checksum += START_C; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; text[i]; i+=2) { + if (!isdigit(text[i]) || !isdigit(text[i+1])) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = (text[i]-'0') * 10 + text[i+1]-'0'; + strcat(partial, codeset[code]); + checksum += code * (i/2+1); /* first * 1 + second * 2 + third * 3... */ + + /* print as "%s", because we have ".5" positions */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, text[i], + textpos + (double)SYMBOL_WID/2, text[i+1]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + +/* + * generic (full-featured) code128 implementation: it selects between + * A, B, C according to the data being encoded. F1, F2, F3, F4 are expressed + * using ascii chars 0xc1, 0xc2, 0xc3, 0xc4 (0301, 0302, 0303, 0304). + * Char '\0' is expressed by 0x80 (0200). + */ + +int Barcode_128_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && (*text<=0x80 || (*text >= 0xc1 && *text <= 0xc4))) + text++; + if (*text) + return -1; /* unencodable character */ + return 0; /* ok */ +} + + +/* + * These functions are extracted from Barcode_128_encode for clarity. + * It deals with choosing the symbols used to represent the text + * and returns a dynamic array of integers, terminated by -1. + * + * The algorithm used in choosing the codes comes from App 2 of + * "El Codigo Estandar EAN/UCC 128", courtesy of AECOC, Spain. + * Thanks to Dani Pardo for getting permission and giving me a copy + * of the document + */ + +#define NEED_CODE_A(c) ((c)<32 || (c)==0x80) +#define NEED_CODE_B(c) ((c)>=96 && (c)<128) + +static int Barcode_a_or_b(unsigned char *text) +{ + for ( ; *text; text++) { + if (NEED_CODE_A(*text)) + return 'A'; + if (NEED_CODE_B(*text)) + return 'B'; + } + return 0; /* any */ +} + +/* code is either 'A' or 'B', and value must be valid */ +static int Barcode_encode_as(int code, int value) +{ + + /* first check the special chars */ + if (value == 0xC1) return FUNC_1; + if (value == 0xC2) return FUNC_2; + if (value == 0xC3) return FUNC_3; + if (value == 0xC4) { /* F4 */ + if (code == 'A') return CODE_A; + return CODE_B; + } + + /* then check ascii values */ + if (value >= 0x20 && value <= 0x5F) + return value - 0x20; /* both codes */ + if (value == 0x80) return 64; /* code A */ + if (value < 0x20) return value+64; /* code A */ + if (value >= 0x60) return value - 0x20; /* code B */ + /* can't happen */ + return -1; +} + +static int *Barcode_128_make_array(struct Barcode_Item *bc, int *lptr) +{ + int len, *codes; + unsigned char *s; + int i=0, j, code, checksum; + + /* allocate twice the text length + 5, as this is the worst case */ + len = 2 * strlen(bc->ascii) + 5; + codes = malloc(len * sizeof(int)); + s = bc->ascii; + + /* choose the starting code */ + if (s[2]=='\0' && isdigit(s[0]) && isdigit(s[1])) { + code = 'C'; + } else if (isdigit(s[0])&&isdigit(s[1]) && isdigit(s[2])&&isdigit(s[3])) { + code = 'C'; + } else { + code = Barcode_a_or_b(s); + if (!code) code = 'B'; /* default */ + } + codes[i++] = START_A + code - 'A'; + + for (s = bc->ascii; *s; /* increments are in the loop */) { + switch(code) { + + case 'C': + if (s[0] == 0xC1) { /* F1 is valid */ + codes[i++] = FUNC_1; + s++; + } else if (isdigit(s[0]) && isdigit(s[1])) { + /* encode two digits */ + codes[i++] = (s[0]-'0') * 10 + s[1]-'0'; + s += 2; + } else { + /* change code */ + code = Barcode_a_or_b(s); + if (!code) code = 'B'; + codes[i++] = (code == 'A') ? CODE_A : CODE_B; + } + break; + + case 'B': + case 'A': + for (j=0; isdigit(s[j]); j++) + ; + if (j>=4) { /* if there are 4 or more digits, turn to C */ + if (j&1) { + /* odd number: encode one first */ + codes[i++] = *(s++) - ' '; + } + codes[i++] = CODE_C; + code = 'C'; + } else if (code == 'A' && NEED_CODE_B(*s)) { + /* check whether we should use SHIFT or change code */ + j = Barcode_a_or_b(s+1); + if (j == 'B') { + codes[i++] = CODE_B; + code = 'B'; + } else { + codes[i++] = SHIFT; + codes[i++] = Barcode_encode_as('B', *s); + s++; + } + } else if (code == 'B' && NEED_CODE_A(*s)) { + /* check whether we should use SHIFT or change code */ + j = Barcode_a_or_b(s+1); + if (j == 'A') { + codes[i++] = CODE_A; + code = 'A'; + } else { + codes[i++] = SHIFT; + codes[i++] = Barcode_encode_as('A', *s); + s++; + } + } else { + codes[i++] = Barcode_encode_as(code, *s); + s++; + } + break; + } + } + /* add the checksum */ + checksum = codes[0]; + for (j=1; j<i; j++) + checksum += j * codes[j]; + checksum %= 103; + codes[i++] = checksum; + codes[i++] = STOP; + if (i > len) { + fprintf(stderr, "impossible: length is > allocated len\n"); + } + *lptr = i; + return codes; +} + +/* + * Encoding is tricky, in that we cannot print the ascii + * representation in an easy way. Therefore, just skip non-printable + * chars and try to fit the rest somehow. + */ +int Barcode_128_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int *codes; /* dynamic */ + int i, c, len; + double textpos, size, step; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + codes = Barcode_128_make_array(bc, &len); + if (!codes) return -1; + + /* the partial code is 6*codelen + ini + term (+margin) */ + partial = malloc( 6 * len + 4); + if (!partial) { + bc->error = errno; + free(codes); + return -1; + } + + /* the text information is at most "nnn.n:ff.f:c " * strlen +term */ + textptr = textinfo = malloc(13*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(codes); + return -1; + } + + /* up to now, it was almost the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + for (i=0; i<len; i++) /* the symbols */ + strcat(partial, codeset[codes[i]]); + + /* avoid bars that fall lower than other bars */ + for (i=0; partial[i]; i++) + if (isalpha(partial[i])) + partial[i] += '1' - 'a'; + + /* + * the accompanying text: reserve a space for every char. + * F[1-4] are rendered as spaces (separators), other unprintable chars + * are rendered as underscoress (placeholders) + */ + + /* + * A size of 9 is good for code-C (used above), so 18 for each symbol, + * but we place an upper limit of 12 to avoid overlapping on the bars. + */ + size = (int)(180.0 * (len-3) / strlen(text) + .5) / 10.0; + if (size > 12.0) size = 12.0; + + /* align the text to the left, using its natural size */ + step = (int)(10 * (size/18.0 * SYMBOL_WID) + .5) / 10.0; + textpos = SYMBOL_WID; + + for (i=0; i<strlen(text); i++) { + c = text[i]; + if (c < 32 || c == 0x80) c = '_'; /* not printable */ + if (c > 0xc0) c = ' '; /* F code */ + sprintf(textptr, "%g:%g:%c ", textpos, size, c); + textptr += strlen(textptr); + textpos += step; + } + + bc->partial = partial; + bc->textinfo = textinfo; + free(codes); + return 0; +} + +/* + * A raw 128 code is given as a sequence of space separated numbers + * from 0 to 105, starting from the start code to be (Leonid) + */ + +int Barcode_128raw_verify(unsigned char *text) +{ + int n; + unsigned val; + + if (!strlen(text)) + return -1; + while (*text) { + if (sscanf(text, "%u%n", &val, &n) < 1) + return -1; + if (val > 105) + return -1; + text += n; + } + return 0; +} + +int Barcode_128raw_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, n, count, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("128raw"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* + * length of partial code is unknown in advance, but it is + * at most 6* (1+text/2 + check + tail) + final + terminator + */ + partial = malloc( (3+ strlen(text)/2) * 6 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * 1+strlen/2 +term */ + textinfo = malloc(12 * (1+strlen(text)/2) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + textptr = textinfo; + textpos = 0; + + for (i=0, count = 0; i < strlen(text); count++) { + if (sscanf(text + i, "%u%n", &code, &n) < 1) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + strcat(partial, codeset[code]); + + /* + * since the start code is part of the "raw" input, it is + * counted in the checksum by itself + */ + if (!count) checksum += code; /* the start code */ + else checksum += code * count; /* first * 1 + second * 2 ... */ + + /* + * print as "%s", because we have ".5" positions + * also, use a size of 9 like codeC above, as each symbol is + * represented by two chars + */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, + code >= 100 ? 'A' : code/10 + '0', + textpos + (double)SYMBOL_WID/2, code%10 + '0'); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + i += n; + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + diff --git a/glabels2/barcode-0.98/code39.c b/glabels2/barcode-0.98/code39.c new file mode 100644 index 0000000..3308c95 --- /dev/null +++ b/glabels2/barcode-0.98/code39.c @@ -0,0 +1,173 @@ +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "1234567890" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. *" "$/+%"; + +/* the checksum alphabet has a different order */ +static char checkbet[] = + "0123456789" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. $" "/+%"; + +/* The first 40 symbols repeat this bar pattern */ +static char *bars[] = { + "31113","13113","33111","11313","31311", + "13311","11133","31131","13131","11331"}; + +/* The first 4 decades use these space patterns */ +static char *spaces[] = {"1311","1131","1113","3111"}; + +/* the last four symbols are special */ +static char *specialbars[] = { + "11111","11111","11111","11111"}; + +static char *specialspaces[] = { + "3331","3313","3133","1333"}; + +static char *fillers[]= { + "0a3a1c1c1a", + "1a3a1c1c1a" +}; + + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_39_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + + if (text[0] == '\0') + return -1; + for (i=0; text[i]; i++) { + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + if (!strchr(alphabet,toupper(text[i]))) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + char *b, *s; + + if (code < 40) { + b = bars[code%10]; + s = spaces[code/10]; + } else { + b = specialbars[code-40]; + s = specialspaces[code-40]; + } + sprintf(ptr,"1%c%c%c%c%c%c%c%c%c", /* separator */ + b[0], s[0], b[1], s[1], b[2], s[2], + b[3], s[3], b[4]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_39_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 39"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 10* (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 10 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = 22; + + for (i=0; text[i]; i++) { + c = strchr(alphabet, toupper(text[i])); + if (!c) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + c = strchr(checkbet,*c); + if (c) /* the '*' is not there */ + checksum += (c-checkbet); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += 16; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + } + /* Add the checksum */ + if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) { + code = (strchr(alphabet, checkbet[checksum % 43]) - alphabet); + add_one(ptr, code); + } + strcat(ptr, fillers[1]); /* end */ + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/code93.c b/glabels2/barcode-0.98/code93.c new file mode 100644 index 0000000..73f8cee --- /dev/null +++ b/glabels2/barcode-0.98/code93.c @@ -0,0 +1,213 @@ +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Nathan D. Holmes / FedEx Services (ndholmes@fedex.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; + +static char *codeset[] = { + "131112", "111213", "111312", "111411", "121113", /* 0 - 4 */ + "121212", "121311", "111114", "131211", "141111", /* 5 - 9 */ + "211113", "211212", "211311", "221112", "221211", /* A - E */ + "231111", "112113", "112212", "112311", "122112", /* F - J */ + "132111", "111123", "111222", "111321", "121122", /* K - O */ + "131121", "212112", "212211", "211122", "211221", /* P - T */ + "221121", "222111", "112122", "112221", "122121", /* U - Y */ + "123111", "121131", "311112", "311211", "321111", /* Z - $ */ + "112131", "113121", "211131", "121221", "312111", /* / - (%) */ + "311121", "122211", "111141" /* (/) - (terminator) */ +}; + + +/* 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111 */ +/* 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222 */ +/* 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 */ +static char shiftset[] = + "%$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%% /// ///// / /%%%%%% %%%%%%++++++++++++++++++++++++++%%%%%"; +static char shiftset2[] = + "UABCDEFGHIJKLMNOPQRSTUVWXYZABCDE ABC FGHIJ L ZFGHIJV KLMNOWABCDEFGHIJLKMNOPQRSTUVWXYZPQRST"; + +#define START_STOP 47 +#define EXTEND_DOLLAR 43 +#define EXTEND_PERCENT 44 +#define EXTEND_SLASH 45 +#define EXTEND_PLUS 46 + +/* + * Check that the text can be encoded. Returns 0 or -1. + * All of ASCII-7 is accepted. + */ +int Barcode_93_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + + /* Test if beyond the range of 7-bit ASCII */ + if ((int)text[i] > 127) + return -1; + } + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_93_encode(struct Barcode_Item *bc) +{ + static unsigned char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *textptr; + int *checksum_str; + int i, code, textpos, checksum_len=0; + int c_checksum = 0; + int k_checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 93"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + /* the partial code is 6 * (head + 2* text + 2* check + tail) + margin + term. */ + partial = malloc( (strlen(text) *2 + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + checksum_str = (int *)malloc( (strlen(text) + 3) * 2 * sizeof(int)); + if (!checksum_str) { + free(partial); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(checksum_str); + return -1; + } + + textptr = textinfo; + textpos = 22; + strcpy(partial, "0"); + strcat(partial, codeset[START_STOP]); + + for (i=0; i<strlen(text); i++) { + c = strchr(alphabet, text[i]); + if (!c) { + /* Encode the shift character */ + switch(shiftset[text[i]]) + { + case '$': + code = EXTEND_DOLLAR; + break; + case '%': + code = EXTEND_PERCENT; + break; + case '/': + code = EXTEND_SLASH; + break; + case '+': + code = EXTEND_PLUS; + break; + default: + code = 0; + break; + } + + strcat(partial, codeset[code]); + checksum_str[checksum_len++] = code; + + /* Encode the second character */ + code = strchr(alphabet, shiftset2[text[i]]) - alphabet; + strcat(partial, codeset[code]); + checksum_str[checksum_len++] = code; + } else { + /* Character is natively supported by the symbology, encode directly */ + code = c - alphabet; + strcat(partial, codeset[c -alphabet]); + checksum_str[checksum_len++] = code; + } + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + textptr += strlen(textptr); + /* + * width of each code is 9; composed codes are 18, but aligning + * the text behind the right bars would be ugly, so use 9 anyways + */ + textpos += 9; + } + c_checksum=0; + k_checksum=0; + + /* Add the checksum */ + if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) + { + for(i=1; i<=checksum_len; i++) + { + c_checksum += i * (int)checksum_str[checksum_len - i]; + k_checksum += (i+1) * (int)checksum_str[checksum_len - i]; + } + + c_checksum = c_checksum % 47; + k_checksum += c_checksum; + k_checksum = k_checksum % 47; + + strcat(partial, codeset[c_checksum]); + strcat(partial, codeset[k_checksum]); + + } + strcat(partial, codeset[START_STOP]); /* end */ + + /* Encodes final 1-unit width bar to turn the start character into a stop char */ + strcat(partial, "1"); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/compat/getopt.c b/glabels2/barcode-0.98/compat/getopt.c new file mode 100644 index 0000000..91f00b5 --- /dev/null +++ b/glabels2/barcode-0.98/compat/getopt.c @@ -0,0 +1,831 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. + Ditto for AIX 3.2 and <stdlib.h>. */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include <stdlib.h> +#if defined (_LIBC) || defined (HAVE_UNISTD_H) +#include <unistd.h> +#endif +#endif /* GNU C library. */ + +#ifdef VMS +#include <unixlib.h> +#if HAVE_STRING_H - 0 +#include <string.h> +#endif +#endif + +#ifdef WIN32 +/* It's not Unix, really. See? Capital letters. */ +#include <windows.h> +#define getpid() GetCurrentProcessId() +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +#ifdef HAVE_LIBINTL_H +# include <libintl.h> +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include <string.h> +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +static const char *nonoption_flags; +static int nonoption_flags_len; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined (__STDC__) && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined (__STDC__) && __STDC__ +static const char *_getopt_initialize (const char *); +#endif +static const char * +_getopt_initialize (optstring) + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + + if (posixly_correct == NULL) + { + /* Bash 2.0 puts a special variable in the environment for each + command it runs, specifying which ARGV elements are the results of + file name wildcard expansion and therefore should not be + considered as options. */ + char var[100]; + sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); + nonoption_flags = getenv (var); + if (nonoption_flags == NULL) + nonoption_flags_len = 0; + else + nonoption_flags_len = strlen (nonoption_flags); + } + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0) + { + optstring = _getopt_initialize (optstring); + optind = 1; /* Don't scan ARGV[0], the program name. */ + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. */ +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && nonoption_flags[optind] == '1')) + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + +#ifdef lint /* Suppress `used before initialized' warning. */ + indfound = 0; +#endif + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if (nameend - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/glabels2/barcode-0.98/compat/getopt.h b/glabels2/barcode-0.98/compat/getopt.h new file mode 100644 index 0000000..952f483 --- /dev/null +++ b/glabels2/barcode-0.98/compat/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/glabels2/barcode-0.98/configure b/glabels2/barcode-0.98/configure new file mode 100755 index 0000000..bf7e1b8 --- /dev/null +++ b/glabels2/barcode-0.98/configure @@ -0,0 +1,3556 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="barcode.h" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<EOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +EOF + + cat <<EOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +EOF + + cat <<\EOF +EOF +fi + +if test -n "$ac_init_help"; then + + cat <<\EOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.52. Invocation command line was + + $ $0 $@ + +EOF +{ +cat <<_ASUNAME +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:819: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:830: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:838: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:854: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:858: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:864: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:866: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:868: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:887: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:889: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:909: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:912: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:929: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:944: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:952: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:955: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:964: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:979: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:987: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:990: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1003: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1018: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1026: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1029: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1038: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1053: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1061: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1064: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1077: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1097: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1119: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1122: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1133: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1148: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1156: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1159: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1172: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1187: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1195: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1198: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1210: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1215:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1218: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1221: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1223: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1226: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1228: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1231: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1235 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1251: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1254: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1257: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1280: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1286: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1291: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1297: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1300: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1307: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1315: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1322: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1324: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1327: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1329: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1332: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1348: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1354: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1360: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1366 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1378: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1381: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1393: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1400: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1404: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1410 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1425: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1428: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1431: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1434: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1446: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1452: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1458 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1470: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1473: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1476: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1479: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1489: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1516: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1519: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1522: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1525: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1537 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1550: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1553: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1556: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1559: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1569 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1581: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1584: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1587: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1590: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:1620: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:1635: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:1643: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:1646: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:1655: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:1670: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:1679: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:1682: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:1708: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1728: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1777: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test x$GCC = xyes; then + CFLAGS="$CFLAGS -Wall" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:1797: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1818 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:1823: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1829: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1852 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:1856: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1862: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:1899: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1909 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:1914: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1920: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1943 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:1947: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1953: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:1981: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:1992: checking for getopt.h" >&5 +echo $ECHO_N "checking for getopt.h... $ECHO_C" >&6 +if test "${ac_cv_header_getopt_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1998 "configure" +#include "confdefs.h" +#include <getopt.h> +_ACEOF +if { (eval echo "$as_me:2002: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2008: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_getopt_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_getopt_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2027: result: $ac_cv_header_getopt_h" >&5 +echo "${ECHO_T}$ac_cv_header_getopt_h" >&6 +if test $ac_cv_header_getopt_h = yes; then + : +else + NO_GETOPT=-DNO_GETOPT;GETOPT_O=compat/getopt.o +fi + +echo "$as_me:2035: checking for paper.h" >&5 +echo $ECHO_N "checking for paper.h... $ECHO_C" >&6 +if test "${ac_cv_header_paper_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2041 "configure" +#include "confdefs.h" +#include <paper.h> +_ACEOF +if { (eval echo "$as_me:2045: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2051: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_paper_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_paper_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2070: result: $ac_cv_header_paper_h" >&5 +echo "${ECHO_T}$ac_cv_header_paper_h" >&6 +if test $ac_cv_header_paper_h = yes; then + LIBPAPER=-lpaper +else + NO_LIBPAPER=-DNO_LIBPAPER +fi + +for ac_header in unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:2081: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2087 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2091: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2097: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2116: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:2126: checking for strerror" >&5 +echo $ECHO_N "checking for strerror... $ECHO_C" >&6 +if test "${ac_cv_func_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2132 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strerror (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strerror) || defined (__stub___strerror) +choke me +#else +f = strerror; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2163: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2166: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2169: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2172: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_strerror=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2182: result: $ac_cv_func_strerror" >&5 +echo "${ECHO_T}$ac_cv_func_strerror" >&6 +if test $ac_cv_func_strerror = yes; then + : +else + NO_STRERROR=-DNO_STRERROR +fi + +for ac_func in strcasecmp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:2193: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2199 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2230: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2233: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2236: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2239: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2249: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:2259: checking \"for gmake\"" >&5 +echo $ECHO_N "checking \"for gmake\"... $ECHO_C" >&6 +GMAKE=no +${MAKE=make} --version 2> /dev/null | grep GNU > /dev/null && GMAKE=yes +echo "$as_me:2263: result: $GMAKE" >&5 +echo "${ECHO_T}$GMAKE" >&6 +if test "$GMAKE" = "yes"; then + GMAKEDEPEND0='ifeq (.depend,$(wildcard .depend))' + GMAKEDEPEND1='include .depend' + GMAKEDEPEND2='endif' +fi + +echo "$as_me:2271: checking \"if makeinfo can output html\"" >&5 +echo $ECHO_N "checking \"if makeinfo can output html\"... $ECHO_C" >&6 +MAKEINFOHTML=no +${MAKEINFO=makeinfo} --help | grep .--html > /dev/null && MAKEINFOHTML=yes +echo "$as_me:2275: result: $MAKEINFOHTML" >&5 +echo "${ECHO_T}$MAKEINFOHTML" >&6 +if test "$MAKEINFOHTML" = "yes"; then + REMOVEHTMLTAGS="cat" + INFOTOHTML="$MAKEINFO --html" +else + REMOVEHTMLTAGS="sed 's/ifnottex/ifinfo/; s/ifnotinfo/iftex/'" + INFOTOHTML="perl texi2html -monolithic" +fi + +ac_config_files="$ac_config_files Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\EOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +EOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:2395: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." +EOF + +cat >>$CONFIG_STATUS <<EOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.52, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:2563: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:2582: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:2618: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CPP@,$CPP,;t t +s,@GETOPT_O@,$GETOPT_O,;t t +s,@NO_GETOPT@,$NO_GETOPT,;t t +s,@NO_LIBPAPER@,$NO_LIBPAPER,;t t +s,@LIBPAPER@,$LIBPAPER,;t t +s,@NO_STRERROR@,$NO_STRERROR,;t t +s,@GMAKEDEPEND0@,$GMAKEDEPEND0,;t t +s,@GMAKEDEPEND1@,$GMAKEDEPEND1,;t t +s,@GMAKEDEPEND2@,$GMAKEDEPEND2,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:2833: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:2851: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:2864: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +ac_config_files="$ac_config_files doc/Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\EOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +EOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:3029: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." +EOF + +cat >>$CONFIG_STATUS <<EOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.52, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:3197: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:3216: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + *) { { echo "$as_me:3253: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CPP@,$CPP,;t t +s,@GETOPT_O@,$GETOPT_O,;t t +s,@NO_GETOPT@,$NO_GETOPT,;t t +s,@NO_LIBPAPER@,$NO_LIBPAPER,;t t +s,@LIBPAPER@,$LIBPAPER,;t t +s,@NO_STRERROR@,$NO_STRERROR,;t t +s,@GMAKEDEPEND0@,$GMAKEDEPEND0,;t t +s,@GMAKEDEPEND1@,$GMAKEDEPEND1,;t t +s,@GMAKEDEPEND2@,$GMAKEDEPEND2,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@REMOVEHTMLTAGS@,$REMOVEHTMLTAGS,;t t +s,@INFOTOHTML@,$INFOTOHTML,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:3471: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3489: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3502: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/glabels2/barcode-0.98/configure.in b/glabels2/barcode-0.98/configure.in new file mode 100644 index 0000000..07120b4 --- /dev/null +++ b/glabels2/barcode-0.98/configure.in @@ -0,0 +1,65 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(barcode.h) +AC_PREREQ(2.12) + +AC_PROG_CC +AC_PROG_RANLIB +AC_PROG_INSTALL + +dnl Add "-Wall" if this is gcc +if test x$GCC = xyes; then + CFLAGS="$CFLAGS -Wall" +fi + + +dnl Check for getopt and libpaper. If getopt is missing, use our version +AC_CHECK_HEADER(getopt.h, ,NO_GETOPT=-DNO_GETOPT;GETOPT_O=compat/getopt.o) +AC_CHECK_HEADER(paper.h, LIBPAPER=-lpaper, NO_LIBPAPER=-DNO_LIBPAPER) +AC_CHECK_HEADERS(unistd.h) + +AC_CHECK_FUNC(strerror, , NO_STRERROR=-DNO_STRERROR) +AC_CHECK_FUNCS(strcasecmp) + +dnl Check if this is gmake, but allow ovverriding using $MAKE +AC_MSG_CHECKING("for gmake") +GMAKE=no +${MAKE=make} --version 2> /dev/null | grep GNU > /dev/null && GMAKE=yes +AC_MSG_RESULT($GMAKE) +if test "$GMAKE" = "yes"; then + GMAKEDEPEND0='ifeq (.depend,$(wildcard .depend))' + GMAKEDEPEND1='include .depend' + GMAKEDEPEND2='endif' +fi + +dnl Check if we use makeinfo or the local texi2html tool +AC_MSG_CHECKING("if makeinfo can output html") +MAKEINFOHTML=no +${MAKEINFO=makeinfo} --help | grep .--html > /dev/null && MAKEINFOHTML=yes +AC_MSG_RESULT($MAKEINFOHTML) +if test "$MAKEINFOHTML" = "yes"; then + REMOVEHTMLTAGS="cat" + INFOTOHTML="$MAKEINFO --html" +else + REMOVEHTMLTAGS="sed 's/ifnottex/ifinfo/; s/ifnotinfo/iftex/'" + INFOTOHTML="perl texi2html -monolithic" +fi + + +AC_SUBST(GETOPT_O) +AC_SUBST(NO_GETOPT) +AC_SUBST(NO_LIBPAPER) +AC_SUBST(LIBPAPER) +AC_SUBST(NO_STRERROR) +AC_SUBST(GMAKEDEPEND0) +AC_SUBST(GMAKEDEPEND1) +AC_SUBST(GMAKEDEPEND2) + +AC_OUTPUT(Makefile) + +AC_SUBST(MAKEINFO) +AC_SUBST(REMOVEHTMLTAGS) +AC_SUBST(INFOTOHTML) + +AC_OUTPUT(doc/Makefile) + diff --git a/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz Binary files differnew file mode 100644 index 0000000..69df956 --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz diff --git a/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README new file mode 100644 index 0000000..1608eba --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcode-SVG.tar.gz.README @@ -0,0 +1,24 @@ + +[readme written by GNU-barcode maintainer] + +This is a stripped version of what you can find at: + http://www.onefour.net/barcode/SVG/barcode097-SVG.tar.gz + +It's by David J. Humphreys, it's GPL code and the original tarball +(as per the previous URL) contains: + +-rwxr--r-- david/david 243 2002-01-02 04:18:00 Makefile +-rwxr--r-- david/david 1284 2002-01-08 00:26:42 main.c +-rwxr--r-- david/david 37796 2002-01-02 04:33:00 screen1.png +-rwxr--r-- david/david 5503 2002-01-08 00:30:00 svg.c +-rwxr--r-- david/david 2499 2002-01-02 03:37:00 test1.svg +-rwxr--r-- david/david 2499 2002-01-02 03:44:00 test2.svg +-rwxr--r-- david/david 2499 2002-01-02 03:49:00 test3.svg +-rwxr--r-- david/david 34185 2002-01-02 04:41:00 test4.png +-rwxr--r-- david/david 1834 2002-01-02 04:19:00 test4.svg +-rwxr--r-- david/david 92713 2002-01-02 04:36:00 transformation.png +-rwxr--r-- david/david 586 2002-01-02 04:11:00 transformation.svg + +Here I only included Makefile, main.c, svg.c, after converting +newlines to unix-style and changing permissions. + diff --git a/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz Binary files differnew file mode 100644 index 0000000..cbc8e67 --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz diff --git a/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README new file mode 100644 index 0000000..36d216d --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcode-for-delphi.tar.gz.README @@ -0,0 +1,10 @@ + +The barcode-for-delphi tarball includes a version of this package +ported to run under Delphi. Please note that you can't distribute the +executable because of the GPL (i.e., disitributing it would be +copyright violation, because the executable is a derived work of GNU +barcode, whose authors don't allow distributing under non-GPL terms. + +I still think it may be useful to some users. + +The code has been contributed by Michael Geddes <michael@webease.com.au>. diff --git a/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz b/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz Binary files differnew file mode 100644 index 0000000..1dadb1c --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz diff --git a/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz.README b/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz.README new file mode 100644 index 0000000..b0364f6 --- /dev/null +++ b/glabels2/barcode-0.98/contrib/barcodeps-0.1.tgz.README @@ -0,0 +1,25 @@ + + ***** barcodeps 0.1 ***** + 2000-10-07 + +Barcodes generated in PostScript +by Hans Schou http://www.schou.dk + +PostScript is a programming language. It has all the control structures +needed for creating barcodes on the fly. With this example it is not +needed to have another programming language than PostScript as the +barcodes are generated within the PostScript printer. + +This contribution gives some examples of how to generate Interleave 2 of 5 +barcodes. Edit the bottom of i25.ps with a new number and send it to +a PostScript printer to see an example. + +Usage, in PostScript: +To draw a Interleave 2 of 5 use the following command in i25.ps + (123456789) BarCodeI25 + +This method is very usefull used together with other scripts +or programming language as it is only necessary to copy some +files to the printer. No program execution is needed. + + diff --git a/glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz b/glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz Binary files differnew file mode 100644 index 0000000..91fa9e6 --- /dev/null +++ b/glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz diff --git a/glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz.README b/glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz.README new file mode 100644 index 0000000..4a04807 --- /dev/null +++ b/glabels2/barcode-0.98/contrib/grab-0.0.4.tar.gz.README @@ -0,0 +1,13 @@ + +The purpose of this program is to read a (scanned) image containing a +barcode. The image is then interpreted and the barcode is decoded. +The decoded string is outputted to stdout. + +Currently, only Code-128 is supported. + +The program is GPL'd and it's the work of Tuukka Toivonen. + +The home page for this and other programs by Tuukka is + http://www.ee.oulu.fi/~tuukkat/releases.html +while a bare ls-like listing of all packages is at + http://www.ee.oulu.fi/~tuukkat/rel/ diff --git a/glabels2/barcode-0.98/debian/README.debian b/glabels2/barcode-0.98/debian/README.debian new file mode 100644 index 0000000..7223023 --- /dev/null +++ b/glabels2/barcode-0.98/debian/README.debian @@ -0,0 +1,9 @@ +The Debian Package barcode +---------------------------- + +This Debian package is integrated in the upstream release of GNU +barcode, maintained by Alessandro Rubini (rubini@gnu.org, +rubini@prosa.it). Since I have no extended experience with Debian +packages, I'm willing to accept any fixes that seem fit, as well as a +real Debian maintainer for the Debian package. + diff --git a/glabels2/barcode-0.98/debian/changelog b/glabels2/barcode-0.98/debian/changelog new file mode 100644 index 0000000..b43e686 --- /dev/null +++ b/glabels2/barcode-0.98/debian/changelog @@ -0,0 +1,27 @@ +barcode (0.98) unstable; urgency=low + + * New upstream release + + -- Alessandro Rubini <rubini@gnu.org> Fri, 1 Mar 2002 23:04:14 +0100 + +barcode (0.96) unstable; urgency=low + + * New upstream release + + -- Alessandro Rubini <rubini@gnu.org> Wed, 8 Nov 2000 18:29:18 +0200 + +barcode (0.95) unstable; urgency=low + + * New upstream release + + -- Alessandro Rubini <rubini@gnu.org> Thu, 3 Feb 2000 21:16:59 +0200 + +barcode (0.94) unstable; urgency=low + + * Initial Release. + + -- Alessandro Rubini <rubini@gnu.org> Sun, 24 Oct 1999 01:10:23 +0200 + +Local variables: +mode: debian-changelog +End: diff --git a/glabels2/barcode-0.98/debian/control b/glabels2/barcode-0.98/debian/control new file mode 100644 index 0000000..aacbfd4 --- /dev/null +++ b/glabels2/barcode-0.98/debian/control @@ -0,0 +1,14 @@ +Source: barcode +Section: misc +Priority: optional +Maintainer: Alessandro Rubini <rubini@prosa.it> +Standards-Version: 2.5.0 + +Package: barcode +Architecture: any +Depends: ${shlibs:Depends} +Description: Creates barcodes in .ps format + GNU barcode can create printouts for the conventional + product packagging standards: UPC-A, UPC-E, EAN-13, EAN-8, ISBN, code 39 + code 128 (b and c), and interleaved 2 of 5 . Ouput is generated as + either Postscript or Encapsulated Postscript. diff --git a/glabels2/barcode-0.98/debian/copyright b/glabels2/barcode-0.98/debian/copyright new file mode 100644 index 0000000..c193af2 --- /dev/null +++ b/glabels2/barcode-0.98/debian/copyright @@ -0,0 +1,8 @@ +This package was written by Alessandro Rubini rubini@gnu.org on Sun, 24 Oct 1999 01:10:23 +0200. + +The pristine source can be downloaded from ftp://ftp.gnu.org/pub/barcode +and GNU mirrors. Latest and greatest version (also beta) are immediately +uploaded to ftp://ftp.prosa.it/pub/software. + +Copyright: GPL (see /usr/doc/copyright/GPL) + diff --git a/glabels2/barcode-0.98/debian/dirs b/glabels2/barcode-0.98/debian/dirs new file mode 100644 index 0000000..6822e40 --- /dev/null +++ b/glabels2/barcode-0.98/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +usr/include +usr/info diff --git a/glabels2/barcode-0.98/debian/info b/glabels2/barcode-0.98/debian/info new file mode 100644 index 0000000..18336bf --- /dev/null +++ b/glabels2/barcode-0.98/debian/info @@ -0,0 +1,15 @@ +# This is a configuration files for installing a .info menu +# The Description to be placed into the directory +DESCR="Barcode library and frontend" + +# The section this info file should be placed in (Regexp) followed by +# the new section name to be created if the Regexp does not match +# (Optional. If not given the .info will be appended to the directory) +SECTION_MATCH="[cC]ommands" +SECTION_NAME="General Commands" + +# The file referred to from the Info directory +FILE=barcode.info + +# Optional. The files to be copied to /usr/info +FILES=doc/*.info diff --git a/glabels2/barcode-0.98/debian/rules b/glabels2/barcode-0.98/debian/rules new file mode 100755 index 0000000..c48c5a1 --- /dev/null +++ b/glabels2/barcode-0.98/debian/rules @@ -0,0 +1,50 @@ +#!/usr/bin/make -f +# Made with the aid of debmake, by Christoph Lameter, +# based on the sample debian/rules file for GNU hello by Ian Jackson. + +package=barcode + +build: + $(checkdir) + ./configure --prefix=/usr + $(MAKE) CFLAGS="-O2 -g -Wall" + touch build + +clean: + $(checkdir) + -rm -f build + -$(MAKE) distclean + -rm -f `find . -name "*~"` + -rm -rf debian/tmp debian/files* core debian/substvars + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + -rm -rf debian/tmp + install -d debian/tmp + cd debian/tmp && install -d `cat ../dirs` + $(MAKE) install prefix=`pwd`/debian/tmp/usr +# Must have debmake installed for this to work. Otherwise please copy +# /usr/bin/debstd into the debian directory and change debstd to debian/debstd + debstd ChangeLog README TODO INSTALL + dpkg-gencontrol + chown -R root.root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + +define checkdir + test -f debian/rules +endef + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot diff --git a/glabels2/barcode-0.98/doc/Makefile.in b/glabels2/barcode-0.98/doc/Makefile.in new file mode 100644 index 0000000..dae8f6b --- /dev/null +++ b/glabels2/barcode-0.98/doc/Makefile.in @@ -0,0 +1,135 @@ +# +# Makefile (now .in) for the documentation directory +# +# Copyright 1994,2000 rubini@gnu.org (Alessandro Rubini) +# +################# +# +# BE CAREFUL in editing: +# due to the large number of index files, and my use of a non standard +# info input file, any file $(TARGET).* is removed by "make clean" +# +# I chose to use a prefix for the input file ("doc.$(TARGET)"), to ease +# makeing clean and applying my own rules. +# +################################################################### +# +# First of all, retrieve features of makeinfo, to know if we can do images +# and --html. Also, allow MAKEINFO to be specified on the commandline to +# allow me testing with various versions. + +# NOTE: it looks like semi-old versions can do images too, so CANDOIMAGES +# is not (yet?) used + + +MAKEINFO = @MAKEINFO@ +# According to whether this makeinfo can output html, autoconf define these +REMOVEHTMLTAGS = @REMOVEHTMLTAGS@ +INFOTOHTML = @INFOTOHTML@ + +############################################## + + +TARGET = barcode +ALL = $(TARGET).ps $(TARGET).info $(TARGET)doc.txt $(TARGET).html \ + $(TARGET).pdf + +all: $(ALL) terse + +info: $(TARGET).info + +$(TARGET)doc.txt: mktxt + +mpage: all + mv $(TARGET).ps $(TARGET)1.ps + mpage -2A $(TARGET)1.ps > $(TARGET)2.ps && rm $(TARGET)1.ps + +terse: + # preserve the pdf copy + -mv -f $(TARGET).pdf PDF 2> /dev/null && \ + rm -f *~ *.dvi *.log *.aux \ + $(TARGET).*.bak $(TARGET).??? $(TARGET).texinfo && \ + mv PDF $(TARGET).pdf; + + # preserve the ps copy + -mv $(TARGET).ps PS; + -rm -f $(TARGET).??; + -mv PS $(TARGET).ps; + +clean: terse + rm -f $(ALL) $(TARGET)_toc.html + + +#################################################### + +# These rules used to be expressed as "%.texinfo: doc.%" etc. However, this +# is gmake-specific, so I turned every % to $(TARGET), thus loosing generality +# but gaining portability. I also had to drop "$^": it worked with gmake +# and not pmake, while "$<" worked with pmake and not gmake. +# with gmake and not pmake. +# ARub 2000-04-21 + +$(TARGET).texinfo: doc.$(TARGET) + @rm -f $@ 2> /dev/null + sed -f ./infofilter doc.$(TARGET) | $(REMOVEHTMLTAGS) > $@ + chmod 400 $@ + + +# This rule is somewhat a rewrite of texi2dvi. I like make more than sh :-) +# This had to be rewritten too, as "$*" is different in gmake and pmake + +$(TARGET).dvi: $(TARGET).texinfo + +# create a spurious index file to please silly sh (bash will work anyway) + touch $(TARGET).oo + +# get the index list + if test "x`ls $(TARGET).?? $(TARGET).aux`" != "x"; then \ + for i in `ls $(TARGET).?? $(TARGET).aux`; do \ + cp $$i $$i~; \ + done; \ + fi + tex $(TARGET).texinfo + +#check the file list, the file and if needed run TeX again + old="`ls $(TARGET).??~ $(TARGET).aux~ | sed 's/~//g'`"; \ + new="`ls $(TARGET).?? $(TARGET).aux`"; \ + need="n"; \ + if test "$$old" != "$$new"; then need="y"; \ + else \ + for i in `ls $(TARGET).?? $(TARGET).aux`; do \ + cmp -s $$i $$i~; if test $$? -ne 0; then need="y" break; fi; \ + done; \ + fi; \ + if test "$$need" = "y"; then \ + texindex $(TARGET).?? && tex $(TARGET).texinfo; \ + fi + + +$(TARGET).ps: $(TARGET).dvi + dvips -f $(TARGET).dvi > $@ + +$(TARGET).pdf: $(TARGET).ps + ps2pdf $(TARGET).ps > $@ + +$(TARGET).lj: $(TARGET).dvi + dvilj -e- $(TARGET).dvi > $@ + +$(TARGET).info: $(TARGET).texinfo + makeinfo $(TARGET).texinfo -o $@ + +$(TARGET).html: $(TARGET).texinfo + $(INFOTOHTML) -o $@ $< + +#$(TARGET).man: doc.$(TARGET) +# manpages are created by the toplevel Makefile + +$(TARGET)doc.txt: $(TARGET).info + awk -f ./mktxt $(TARGET).info > $@ + + + + + + + diff --git a/glabels2/barcode-0.98/doc/README b/glabels2/barcode-0.98/doc/README new file mode 100644 index 0000000..5af5490 --- /dev/null +++ b/glabels2/barcode-0.98/doc/README @@ -0,0 +1,5 @@ + +The input file is "doc.barcode". I preprocess this file to +build both a "barcode.texinfo" file and manual pages. + +The intermediat diff --git a/glabels2/barcode-0.98/doc/barcode.info b/glabels2/barcode-0.98/doc/barcode.info new file mode 100644 index 0000000..693ca79 --- /dev/null +++ b/glabels2/barcode-0.98/doc/barcode.info @@ -0,0 +1,747 @@ +This is barcode.info, produced by makeinfo version 4.0 from +barcode.texinfo. + + This file is the User's Manual for the barcode library (version +0.98). + + +File: barcode.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) + +Barcode tools +************* + + This file documents version 0.98 of the barcode library and sample +programs (March 2002). + +* Menu: + +* Overview:: +* The Barcode Object:: +* Supported Flags:: +* The API:: +* The barcode Executable:: +* Supported Encodings:: +* PCL Output:: +* Bugs and Pending Issues:: + + +File: barcode.info, Node: Overview, Next: The Barcode Object, Prev: Top, Up: Top + +Overview +******** + + The "barcode" package is mainly a C library for creating bar-code +output files. It also includes a command line front-end and (in a +foreseeable future) a graphic frontend. + + The package is designed as a library because we think the main use +for barcode-generation tools is inside more featured applications. The +library addresses bar code printing as two distinct problems: creation +of bar information and actual conversion to an output format. To this +aim we use an intermediate representation for bar codes, which is +currently documented in the `ps.c' source file (not in this document). + + Note that the library and the accompanying material is released +according to the GPL license, not the LGPL one. A copy of the GPL is +included in the distribution tarball. + + +File: barcode.info, Node: The Barcode Object, Next: Supported Flags, Prev: Overview, Up: Top + +The Underlying Data Structure +***************************** + + Every barcode-related function acts on a data structure defined in +the `barcode.h' header, which must be included by any C source file +that uses the library. The header is installed by make install. + + The definition of the data structure is included here for reference: + + struct Barcode_Item { + int flags; /* type of encoding and other flags */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text placement */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ + }; + + The exact meaning of each field and the various flags implemented are +described in the following sections. + + Even though you won't usually need to act on the contents of this +structure, some of the functions in the library receive arguments that +are directly related to one or more of these fields. + +* Menu: + +* The Field List:: +* The Intermediate Representation:: + + +File: barcode.info, Node: The Field List, Next: The Intermediate Representation, Prev: The Barcode Object, Up: The Barcode Object + +The Fields +========== + +`int flags;' + The flags are, as you may suspect, meant to specify the exact + behaviour of the library. They are often passed as an argument to + barcode functions and are discussed in the next section. + +`char *ascii;' +`char *partial;' +`char *textinfo;' +`char *encoding;' + These fields are internally managed by the library, and you are + not expected to touch them if you use the provided API. All of + them are allocated with malloc. + +`int width;' +`int height;' + They specify the width and height of the active barcode region + (i.e., excluding the white margin), in the units used to create + output data (for postscript they are points, 1/72th of an inch, + 0.352 mm). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. If either value or + both are left to their default value of zero, the output engine + will assign default values according to the specified scaling + factor. If the specified width is bigger than needed (according to + the scaling factor), the output barcode will be centered in its + requested region. If either the width of the height are too small + for the specified scale factor, the output bar code will expand + symmetrically around the requested region. + +`int xoff;' +`int yoff;' + The fields specify offset from the coordinate origin of the output + engine (for postscript, position 0,0 is the lower left corner of + the page). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. The offset specifies + where the white margin begins, not where the first bar will be + printed. To print real ink to the specified position you should + set margin to 0. + +`int margin;' + The white margin that will be left around the printed area of the + bar code. The same margin is applied to all sides of the printed + area. The default value for the margin is defined in `barcode.h' + as BARCODE_DEFAULT_MARGIN (10). + +`double scalef;' + The enlarge or shrink value for the bar code over its default + dimension. The width and scalef fields interact deeply in the + creation of the output, and a complete description of the issues + appears later in this section. + +`int error;' + The field is used when a barcode function fails to host an + errno-like integer value. + +Use of the width and scalef fields. +----------------------------------- + + A width unit is the width of the thinnest bar and/or space in the +chosen code; it defaults to 1 point if the output is postscript or +encapsulated postscript. + + Either or both the code width and the scale factor can be left +unspecified (i.e., zero). The library deals with defaults in the +following way: + +Both unspecified + If both the width and the scale factor are unspecified, the scale + factor will default to 1.0 and the width is calculated according + to the actual width of the bar code being printed. + +Width unspecified + If the width is not specified, it is calculated according to the + values of scalef. + +Scale factor unspecified + If the scale factor is not specified, it will be chosen so that + the generated bar code exactly fits the specified width. + +Both specified + The code will be printed inside the specified region according to + the specified scale factor. It will be aligned to the left. If, + however, the chosen width is too small for the specific bar code + and scaling factor, then the code will extend symmetrically to the + left and to the right of the chosen region. + + +File: barcode.info, Node: The Intermediate Representation, Prev: The Field List, Up: The Barcode Object + +The Intermediate Representation +=============================== + + The encoding functions print their output into the partial and +texinfo fields of the barcode data structure. Those fields, together +with position information, are then used to generate actual output. +This is an informal description of the intermediate format. + + The first char in partial tells how much extra space to add to the +left of the bars. For EAN-13, it is used to leave space to print the +first digit, other codes may have '0' for no-extra-space-needed. + + The next characters are alternating bars and spaces, as multiples of +the base dimension which is 1 unless the code is rescaled. Rescaling is +calculated as the ratio from the requested width and the calculated +width. Digits represent bar/space dimensions. Lower-case letters +represent those bars that should extend lower than the others: 'a' is +equivalent to '1', 'b' is '2' and so on up to 'i' which is equivalent to +'9'. Other letters will be used for encoding-specific meanings, as soon +as I implement them. + + The textinfo string is made up of fields %lf:%lf:%c separated by +blank space. The first integer is the x position of the character, the +second is the font size (before rescaling) and the char item is the +character to be printed. + + Both the partial and textinfo strings may include "-" or "+" as +special characters (in textinfo the char should be a stand-alone word). +They state where the text should be printed: below the bars ("-", +default) or above the bars. This is used, for example, to print the +add-5 and add-2 codes to the right of UPC or EAN codes (the add-5 +extension is mostly used in ISBN codes). + + +File: barcode.info, Node: Supported Flags, Next: The API, Prev: The Barcode Object, Up: Top + +The Flags +********* + + The following flags are supported by version 0.98 of the library: + +`BARCODE_ENCODING_MASK' + The mask is used to extract the encoding-type identifier from the + flags field. + +`BARCODE_EAN' +`BARCODE_UPC' +`BARCODE_ISBN' +`BARCODE_128B' +`BARCODE_128C' +`BARCODE_128' +`BARCODE_128RAW' +`BARCODE_39' +`BARCODE_I25' +`BARCODE_CBR' +`BARCODE_MSI' +`BARCODE_PLS' +`BARCODE_93' + The currently supported encoding types: EAN (13 digits, 8 digits, + 13 + 2 add-on and 13 + 5 add-on), UPC (UPC-A, UPC-E, UPC-A with 2 + or 5 digit add-on), ISBN (with or without the 5-digit add-on), + CODE128-B (the whole set of printable ASCII characters), CODE128-C + (two digits encoded by each barcode symbol), CODE128 (all ASCII + values), a "raw-input" pseudo-code that generates CODE128 output, + CODE39 (alphanumeric), "interleaved 2 of 5" (numeric), Codabar + (numeric plus a few symbols), MSI (numeric) and Plessey (hex + digits). *Note Supported Encodings::. + +`BARCODE_ANY' + This special encoding type (represented by a value of zero, so it + will be the default) tells the encoding procedure to look for the + first encoding type that can deal with a textual string. + Therefore, a 11-digit code will be printed as UPC (as well as + 6-digit, 11+2 and 11+5), a 12-digit (or 7-digit, or 12+2 or 12+5) + as EAN13, an ISBN code (with or without hyphens, with or without + add-5) will be encoded in its EAN13 representation, an even number + of digits is encoded using CODE128C and a generic string is + encoded using CODE128B. Since code-39 offers a much larger + representation for the same text string, code128-b is preferred + over code39 for alphanumeric strings. + +`BARCODE_NO_ASCII' + Instructs the engine not to print the ascii string on output. By + default the bar code is accompanied with an ascii version of the + text it encodes. + +`BARCODE_NO_CHECKSUM' + Instructs the engine not to add the checksum character to the + output. Not all the encoding types can drop the checksum; those + where the checksum is mandatory (like EAN and UPC) just ignore the + flag. + +`BARCODE_OUTPUT_MASK' + The mask is used to extract the output-type identifier from the + flags field. + +`BARCODE_OUT_PS' +`BARCODE_OUT_EPS' +`BARCODE_OUT_PCL' +`BARCODE_OUT_PCL_III' + The currently supported encoding types: full-page postscript and + encapsulated postscript; PCL (print command language, for HP + printers) and PCL-III (same as PCL, but uses a font not available + on older printers). + +`BARCODE_OUT_NOHEADERS' + The flag instructs the printing engine not to print the header and + footer part of the file. This makes sense for the postscript + engine but might not make sense for other engines; such other + engines will silently ignore the flag just like the PCL back-end + does. + + +File: barcode.info, Node: The API, Next: The barcode Executable, Prev: Supported Flags, Up: Top + +Functions Exported by the Library +********************************* + + The functions included in the barcode library are declared in the +header file barcode.h. They perform the following tasks: + +`struct Barcode_Item *Barcode_Create(char *text);' + The function creates a new barcode object to deal with a specified + text string. It returns NULL in case of failure and a pointer to + a barcode data structure in case of success. + +`int Barcode_Delete(struct Barcode_Item *bc);' + Destroy a barcode object. Always returns 0 (success) + +`int Barcode_Encode(struct Barcode_Item *bc, int flags);' + Encode the text included in the bc object. Valid flags are the + encoding type (other flags are ignored) and BARCODE_NO_CHECKSUM + (other flags are silently ignored); if the flag argument is zero, + bc->flags will apply. The function returns 0 on success and -1 in + case of error. After successful termination the data structure + will host the description of the bar code and its textual + representation, after a failure the error field will include the + reason of the failure. + +`int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags);' + Print the bar code described by bc to the specified file. Valid + flags are the output type, BARCODE_NO_ASCII and + BARCODE_OUT_NOHEADERS, other flags are ignored. If any of these + flags is zero, it will be inherited from bc->flags which therefore + takes precedence. The function returns 0 on success and -1 in case + of error (with bc->error set accordingly). In case of success, the + bar code is printed to the specified file, which won't be closed + after use. + +`int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, int xoff, int yoff, double scalef);' + The function is a shortcut to assign values to the data structure. + +`int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags);' + The function deals with the whole life of the barcode object by + calling the other functions; it uses all the specified flags. + +`int Barcode_Version(char *versionname);' + Returns the current version as an integer number of the form major + * 10000 + minor * 100 + release. Therefore, version 1.03.5 will be + returned as 10305 and version 0.53 as 5300. If the argument is + non-null, it will be used to return the version number as a + string. Note that the same information is available from two + preprocessor macros: BARCODE_VERSION (the string) and + BARCODE_VERSION_INT (the integer number). + + +File: barcode.info, Node: The barcode Executable, Next: Supported Encodings, Prev: The API, Up: Top + +The barcode frontend program +**************************** + + The barcode program is a front-end to access some features of the +library from the command line. It is able to read user supplied +strings from the command line or a data file (standard input by default) +and encode all of them. + +* Menu: + +* The Command Line:: + + +File: barcode.info, Node: The Command Line, Prev: The barcode Executable, Up: The barcode Executable + +The Command Line +================ + + barcode accepts the following options: + +`--help or -h' + Print a usage summary and exit. + +`-i filename' + Identify a file where strings to be encoded are read from. If + missing (and if -b is not used) it defaults to standard input. + Each data line of the input file will be used to create one + barcode output. + +`-o filename' + Output file. It defaults to standard output. + +`-b string' + Specify a single "barcode" string to be encoded. The option can + be used multiple times in order to encode multiple strings (this + will result in multi-page postscript output or a table of barcodes + if -t is specified). The strings must match the encoding chosen; + if it doesn't match the program will print a warning to stderr and + generate "blank" output (although not zero-length). Please note + that a string including spaces or other special characters must be + properly quoted. + +`-e encoding' + encoding is the name of the chosen encoding format being used. It + defaults to the value of the environment variable BARCODE_ENCODING + or to auto detection if the environment is also unset. + +`-g geometry' + The geometry argument is of the form "[<width> x <height>] [+ + <xmargin> + <ymargin>]" (with no intervening spaces). Unspecified + margin values will result in no margin; unspecified size results + in default size. The specified values represent print points by + default, and can be inches, millimeters or other units according + to the -u option or the BARCODE_UNIT environment variable. The + argument is used to place the printout code on the page. Note that + an additional white margin of 10 points is added to the printout. + If the option is unspecified, BARCODE_GEOMETRY is looked up in the + environment, if missing a default size and no margin (but the + default 10 points) are used. + +`-t table-geometry' + Used to print several barcodes to a single page, this option is + meant to be used to print stickers. The argument is of the form + "<columns> x <lines> [+ <leftmargin> + <bottommargin> [- + <rightmargin> [- <topmargin>]]]" (with no intervening spaces); if + missing, the top and right margin will default to be the same as + the bottom and left margin. The margins are specified in print + points or in the chosen unit (see -u below). If the option is not + specified, BARCODE_TABLE is looked up in the environment, + otherwise no table is printed and each barcode will get its own + page. The size (but not the position) of a barcode item within a + table can also be selected using -g (see "geometry" above), + without struggling with external and internal margins. I still + think management of geometries in a table is suboptimal, but I + can't make it better without introducing incompatibilities. + +`-m margin(s)' + Specifies an internal margin for each sticker in the table. The + argument is of the form "<xmargin>,<ymargin>" and the margin is + applied symmetrically to the sticker. If unspecified, the + environment variable BARCODE_MARGIN is used or a default internal + margin of 10 points is used. + +`-n' + "Numeric" output: don't print the ASCII form of the code, only the + bars. + +`-c' + No checksum character (for encodings that allow it, like code 39, + other codes, like UPC or EAN, ignore this option). + +`-E' + Encapsulated postscript (default is normal postscript). When the + output is generated as EPS only one barcode is encoded. + +`-P' + PCL output. Please note that the Y direction goes from top to + bottom for PCL, and the origin for an image is the top-left corner + instead of the bottom-left + +`-p pagesize' + Specify a non-default page size. The page size can be specified in + millimeters, inches or plain numbers (for example: "210x297mm", + "8.5x11in", "595x842"). A page specification as numbers will be + interpreted according to the current unit specification (see -u + below). If libpaper is available, you can also specify the page + size with its name, like "A3" or "letter" (libpaper is a standard + component of Debian GNU/Linux, but may be missing elsewhere). The + default page size is your system-wide default if libpaper is + there, A4 otherwise. + +`-u unit' + Choose the unit used in size specifications. Accepted values are + "mm", "cm", "in" and "pt". By default, the program will check + BARCODE_UNIT in the environment, and assume points otherwise (this + behaviour is compatible with 0.92 and previous versions. If -u + appears more than once, each instance will modified the behaviour + for the arguments at its right, as the command line is processes + left to right. The program internally works with points, and any + size is approximated to the nearest multiple of one point. The -u + option affect -g (geometry), -t (table) and -p (page size). + + +File: barcode.info, Node: Supported Encodings, Next: PCL Output, Prev: The barcode Executable, Up: Top + +Supported Encodings +******************* + + The program encodes text strings passed either on the command line +(with -b) or retrieved from standard input. The text representation is +interpreted according to the following rules. When auto-detection of +the encoding is enabled (i.e, no explicit encoding type is specified), +the encoding types are scanned to find one that can digest the text +string. The following list of supported types is sorted in the same +order the library uses when auto-detecting a suitable encoding for a +string. + +EAN + The EAN frontend is similar to UPC; it accepts strings of digits, + 12 or 7 characters long. Strings of 13 or 8 characters are + accepted if the provided checksum digit is correct. I expect most + users to feed input without a checksum, though. The add-2 and + add-5 extension are accepted for both the EAN-13 and the EAN-8 + encodings. The following are example of valid input strings: + "123456789012" (EAN-13), "1234567890128" (EAN-13 wih checksum), + "1234567" (EAN-8), "12345670 12345" (EAN-8 with checksum and + add-5), "123456789012 12" (EAN-13 with add-2), "123456789012 + 12345" (EAN-13 with add-5). + +UPC + The UPC frontend accepts only strings made up of digits (and, if a + supplemental encoding is used, a blank to separate it). It + accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8 digits + (UPC-E). + + The 12th digit of UPC-A is the checksum and is added by the + library if not specified in the input; if it is specified, it must + be the right checksum or the code is rejected as invalid. For + UPC-E, 6 digit are considered to be the middle part of the code, a + leading 0 is assumed and the checksum is added; 7 digits are + either considered the initial part (leading digit 0 or 1, checksum + missing) or the final part (checksum specified, leading 0 + assumed); 8 digits are considered to be the complete code, with + leading 0 or 1 and checksum. For both UPC-A and UPC-E, a trailing + string of 2 digits or 5 digits is accepted as well. Therefore, the + following are examples of valid strings that can be encoded as UPC: + "01234567890" (UPC-A) "012345678905" (UPC-A with checksum), + "012345" (UPC-E), "01234567890 12" (UPC-A, add-2) and "01234567890 + 12345" (UPC-A, add-5), "0123456 12" (UPC-E, add-2). Please note + that when setting BARCODE_ANY to auto-detect the encoding to be + used, 12-digit strings and 7-digit strings will always be + identified as EAN. This because I expect most user to provide + input without a checksum. If you need to specify UPC-with-checksum + as input you must explicitly set BARCODE_UPC as a flag or use -e + upc on the command line. + +ISBN + 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". + +CODE 128-B + This encoding can represent all of the printing ASCII characters, + from the space (32) to DEL (127). The checksum digit is mandatory + in this encoding. + +CODE 128-C + 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). + +CODE 128 RAW + 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. + +CODE 39 + 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). + +INTERLEAVED 2 OF 5 + 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). + +CODE 128 + 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. + +CODABAR + 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. + +PLESSEY + 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. + +MSI + 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. + +CODE 93 + The 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. + + +File: barcode.info, Node: PCL Output, Next: Bugs and Pending Issues, Prev: Supported Encodings, Up: Top + +PCL Output +********** + + While the default output is Postscript (possibly EPS), and Postscript +can be post-processed to almost anything, it is sometimes desirable to +create output directly usable by the specific printer at hand. PCL is +currently supported as an output format for this reason. Please note +that the Y coordinate for PCL goes from top to bottom, while for +Postscript it goes from bottom to top. Consistently, while in +Postscript you specify the bottom-left corner as origin, for PCL you +specify the top-left corner. + + Barcode output for PCL Printers (HP LaserJet and compatibles), was +developed using PCL5 Reference manuals from HP. that really refers to +these printers: + * LaserJet III, III P, III D, III Si, + + * LaserJet 4 family + + * LaserJet 5 family + + * LaserJet 6 family + + * Color LaserJet + + * DeskJet 1200 and 1600. + + + However, barcode printing uses a very small subset of PCL, probably +also LaserJet II should print it without problem, but the resulting +text may be horrible. + + The only real difference from one printer to another really depends +on which font are available in the printer, used in printing the label +associated to the bars (if requested). + + Earlier LaserJet supports only bitmaps fonts, so these are not +"scalable". (Ljet II ?), Also these fonts, when available, have a +specified direction, and not all of them are available in both Portrait +and Landscape mode. + + From LaserJet 4 series, (except 4L/5L that are entry-level printers), +Arial scalable font should be available, so it's the "default font" +used by this program. + + LaserJet III series printers (and 4L, 5L), don't feature "Arial" as a +resident font, so you should use BARCODE_OUT_PCL_III instead of +BARCODE_OUT_PCL., and font the font used will be "Univers" instead of +"Arial". + + Results on compatible printers, may depend on consistency of PCL5 +compatibility, in doubt, try BARCODE_OUT_PCL_III + + PJL commands are not used here, as it's not very compatible. + + Tested Printers: + * Hp LaserJet 4050 + + * Hp LaserJet 2100 + + * Epson N-1200 emul PCL + + * Toshiba DP2570 (copier) + PCL option + + * Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is + bad. + + +File: barcode.info, Node: Bugs and Pending Issues, Prev: PCL Output, Up: Top + +Bugs and Pending Issues. +************************ + + The current management of borders/margins is far from optimal. The +"default" margin applied by the library interferes with the external +representation, but I feel it is mandatory to avoid creating barcode +output with no surrounding white space (the problem is especially +relevant for EPS output). + + EAN-128 is not (yet) supported. I plan to implement it pretty soon +and then bless the package as version 1.0. + + + +Tag Table: +Node: Top153 +Node: Overview525 +Node: The Barcode Object1403 +Node: The Field List2820 +Node: The Intermediate Representation6585 +Node: Supported Flags8358 +Node: The API11342 +Node: The barcode Executable14028 +Node: The Command Line14457 +Node: Supported Encodings19556 +Node: PCL Output28996 +Node: Bugs and Pending Issues31315 + +End Tag Table diff --git a/glabels2/barcode-0.98/doc/barcode.pdf b/glabels2/barcode-0.98/doc/barcode.pdf Binary files differnew file mode 100644 index 0000000..d7f66cb --- /dev/null +++ b/glabels2/barcode-0.98/doc/barcode.pdf diff --git a/glabels2/barcode-0.98/doc/barcode.ps b/glabels2/barcode-0.98/doc/barcode.ps new file mode 100644 index 0000000..6e2db98 --- /dev/null +++ b/glabels2/barcode-0.98/doc/barcode.ps @@ -0,0 +1,2378 @@ +%!PS-Adobe-2.0 +%%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software +%%Title: barcode.dvi +%%Pages: 12 +%%PageOrder: Ascend +%%BoundingBox: 0 0 596 842 +%%EndComments +%DVIPSWebPage: (www.radicaleye.com) +%DVIPSCommandLine: dvips -f barcode.dvi +%DVIPSParameters: dpi=600, compressed +%DVIPSSource: TeX output 2002.03.01:2356 +%%BeginProcSet: texc.pro +%! +/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S +N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 +mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 +0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ +landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize +mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ +matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round +exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ +statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] +N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin +/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array +/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 +array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N +df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A +definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get +}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} +B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr +1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 +1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx +0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx +sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ +rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp +gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B +/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ +/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ +A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy +get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} +ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp +fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 +{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add +chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ +1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} +forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn +/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put +}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ +bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A +mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ +SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ +userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X +1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 +index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N +/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ +/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) +(LaserWriter 16/600)]{A length product length le{A length product exch 0 +exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse +end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask +grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} +imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round +exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto +fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p +delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} +B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ +p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S +rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end + +%%EndProcSet +TeXDict begin 39158280 55380996 1000 600 600 (barcode.dvi) +@start +%DVIPSBitmapFont: Fa cmbxti10 14.4 8 +/Fa 8 115 df<13FCEA03FF000F13804813C05AA25AA2B5FCA31480A214006C5A6C5A6C +5AEA0FE0121271912B>46 D<ED3FF8913801FFFE020F9038FF83F0023FECC7F891B6EAEF +FC499038F83FFF0107D9E0077F49EB800349496C5B495A49487F495AA248495D5A48495B +A2485F5C485DA248495DA25E5A91C75CA25EB5FC495EA25EA24993C7FCA24CEB01F81803 +17FE5B167FF007F017FCA2007F03FFEB0FE05D6D5B003F4A9038F81FC0001F021F13FC6C +6C017FEC3F809027FF81FFDFEB7F006C90B5388FFFFE0001ECFE076CDAF8035B013FD9E0 +0013F0010390C7EA3FC03D3773B547>97 D<EC7FF048B5FC5AA45DEA00035BA25DA25BA2 +5DA25BA292C9FCA25BA25CA2137FA25CA213FFED1FFC4AB57E02FB14E04890B612F88392 +38F83FFE9238C00FFF48DA000713805C02F86D13C05C484915E0A25CA24817F0A25CA248 +5DA291C7FCA2484B13E0A25BA25E007F17C05BA25E18805B00FF17005E5FA26C484A5AA2 +4B5B5F5D5F6C6C495B4B5B001F93C7FC6DEB3FFE6C6C495A3A07FF83FFF06C90B55A6C15 +806C6C49C8FC011F13F801031380345473D240>I<923807FF80037F13F00203B512FC02 +0F80023F8091B500031380499038F8007F010701E0EBFFC049EB800149495A49485B495A +49485B5A485BA248491580180048496D5A486F5A93C8FC485BA35A91CAFCA3B5FC5BA45B +A65B17036C6CED0780170FEF3FC0003F167F6DEC01FF001F4B13806C6C021F13006C6DEB +7FFC6C9039F00FFFF86C90B612E06C5E013F4AC7FC010F14F0010049C8FC323773B540> +I<F00FFEEF3FFF5FA419FCEF007F18FFA219F8A25FA219F0A25FA219E0A25FA219C0A25F +A21980A25FED3FF8912601FFFE1400020FEBFF9F023F91B5FC91B8FC49D9F83F5B0107EB +E00749EB800349497E49485D49487F495AA248495D5A48495BA2485F5C485DA248495DA2 +5E5A91C75CA25EB5FC495EA25EA24993C7FCA24CEB01F8180317FE5B167FF007F017FCA2 +007F03FFEB0FE05D6D5B003F4A9038F81FC0001F021F13FC6C6C017FEC3F809027FF81FF +DFEB7F006C90B5388FFFFE0001ECFE076CDAF8035B013FD9E00013F0010390C7EA3FC03F +5473D247>I<923807FF8092B512E0020714F8021F80027F80903A01FFFE03FF49D9F000 +13804901C0EB7FC0495B013F90C7123F495A495A5C5A485B4849147F18804816FF4A4913 +00485DEE0FFE4849EB7FFC923807FFF891B612E0485E94C7FC16F04BC8FCB5CAFC5BA45B +A7007F1603EF0780170F003FEE3FC0177F6C6CEC01FF4C13806C6C021F13006C01C0EB7F +FC6C9039F00FFFF86C90B612E06C6C5D6D4AC7FC010714F09026007FFEC8FC323773B540 +>I<923807FFC0037F13FC0203B6FC020F15C0023F8191B5000313F8499039F8007FFC01 +0701E0133F4901806D7E4990C76C7E49481680495A4948804818C0485BA2485BA248494A +13E05AA2485BA24D13C05A91C8FCA25FB517805BA25F19005B6017FF605E60495E5E6C6C +4A5B604C5B003F4B90C7FC6D4A5A001F4B5A6C6C4A5A6CD980035B6CD9F01F13C06C90B6 +5A6C4BC8FC013F14F0010F14C0010001F8C9FC3B3773B547>111 +D<D91FE0EB07FED97FFC90383FFFC0496C90B512F048D9FF83804802C780D807F19039CF +FC07FED80FE09039FFF001FFDCC000138048484A5A4C5A4848495B0181495B4B5BEA7F01 +5D5B00FE18004B5C715A496F5A0000705A4B90C8FCA25BA25DA25BA292CAFCA25BA25CA2 +137FA25CA213FFA25CA25AA25CA25AA25CA25C6C5B6C90CBFC137E393776B53C>114 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fb cmsy10 10.95 1 +/Fb 1 16 df<EB0FFCEB3FFF90B512C0000314F04880488048804880A2481580A3B712C0 +AA6C1580A36C1500A26C5C6C5C6C5C6C5CC614C0013F90C7FCEB0FFC22227BA72D>15 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fc cmb10 10.95 10 +/Fc 10 115 df<EB0FFE90387FFFC048B512F04814FC3907FC0FFE48486C7E6D6C7F486C +7E82A26E7FA36C5A6C5AEA01E0C8FC5C49B5FC131F90B6FC000313F84813C0481300EA1F +FC485A127F5B12FF5BA45CA26C6C5A16F83B3FF807BFFF80391FFC1F3F390FFFFE1F6C49 +7E0001EBF80326003FE0C8FC292B7EA92C>97 D<13FFB5FCA512077EAF4AB4FC020F13E0 +023F13F891B57E9138FE07FFDAF8011380DAE00013C05C4AEB7FE017F0A3EE3FF8A317FC +AC17F8A3EE7FF0A217E06E13FF17C06E481380DAF80313009138FE0FFE9039FC7FFFFC49 +6C13F0496C13C0C7D803FEC7FC2E407FBE33>I<EB03FF011F13E0017F13F890B57E48EB +83FE3903FE01FF00075B4848481380121F13F8123FA2127F496C13006E5AEC007800FF91 +C7FCAC127FA27F003FEC07C0A26C6C130F16806C6C131F000715006C6C137F6CEBC1FE6C +EBFFFC6D13F0011F5B010390C7FC222B7DA928>I<16FF92B5FCA5150781AFEB01FF011F +13E3017F13FB90B7FC4813C148EB003F48487F48487F001F805B123FA2485AA312FFAC12 +7FA36C7EA3001F5C6C6C5B00074A13806D4913FC2603FF83B5FCC690B6FC6D13F7011F13 +C7903A03FE07FC002E407DBE33>I<49B47E010F13F0013F7F90B512FE48EBC3FF480100 +13804848EB7FC04848133F001F15E05B003FEC1FF0A2485A150F16F8A212FFA290B6FCA4 +01F0C8FCA5127FA37F003F15F8A26C6C1301000F15F06D13036C6CEB07E06C9038800FC0 +6C9038F07F806C6CB512006D5B010F13F8010013C0252B7EA92A>I<D907FE13FC90393F +FFC3FE90B5EAF7FF4891B5128048130F3907FC03FE3A0FF801FF7F001FEDFF00496C13BE +1680003F81A7001F5DA26D5A000F92C7FC6C6C485A3903FF0FFCECFFF8485CD80F3F13C0 +D907FEC8FC90CAFC5AA27FA213E090B512F015FF6C15C0826C816C8182120F4881393FE0 +003FD87F80EB07FF150148C7FC81A56D5B007F5D6D13036C6C495AD81FF8EB1FF86CB4EB +FFF06C90B55A000115806C6C49C7FC010713E0293D7EA82D>103 +D<EA01F8487E487E487E481380A66C13006C5A6C5A6C5AC8FCA913FFB5FCA512077EB3AB +B512F8A515407EBF19>105 D<01FFEB7FE0B53801FFF802077F4A7F91381FC3FFDA3E03 +13800007137C6CEB780102F014C014E0A214C0A31480B3A4B5D8FE1F13FFA530297EA833 +>110 D<49B47E010F13F0013F13FC90B6FC48018113803A03FE007FC04848EB3FE0000F +15F049131F001F15F8A24848EB0FFCA2007F15FEA400FF15FFAB007F15FEA3003F15FC6D +131F001F15F8A26C6CEB3FF0000715E06C6CEB7FC03A01FF81FF806C90B51200013F13FC +010F13F001011380282B7EA92D>I<3901FE07F800FFEB0FFE91383FFF804A13C0EC7C7F +9138F8FFE03807FFF06C5B5CA2ED7FC09138803F80ED1F0092C7FCA291C8FCB3A3B6FCA5 +23297FA827>114 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fd cmbxti10 17.28 7 +/Fd 7 115 df<EEFFE0030F13FC037F01FF13FC4AB6EA83FE0207EDEFFF4AD9E07FB57E +023FEB000F4A487F4948487F4913F04981495B49496D91C7FC495B5B92C8FC90B55E485B +5F485B4860A248495CA248605C5F5A4A5EA2485EA24A5EA2B55DA24A5EA25FA291C85CA2 +4DEC3F801A7F19005B94B513FFA24E1400A24C5C007F614C13FC4C1403003F4B5D6D4A14 +076C4B5D6C6D49140F4BB55C6CD9C007013F495A6C9026F03FFEEBFE3FC690B5D8F81FB5 +5A6DDAF0075C011FDAC00349C7FC010749C75B9026007FF0EC1FF0494271C055>97 +D<EC1FFE90B6FC5A5AA46C5CC7FC5BA25DA25BA25DA25BA25DA25BA25DA25BA25DA25BA2 +5DA25BA2923800FFE0030F13FC90B5003F13FF92B612C084048113F8489139FC007FFC03 +F06D7E4B804B7F484A158092C77E4A16C05C485B19E05CA25AA25C5F5AA25CA2485EA25C +A2485EA291C814C0A2B592B5FCA2491780A25E19005B5E60A24C5BA2495E4C5BA24C5B60 +5E007F5F6D4A90C7FC4C5A003F5E6D495B001F4A5B6C6C495B6CD9801F13806C01E0B5C8 +FC6C90B512FC6C6C14F06D14C0010F49C9FC010013E03B6570E34C>I<EE1FFE0303B512 +E0031F14F8037F804AB7FC0207D9FC071380021FD9E00013C04A0180137FDAFFFEC7EAFF +E049495B4949130749494913F049495B495B49495B5B90B5C714E0A2485B4818C05C4870 +13804A91380FFE0048705AEF00E0484992C7FCA25A5CA25AA25CA2B5FCA25CA491CBFCA6 +5BA2F00380007FEF07C0F00FE06DEE1FF06C173F187F6C6DEDFFE0050313C06C6D020F13 +806C043F13006C6DECFFFE6C01F8010713F86C01FE90B55A6DB712C0011F93C7FC010715 +F801001580020F01F0C8FC3C4271C04C>I<963803FFC0061FB512E06060A47214C0F000 +1F61A21B80A261A21B00A296B5FCA262A260A262A260A262A260A262A260A2DCFFE05C03 +0F13FC037FEBFF1F4AB6129F020792B55A4AEBE07F023FEB000F4A487F4948486D5C4913 +F04981495B49496D91C7FC495B5B92C8FC90B55E485B5F485B4860A248495CA248605C5F +5A4A5EA2485EA24A5EA2B55DA24A5EA25FA291C85CA24DEC3F801A7F19005B94B513FFA2 +4E1400A24C5C007F614C13FC4C1403003F4B5D6D4A14076C4B5D6C6D49140F4BB55C6CD9 +C007013F495A6C9026F03FFEEBFE3FC690B5D8F81FB55A6DDAF0075C011FDAC00349C7FC +010749C75B9026007FF0EC1FF04B6571E355>I<EE1FFE0303B512C0031F14F092B612FC +020381020F9038FC07FF4AD9E0011380027F90C713C04A48EC7FE04913F8010749143F49 +5B5B495B495B92C8FC90B5FC485B48177F5C48EFFFC05F48494A13804D130048161F4AEC +7FFC933803FFF848033F5B4AB612C091B75A4804FCC7FC17E004FCC8FC03E0C9FC02C0CA +FCB5FC5CA591CBFCA67EF00380F007C0F00FE06CEF1FF0183F187F6C6DEDFFE06C040313 +C06E020F13806C6D023F13006C6DECFFFE6C6D010713F86C01FE90B55A013FB712C06D93 +C7FC010715F801001580020F01F0C8FC3C4271C04C>I<93381FFF804BB512F8031F14FF +037F15C04AB77E0207D9FC0313F8021FD9E0007F4A0180EB3FFEDAFFFEC76C7E49491680 +49496E13C0495B49496E13E0495B494916F05B90B5C87E1AF8485B485F5C5A5C5AA2485B +605A5CA2485FA24A17F0A2B55EA24A17E0A2601AC091C9FC95B51280A21A005F615F495F +4D5B127F6D4B5B616C4C5B4D5B6C6D4A90C7FC4D5A6C6D495B6C4B5B6C6D010F13E06C01 +F8013F5B6CD9FE01B5C8FC013FB612FC6D15F0010715C0010002FCC9FC020F13C0454271 +C055>111 D<D907FCEC0FFE90261FFF8090387FFFE049D9E001B512F890B5D8F00714FE +48DAFC0F802A03FE3FFE3FFC071380D9FC1F90267FE00013C0D807F890B50080EB7FE000 +0F93380001FF01F04A5B001F4B4913F001E04A5B003F4B5B13C04A495B007F5D018018E0 +5E00FF5B1AC0010091C76C13801A0091B5EC07FC48715AC74991C8FCA25BA25DA25BA25D +A25BA25DA25BA25DA25BA25DA25BA25DA25BA292CBFCA290B5FCA25CA25AA25CA26C5B5C +6D5AEB1F80444275C048>114 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fe cmbxti10 13.15 11 +/Fe 11 120 df<EDFFC0020713F0023FEBFC3E91B56CB4FC4901E0B512800107D9003F13 +C049487F49487F495A49486D1380495A485D4A15005A5A4A5B485E91C7FC5A163F5F485A +A2167F007F5E5BA216FF00FF5E5BA25DEFE01E49163FA24B147FEFC07EA3007F17FC5D4B +1380003F4AEB81F85D6C6C49EB83F06C6C48B513E02707FE0FFC13CF6CB539F07FFFC06C +4A6C13806C6CD9800F1300903A0FFC0003FC383375B141>97 D<ED3FF80203B5FC020F14 +80023F14C09139FFF81FE001039038C007F049010013F84948130F4948EB1FFC4948133F +4948137F495A48EDFFF8485BA2484914F048ED7FE0EE3FC04890C7EA1F8093C7FCA2485A +A3127F5BA312FF5BA45BA4007F166017F0EE01F8003F15036D1407001FED1FF0EE3FE06C +6CECFFC06C6C010713803B03FFC07FFE006C90B512F86C6C14E0011F91C7FC010313F02E +3375B13A>99 D<943801FF800403B512C05E1980A282EE000F1900A25FA260A2173FA260 +A2177FA260A217FFA260A25EEDFFC1020701F15B023F13FD91B7FC4913E00107D9003F5B +49487F49487F495A49486D5B495A485D5C4894C7FC5A4A5B5A91C75B5A163FA248485DA2 +167F127F495DA216FF12FF495DA25D181E49EDE03FA24B5C187E17C0A2007F5F5D4B1380 +003F4AEB81F85D6C6C49EB83F06C6C48B55B2707FE0FFC13CF6CB539F07FFFC06C4A6C5B +6C6CD9800F90C7FC903A0FFC0003FC3A4D75CB41>I<ED3FF80203B5FC021F1480027F14 +C0903A01FFF81FE0499038C00FF04990380007F8D91FFE1303495A494814FC494813014A +13034816F8485B5A4A130748ED0FF091C7EA1FE048153FEEFFC0480207138049017F1300 +90B612FC16F048158003F0C7FC01FCC9FCA3485AA55B127FA2176017F0EE01F86C6C1403 +1607001FED1FF06C6CEC3FE0EEFFC06CB4010713806C9039C07FFE00C690B512F86D14E0 +011F91C7FC010113F02E3375B13A>I<EF1FF0EFFFFE4CEBFF80040714C093390FFC3FE0 +EE1FF893393FF07FF0047F13FF17F1EEFFE1A24B01E313E0A205E113C04B01C1138005C0 +1300187E95C7FCA25D5FA45D94C8FCA349B712FC4982A36D5E90C7D81FFEC8FCA2153F5E +A4157F5EA515FF5EA45C5EA45C5EA55C5EA45C93C9FCA45C5DA45D143FA25DA2EA07E039 +1FF07FF0EA3FF8127F5D00FF13FF5D5DA201F190CAFCEBE1FE495A6C485A6CB45A6C5B00 +071380D801FECBFC3C6382CC2C>I<EC1FF890383FFFFC5B5DA27F13005DA25BA25DA25B +A25DA25BA25DA25BA292CAFCA25B4BB47EDAFE0F13F0033F13FC013F90B57E91B5EA07FF +DBF8037FDBE0017F4913C015004A81A2495A5C5CA2485D605CA2485D605CA2485D95C7FC +5C5E485EA291C7123F5F5A047FEB03C0499238F807E0A2003F03FF130F05F013C0495BEF +E01F007F1880183F4903C01300187E12FF60496DEBC1F893387FC7F0EFFFE049021F5B6C +486E90C7FC001FC8EA03FC3B4D78CB41>104 D<15F8EC03FC4A7E4A7EA25CA35DA25D6E +5AEC03E091C8FCAEEB07F8EB1FFEEB7FFF90B57E3901FC7FC0D803F07FEA07E0D80FC07F +A2381F80FFA2485A5B007E5CA25B00FE5C485A007C5C12005B92C7FCA25B5C133F5CA213 +7F5CA213FFECF00F48EC1F8014E0153F48150014C05D48147E14805D14816CEB01F84A5A +4A5A6CEB1FC06CEBFF806D90C7FC6D5AEB07F0214E78CC27>I<EC7FE090B512F05A15E0 +A27E130315C0A25BA21580A25BA21500A25BA25CA2133FA25CA2137FA25CA213FFA25CA2 +5AA25CA25AA25CA25AA25CA25AA291C7FCA25AA25BA2123FA25BA2127F140F9038F81F80 +A200FF133F150013F0A25C147E13E05CA2387FE1F8A2383FE3F06CB45A6C5B6C5BC648C7 +FC1C4D77CB20>108 D<913801FFC0021F13F8027F13FE91B6FC4901001380D903FCEB3F +C0D907F0130F010FEC3FE04948137F4A13FF133FA2017F4913C0A26F138017006E137E02 +FC90C7FCECFFC015FE6F7E16E06D80826D807F6D80010180EB003F1403EC003FD803C013 +0FD80FE01303EA3FF0486C7FA200FF5DA34B5A5B49495A495C49130F6CC7485AD83FC0EB +7FC03A1FF803FF806CB548C7FC6C14F8000114E026001FFEC8FC2B3377B135>115 +D<EC0FC04A7E4A7E147F14FFA35BA25DA25BA25DA25BA25DA25BA2003FB612C04815E0B7 +FCA26C15C026001FFEC7FC133FA25CA2137FA25CA213FFA25CA25AA25CA25AA25CA25AA2 +5CA25AED03C091380007E0A248140F16C049131F1680ED3F005D49137E5D4A5A000F495A +EC0FE00007EB3FC06CB55A6C91C7FC38007FFCEB1FE0234777C52A>I<D907F8EF1F80D9 +1FFEDA01F0EB3FC090267FFF80D903FCEB7FE090B56C0107ECFFF02701FC7FE0496C5A26 +03F83F021F15F8D807E06D5D000F017F143F01C016FCEA1F8085263F00FF027F7F4E137F +4848181F007E5C05FF140FD8FE034CEB07F000FC5C127CC6485C03804A14E0A25B4B4815 +0F494C14C05CA24C151F013F4C14805CA2F23F00017F5C4A92C7FC1A7EA21A7C1AFCA24F +5A62013F4A14034F5A6D6C5B4C6D485A6D6C90B56C485A902707FF83FCD9E07FC7FC6D90 +3AFFF87FFFFE01004A6C5B023FD9C00F13F00207D9000113C04D3378B154>119 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Ff cmbx12 13.14 13 +/Ff 13 117 df<923807FFE092B512FC020714FF021F81027F9038007FC0902601FFF0EB +0FE04901C0497E4990C7487ED90FFC147F011F824A14FF495AA2137F5CA2715A715A715A +EF078094C8FCA7EF07FCB9FCA526007FF0C7123F171FB3B3A2003FB5D8E00FB512F8A53D +4D7ECC44>12 D<EA07E0EA1FF8EA3FFCEA7FFEA2B5FCA6EA7FFEA2EA3FFCEA1FF8EA07E0 +1010778F22>46 D<B700F8023FB512F8A5D8001F01C0C9380FE000745AB3B3AD6D180F63 +811A1F6D96C7FC626D7F1A7E6D7F6D606E6C4B5A6E6CED07F06E6C4B5A6E01C0EC3FC06E +01F049B45A020101FF011F90C8FC6E91B55A033F15F8030715E0030092C9FC040713F055 +4C7CCA5E>85 D<ECFFFC010FEBFFC0017F14F090B612FC489038803FFE3B03FC0007FF80 +486C6D7F6D7F486D6C7F83167F83A2707E6C90C7FC6C5A6C5AC9FCA5ED1FFF021FB5FC49 +B6FC130F013FEBC03F9038FFFE00000313F04813C04890C7FC485A485AA2485AA2485AA4 +167FA26D14FF007F15EF6D01017F6C6C903907CFFF806C6CD90F8F13FE6C9038E07F076C +9038FFFE0300014A7ED8003F9038F0007F0103018090C7FC37347CB23C>97 +D<EF1FF0EE3FFFA51600177FB3EC0FFF91B512E0010314F8010F14FC013FEB01FF903A7F +F8003FFFD9FFE0130F48497F48497F4890C77E48815B121F5B123FA2127F5BA312FFAC12 +7FA36C7EA3121F6D5C120F6C6C5C6C6D5B6C5D6C01E0013F7F6D6C49EBFFE090393FFE03 +FE6DB512F801075C0100148091261FFC00EBC0003B4D7CCB44>100 +D<EC0FFF91B512F0010314FC010F14FF90263FFE077F90267FF0007F49486D7E4801806D +7E486F7E4890C7120F484881707E121F491403003F82A2127F5B701380A212FFA390B8FC +A401F8CAFCA5127FA27FA2123FA26C6CED0F80A26C6C151F6C17006E5C6C6D147E6C6D5C +6C6D495AD93FFCEB07F0903A1FFF803FE0010790B55A010192C7FC6D6C13FC020713C031 +347DB238>I<ED7FF0913807FFFC023F7F4A7F902601FFE0138049018113C049484813E0 +EB0FFCEB1FF8A2EB3FF0A2017F6D13C04A6C1380EE7F00163E93C7FCACB77EA526007FF0 +C8FCB3B3A3003FB512F8A52B4D7DCC26>I<EB7FC0B5FCA512037EB3923801FFC0030F13 +F8033F7F4B13FFDBFE077F9138C1F0039126C3E0017FDAC78080ECCF0014DE02DC6D7F14 +FC5CA25CA35CB3AAB6D8C07FEBFFE0A53B4C7BCB44>104 D<EB7FC0B5FCA512037EB3B3 +B3AAB61280A5194C7BCB22>108 D<903A7FC001FFC0B5010F13F8033F7F4B13FFDBFE07 +7F9138C1F00300039026C3E0017F6CD9C78080ECCF0014DE02DC6D7F14FC5CA25CA35CB3 +AAB6D8C07FEBFFE0A53B327BB144>110 D<913807FF80027F13F80103B6FC010F15C090 +261FFE017F903A7FF0003FF849486D7E480180EB07FE4890C76C7E4817804980000F17C0 +48486E13E0A2003F17F0A249157F007F17F8A400FF17FCAB007F17F8A46C6CEDFFF0A200 +1F17E0A26C6C4A13C0A26C6C4A13806C6D4913006C5E6C01E0EB1FFC6D6C495A903A3FFE +01FFF0010FB612C0010392C7FCD9007F13F80207138036347DB23D>I<903907FF807001 +7FEBF1F048B6FC1207380FFC01391FE0003F4848130F491307127F90C71203A2481401A2 +7FA27F01F090C7FC13FCEBFFC06C13FEECFFE06C14FC6C806CECFF806C15C06C15E06C15 +F06C7E011F14F8010114FCEB000FEC007FED1FFE0078140F00F8140715037E1501A27E16 +FC7E15036D14F86D13076D14F001F8EB1FE001FFEBFFC04890B51280486C1400D8F81F13 +FCD8E00313C027347CB230>115 D<14F8A51301A41303A21307A2130FA2131F133F137F +13FF1203000F90B512F0B7FCA426007FF8C7FCB3A7167CAA013F14F880A290391FFE01F0 +010F1303903907FF87E06DEBFFC06D14806D6C1300EC0FFC26467EC430>I +E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fg cmti10 10.95 35 +/Fg 35 122 df<933807FF80043F13E09338FE00F8DB01F0133EDB07E0130E4B48131F4C +137F031F14FF4BC7FCA218FE157E1878180015FE5DA31401A25DA414030103B712F0A218 +E0903A0003F000070207140F4B14C0A3171F020F15805DA2173F1800141F5D5F177EA214 +3F92C712FE5FA34A1301027EECF81CA3160302FEECF03C4A1538A21878187013014A0101 +13F018E0933800F1C0EF7F804948EC1F0094C7FCA35C1307A2001E5B127F130F00FF5BA2 +49CAFC12FEEAF81EEA703CEA7878EA1FF0EA07C0385383BF33>12 +D<EE07FC93393FFF87F09338FC07C7923A03F001E7E0DB07C013F792390F8007FF031F49 +13C016005DA2037E1580EF039FEF001F183F4B1500A3600201157E5DA218FE6014035D01 +03B7FC60A2903A0007F000014B130360A31707020F5D5DA2170F60141F5D171F60A2143F +92C7123F95C7FCA34A5C027EEC7E07A317FE02FE4A5A4A150EA2181E181C13014AEC7C3C +1838EF3C70EF1FE04948EC07C094C8FCA3495AA3001E5BEA7F0FA200FF5BA249CBFC12FE +EAF83EEA703CEA7878EA1FF0EA07C03C5383BF35>I<ED01801507ED0F00151C5D5D5D14 +014A5A4A5A4AC7FC141E143E5C14785C1301495AA2495A5C130F49C8FCA2133EA25BA213 +FC5B12015BA212035B1207A25B120FA25BA2121FA290C9FCA25AA2123EA2127EA2127CA6 +5AAB1278A67EA47EA2120E120F7EA26C7EA26C7E6C7E1360215A73C325>40 +D<14031580A2EC01C0EC00E0A21570A215781538153CA3151EA4151FA2150FA7151FA915 +3FA2153EA3157EA2157CA215FCA215F8A21401A215F0A2140315E0A2140715C0A2EC0F80 +A2141F15005C143EA25CA25CA2495A5C1303495A5C130F49C7FC131E5B137C5B5B485A48 +5A485A48C8FC121E5A12705A5A205A7FC325>I<387FFFFEA3B5FCA21705799521>45 +D<120FEA3FC0127FA212FFA31380EA7F00123C0A0A77891C>I<15031507150F151F151E +153E157EEC01FEEC03FC1407141FEB01FF90380FFBF8EB1FC3EB0E07130015F0A2140FA2 +15E0A2141FA215C0A2143FA21580A2147FA21500A25CA25CA21301A25CA21303A25CA213 +07A25CA2130FA25CA2131FA25CEB7FE0B612F0A215E0203D77BC2E>49 +D<15FE913803FFC091380F01F091383C00F84A137C4A7F4948133F49487F4A148049C7FC +5BEB0E0C011E15C0EB1C0EEB3C06133813781370020E133FD9F00C148013E0141C021813 +7F00011600EBC0384A13FEEC600102E05B3A00E3C003F89039FF0007F0013C495A90C748 +5A5E037FC7FC15FC4A5A4A5AEC0FC04AC8FC147E14F8EB03E0495A011FC9FC133E491418 +01F0143C48481438485A1678485A48C85A120E001E4A5AD83FE0130301FF495A397C3FF0 +1FD8780FB55AD8700391C7FCD8F0015B486C6C5A6E5AEC07C02A3F79BC2E>I<157F9138 +01FFE0913807C0F091381F007C023C133C4A133E4A131F1301495A5C1307A2495AA2163F +011F143EA2167E6E137C16F8ECE00102F013F09138F803E09138FC07C090390FFE0F00EC +FFBE6D13F86D5B7F6D7F8101037F90380F9FFFD91F0F1380D97C0713C0497E48486C13E0 +3903E0007F4848133F4848131F001F140F90C7FC003E1407A2127E127CA200FC15C05AA2 +ED0F80A2ED1F00153E007C143C157C007E5C6CEB03F0391F8007C0390FE03F802607FFFE +C7FC000113F838003FC0283F78BC2E>56 D<49B712C018F818FE903B0003FC0001FF9438 +007F804BEC3FC0A2F01FE014074B15F0180FA2140F5D181FA2021F16E05D183F19C0023F +ED7F804B14FF19004D5A027F4A5A92C7EA07F0EF1FE0EF7F804AD903FEC7FC92B512F017 +FE4AC7EA3F800101ED1FE04A6E7E17078401036F7E5CA30107825CA3010F5E4A1407A260 +011F150F5C4D5A60013F153F4A4A5A4D5A017F4A90C7FC4C5A91C7EA0FF849EC3FF0B812 +C094C8FC16F83C3E7BBD40>66 D<49B77E18F018FC903B0003FE0003FEEF00FF4BEC7F80 +F03FC00207151F19E05DA2020F16F0A25DA2141FF03FE05DA2023F16C0187F4B1580A202 +7FEDFF00604B495A4D5A02FF4A5A4D5A92C7EA3FC04CB4C7FC4990B512FC17E04ACAFCA2 +1303A25CA21307A25CA2130FA25CA2131FA25CA2133FA25CA2137FA25C497EB67EA33C3E +7BBD3E>80 D<92390FF001C0ED7FFE4AB5EA0380913907F80FC791390FC003EF91391F80 +01FF4AC71300027E805C495A4948143EA2495AA2010F153C5CA3011F1538A38094C7FC80 +A214FC6DB4FC15F015FE6DEBFFC06D14F06D14FC6D80143F020F7F020180EC001F150303 +007F167F163FA2161FA212075A5F120EA2001E153F94C7FCA2163E003E157E167C003F15 +FC4B5A486C5C4B5A6D495AD87DE0EB1F80D8F8F849C8FC017F13FE39F03FFFF8D8E00F13 +E048C690C9FC32427ABF33>83 D<277FFFFE01B500FC90B512E0B5FCA200039026800007 +90C7380FFC006C90C701FCEC07F049725A04035EA26350C7FCA20407150EA2040F5D1A3C +041F153862163B6216734F5A6D14E303014B5A6C15C303034BC8FC1683DB0703140E191E +030E151C61031C7F61ED380161157003F04A5A15E002014B5A15C0DA03804AC9FC60DA07 +00140E60140E605C029C5D14B8D97FF85D5C715A5C4A5DA24A92CAFC5F91C7FC705A137E +5F137C5F137801705D53406EBD5B>87 D<147E49B47E903907C1C38090391F80EFC09038 +3F00FF017E137F4914804848133F485AA248481400120F5B001F5C157E485AA215FE007F +5C90C7FCA21401485C5AA21403EDF0385AA21407EDE078020F1370127C021F13F0007E01 +3F13E0003E137FECF3E1261F01E313C03A0F8781E3803A03FF00FF00D800FC133E252977 +A72E>97 D<EB1FC0EA0FFF5CA2EA003FA291C7FCA25BA2137EA213FEA25BA21201A25BA2 +1203A25B147E3907F1FF809038F783E09038EF01F013FE390FF800F8A24913FC49137C48 +5A157E5B15FE123FA290C7FCA248130115FC127EA2140300FE14F85AA2EC07F0A215E048 +130F15C0141F15800078EB3F00127C147E003C5B383E01F8381E03E06C485A6CB4C7FCEA +01F81F4076BE2A>I<EC1FE0ECFFF8903803F03E903807C00F90381F8007D93F00138001 +7E131F49137F485A485A000715005B000F147E484890C7FCA2485AA3127F90C9FCA35A5A +A6481403007E5C5D151E003E5C5D6C5CEC03E0390F800F802603E07EC7FC3801FFF83800 +3FC0212977A72A>I<EE3F80ED1FFF1700A2ED007FA2167EA216FEA25EA21501A25EA215 +03A25EA21507A25E147E903801FF8F903807C1CF90391F80EFC090383F00FF017E137F5B +48486D5A485AA2485A000F92C7FC5B001F5CA24848137EA215FE127F90C75AA214015A48 +5CA2140316384814F0A21407167891380FE070127C021F13F0007E013F5B003E137FECF3 +E1261F01E35B3A0F8781E3802703FF00FFC7FCD800FC133E294077BE2E>I<EC3F809038 +01FFE0903807E0F890381F803CEB3E0001FC131E485A485A12074848133E49133C121F48 +48137C15F8EC03F0397F000FE0ECFF80B5EAFC0014C048C8FCA45AA61506150E151E007C +143C15786C14F0EC01E06CEB07C0390F801F003807C0FC3801FFF038007F801F2976A72A +>I<167C4BB4FC923807C78092380F83C0ED1F87161FED3F3FA2157EA21780EE0E004BC7 +FCA414015DA414035DA30103B512F8A390260007E0C7FCA3140F5DA5141F5DA4143F92C8 +FCA45C147EA414FE5CA413015CA4495AA4495AA4495A121E127F5C12FF49C9FCA2EAFE1E +EAF83C1270EA7878EA3FE0EA0F802A5383BF1C>I<EC03F0EC0FFC91383E0E1C9138FC07 +7E903901F003FE1303903807E001D90FC013FCEB1F80A2EB3F004914F8137E01FE1303A2 +484814F0A2150712034914E0A2150F12074914C0A2151FA216805B153F1203ED7F006D5B +A200015B0000495A9038F80F7E90387C1EFEEB1FF8903807E0FC90C7FC1401A25DA21403 +A25D001C1307007F5C48130F5D4A5A4AC7FC48137E00F85B387C03F0381FFFC0D803FEC8 +FC273B7CA72A>I<EB01FC13FF5CA21303A25CA21307A25CA2130FA25CA2131FA25CA213 +3FA291C8FCEC03F890387F0FFE91383E0F80D97E7813C0ECE007D9FFC013E014801400A2 +485A5BA25B0003140F16C05BA20007141F16805BA2000F143F16005B5D001F147EEDFE07 +4913FCA2003F0101130FEDF80E1300161E48ECF01CA2007E1538A200FE1570020013E048 +EC7FC00038EC1F0028407ABE2E>I<1478EB01FCA21303A314F8EB00E01400AD137C48B4 +FC38038F80EA0707000E13C0121E121CEA3C0F1238A2EA781F00701380A2EAF03F140012 +005B137E13FE5BA212015BA212035B1438120713E0000F1378EBC070A214F0EB80E0A2EB +81C01383148038078700EA03FEEA00F8163E79BC1C>I<EB07F0EA03FF14E0A2EA000FA2 +14C0A2131FA21480A2133FA21400A25BA2137EA213FEA25BA21201A25BA21203A25BA212 +07A25BA2120FA25BA2121FA25BA2123FA290C7FCA25A1307127EA2EAFE0F130E12FCA213 +1E131CA2EA7C381378EA3C70EA1FE0EA0780144079BE17>108 D<D801F0D93F80137F3D +07FC01FFE003FFC03D0F3E07C1F80F83F03D0E1F0F00FC1E01F8001E011C90387C380000 +1C49D97E707F003C01F05C0038157F4A5C26783FC05C12704A91C7FC91C7127E00F003FE +1301494A5CEA007EA20301140301FE5F495CA203031407000160495C180F03075D000305 +1F13E0494A1480A2030FEC3F810007F001C0495CA2031F91383E0380120F494AEC0700A2 +033F150E001FEF1E1C4991C7EA0FF80007C7000EEC03E0432979A74A>I<D801F0EB3F80 +3A07FC01FFE03A0F3E07C1F83A0E1F0F00FC001E011C137C001C49137E003C13F012385C +38783FC012705C91C7FC00F015FE495CEA007EA2150101FE5C5BA2150300015D5B15075E +0003020F13704914C0A2031F13F00007ED80E05B1681EE01C0120F49EC0380A2EE070000 +1FEC0F0E49EB07FC0007C7EA01F02C2979A733>I<EC1FC0ECFFF8903803F07C90380FC0 +1FEB1F8090393F000F80017E14C0491307484814E0485A12075B000F15F0485AA2485AA2 +ED0FE0127F90C7FCA2151F4815C05AA2ED3F80A2ED7F00A248147E007C5C007E13015D4A +5A003E495A6C495A4A5A260F803EC7FC3807C0FC3801FFF038003F80242977A72E>I<90 +3903E001F890390FF807FE903A1E7C1E0F80903A1C3E3C07C0013C137801389038E003E0 +EB783F017001C013F0ED80019038F07F0001E015F8147E1603000113FEA2C75AA2010114 +0717F05CA20103140F17E05CA20107EC1FC0A24A1480163F010F15005E167E5E131F4B5A +6E485A4B5A90393FB80F80DA9C1FC7FCEC0FFCEC03E049C9FCA2137EA213FEA25BA21201 +A25BA21203A2387FFFE0B5FCA22D3A80A72E>I<D801F013FC3A07FC07FF803A0F3E0F03 +C0260E1F1C13E0001EEB380F001C1370003CEBE01F123814C0D8783F14C0007090388007 +0092C7FC91C8FC12F05BEA007EA313FE5BA312015BA312035BA312075BA3120F5BA3121F +5B0007C9FC232979A726>114 D<EC7F80903801FFE0903807C0F890381F003C013E131C +013C131E017C133E49137E15FEA2000114FCA215706D13007FEBFFC014FC6C13FF15806D +13C06D13E0010F13F01300140F14071403120C123F387F80011403D8FF0013E0A300FCEB +07C000F0EB0F8012700078EB1F006C133C381F01F83807FFE0C690C7FC1F297AA725>I< +EB01C0EB03F01307A25CA2130FA25CA2131FA25CA2133FA291C7FCA2007FB51280B6FC15 +00D8007EC7FC13FEA25BA21201A25BA21203A25BA21207A25BA2120FA25BA2121F141C13 +80A2003F133C1438EB0078147014F05C495AEA1F03495A6C48C7FCEA07FCEA01F0193A78 +B81E>I<137C48B4141C26038F80137EEA0707000E7F001E15FE121CD83C0F5C12381501 +EA781F007001805BA2D8F03F1303140000005D5B017E1307A201FE5C5B150F1201495CA2 +151F0003EDC1C0491481A2153F1683EE0380A2ED7F07000102FF13005C01F8EBDF0F0000 +9038079F0E90397C0F0F1C90391FFC07F8903907F001F02A2979A731>I<017CEB01C048 +B4EB07F038038F80EA0707000E01C013F8121E001C1403EA3C0F0038EC01F0A2D8781F13 +0000705BA2EAF03F91C712E012005B017E130116C013FE5B1503000115805BA2ED070012 +03495B150EA25DA25D1578000114706D5B0000495A6D485AD97E0FC7FCEB1FFEEB03F025 +2979A72A>I<017C167048B491387001FC3A038F8001F8EA0707000E01C015FE001E1403 +001CEDF000EA3C0F0038177C1507D8781F4A133C00701380A2D8F03F130F020049133812 +005B017E011F14784C137013FE5B033F14F0000192C712E05BA2170100034A14C049137E +17031880A2EF070015FE170E00010101141E01F86D131C0000D9039F5BD9FC076D5A903A +3E0F07C1E0903A1FFC03FFC0902703F0007FC7FC372979A73C>I<903903F001F890390F +FC07FE90393C1E0E0F9026780F1C138001F0EBB83FD801E013F89039C007F07FEA038000 +0714E0D9000F140048151C000E4AC7FCA2001E131FA2C75BA2143F92C8FCA35C147EA314 +FE4A131CA30101143C001E1538003F491378D87F811470018314F000FF5D9039077801C0 +39FE0F7C033A7C0E3C078027783C1E1EC7FC391FF80FFC3907E003F029297CA72A>I<13 +7C48B4143826038F8013FCEA0707000E7F001E1401001C15F8EA3C0F12381503D8781F14 +F000701380A2D8F03F1307020013E012005B017E130F16C013FE5B151F1201491480A215 +3F000315005BA25D157EA315FE5D00011301EBF8030000130790387C1FF8EB3FF9EB07E1 +EB00035DA21407000E5CEA3F80007F495AA24A5AD8FF0090C7FC143E007C137E00705B38 +7801F0383803E0381E0FC06CB4C8FCEA03F8263B79A72C>I E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fh cmsl10 10.95 33 +/Fh 33 122 df<007FB5FCA2B512FEA418067C961E>45 D<157015F014011407143F9038 +03FFE0137FEBFFCFEBF80F1300141F15C0A5143F1580A5147F1500A55C5CA513015CA513 +035CA513075CA5130F5CA3131F497EB612F8A31D3D78BC2D>49 D<EC01FE91380FFFE002 +3F13F89138FC07FC903901E001FE903907C000FF49C7EA7F80011E15C0163F4915E05B01 +70141F13FF80A35A163FA26C90C7FC137E0118EC7FC090C8FCEEFF80A24B1300A24B5A5E +4B5A4B5A4B5A5E4B5A4BC7FC15FEEC01F84A5A4A5A4A5A4AC8FC143E5C5CEB01E0494813 +0E49485B49C7FC131E495C13705B48485C484814F0000FB6FC5A485D5AB7FC5EA22B3D7C +BC2D>I<EC07FC91383FFF809138F80FE0903903C007F09039078003FC90380F0001011C +14FE013C14FF137F1480EBFFC0A31480A291380003FE137E90C7FCED07FC16F8150F16F0 +ED1FE016C0ED3F80ED7E005DEC07F0903803FF8015F090380001FC6E7EED7F80ED3FC0A2 +ED1FE016F0A316F8A4120EEA3F80486C133F16F012FFA216E0157F5B48C7EAFFC000F015 +80007049130012786C495A003EEB07F86C495A390FE03FE00003B51280C649C7FCEB1FE0 +283F7ABC2D>I<01061403D90780131F90390FF801FE91B512FC16F816F016E0168049EB +FE0015F890381C7FC091C8FCA3133C1338A513781370A2EC1FE0ECFFF8903873E03E9038 +FF001F01FCEB0F804914C049EB07E04914F049130390C7FC16F8A61507A21206EA3F8048 +7EA2150F00FF15F0A24914E090C7121F00FC15C000F0143F00701580ED7F0012786C14FE +4A5A6C495A390F800FE03907E03FC06CB5C7FCC613FCEB1FE0283F7ABC2D>53 +D<EC03FC91381FFF8091387C07E0903901F001F0903903C000F84948137C49C7123E131E +013E141F133C137C137813F8A3163F486C143E167E6D147C6C6C14FC6E13F89138C001F0 +9138F003E090397FF807C09138FC0F0090383FFF3E6D13F86D13E06D7F01017F8101077F +90391F1FFF80D93E0F13C0EBF8072601F00113E048486C13F04848137F4848131F001FEC +0FF890C71207003E1403A2481401A300FC15F05AA3ED03E0A26CEC07C0007C1580007E14 +0F003EEC1F00003F143E6C6C5B6C6C485A3907F00FE00001B512806C6C48C7FCEB0FF028 +3F7ABC2D>56 D<EC07F8EC3FFE9138FC0F80903901F007C0903907E003E0D90FC013F090 +381F8001013F14F8EB7F004914FC48481300A24848EB01FEA21207A3485AA41503121F5B +A31507A2000F15FC150FA2151F1207153F000315F86C6C137F000014EF90387C01CF9039 +3E078FF090380FFE1FEB03F890C713E0A2ED3FC0A3ED7F8016005D003F5C487E4A5A00FF +495A5D4A5A49485A48495A007049C7FC0078137E383E03FC381FFFF06C13C0D801FEC8FC +273F79BC2D>I<17E016011603831607A2160FA2161F83163FA2167F167716F7EEE7FCED +01E316C3150316831507EE03FEED0F01150E151E151C153C03387FED7800157015F05D4A +4880177F4A5AA24AC7FCA2020E81173F5C021FB6FC5CA20270C7EA3FE0171F5CA2495AA2 +494881170F49C8FCA2130EA24982013C1507A2137CD801FE4B7E2607FF80EC3FFEB500F0 +0107B512FC19F85E3E417DC044>65 D<013FB7FC18E018FC903B007FE00007FE6E489038 +01FF809438007FC05DF03FE0F01FF0A3027F16F892C8FCA54A16F04A153F19E0187F19C0 +F0FF8001014B13004A4A5A4D5AEF1FF04D5ADC03FFC7FC49B612F8EFFF8002F8C7EA3FE0 +EF0FF0EF07FC717E010715014A81711380A319C0130F5CA5011F4B13805C19005F601707 +013F4B5A4A4A5A4D5A4D5A017F913801FF8001FF020F90C7FCB812FC17F094C8FC3D3E7D +BD40>I<DCFFC01338030F01F01378037F01FC13F0913A01FF803F01913A07FC000781DA +1FE0EB03C3DA7FC0EB01E74AC812FF4948ED7FE0D907FC153F495A4948151F495A494815 +0F494816C018074890C9FC485AA2485A000F1880491603121FA248481607A295C7FC485A +A412FF5BA75BA2181C183C1838A27F007F1778187018F0003F5F6D150160001F16036C6C +4B5A95C7FC6C6C5D6C6C151E6C6C5D6C6C15F86D6C495A6D6CEB07C0D91FF0EB1F80D907 +FE01FEC8FC0101B512F86D6C13E0DA07FEC9FC3D4276BF42>I<013FB812F8A39026007F +F0C7127F6E48140F18034B14011800A31978147F4B1570A502FF143892C7FCA319001778 +4915704A14F016011603160F91B6FC495DA29138FC001F16071603160101075D5CA21970 +19F019E0010F4A5A4A90C7120119C0A218031980011F16075CF00F00A260181E013F163E +4A157E4D5A1703017F150F01FFEDFFF8B9FCA2603D3E7DBD3E>69 +D<011FB512FC5BA29039003FF8006E5AA25DA5143F5DA5147F5DA514FF92C7FCA55B5CA5 +13035CA513075CA5130F5CA5131F5CA3133F497E007FB512F0A2B6FC263E7EBD21>73 +D<90263FFFF0933807FFFE5013FC629026007FF8EFFC00023F4D5AA2023BEF77F0A2DA39 +FC16E7A2F101CF0279EE038FDA70FE5FF1070FA2190E1A1FDAF07F151C02E06019381970 +6F7EF1E03F130102C0DB01C05BA26F6CEB0380A2953807007F0103160E4A6C6C93C7FC60 +A2606201076D6C5B02005F60A26F6C485A94380380015B010EDB07005BA2923801FC0EA2 +4D1303131E011C6D6C485C5FA25F1907013CEC7FC0013860013C5D137C01FE6EC7120F26 +07FF80013E4A7EB500FC031FB512F8043C5E4A131C573E7DBD53>77 +D<90263FFFE0023FB5FC6F16FEA29026003FF8020313C0021F030013004A6C157C023B16 +3C6F15381439810238167802787FDA707F157082153F82031F15F002F07FDAE00F5D8215 +078203031401010180DAC0015D82811780047F1303010315C04A013F5C17E0161F17F004 +0F1307010715F891C7000791C7FC17FC160317FE04015B4915FF010E6E130E188E177F18 +CEEF3FDE011E16FE011C6F5AA2170FA21707133C01386F5A133C017C150113FE2607FF80 +1400B512FC18705C483E7DBD44>I<013FB612FEEFFFE018F8903B007FF0000FFC6E48EB +01FF7113804BEC7FC0183F19E0F01FF0A2147F5D19F8A402FFED3FF092C8FCA219E0A2F0 +7FC05B4AEDFF8019004D5A4D5AEF0FF80103ED3FE04A903801FF8091B648C7FC17F002FC +CAFCA213075CA5130F5CA5131F5CA5133F5CA3137F497EB612E0A25D3D3E7DBD3E>80 +D<9239FF8003800207EBF007021F9038FC0F0091387F00FE02FCEB1F1FD903F0EB07BF49 +486DB4FC49487F4A6D5A49C8FC49157E133E137E173E49153CA57F1738A26D92C7FC8080 +80EB7FFEECFFE06D13FEEDFFC06D14F06D14FC010380010080143F020380DA003F7F1503 +1500707E163F161FA2160F121CA31607160F003C5EA35F003E151F94C7FC007E5D007F15 +3E6D5C16FC01E0495AD87DF0495AD8FCFCEB0FC03AF87F803F8027F01FFFFEC8FCD8E007 +13F839C0007FC031427BBF33>83 D<B600E090B512FC4B15F8A2000101C0C7000F13006C +49EC03FCEF01F091C9FC60A317015A495EA417031203495EA4170712074993C7FCA45F12 +0F49150EA4171E121F49151CA4173C123F491538A31778177017F05F001F15015F16036D +4A5A000F93C8FC5E6C6C141E6C6C5C000115F86C6C495A017FEB07C090393FC03F809026 +0FFFFEC9FC010313F89038007FC03E4073BD44>85 D<EC7FC0903803FFF890380FC07E90 +383E003F496D7E01FF6D7E82A248140782A26C5A137890C7120FA25EA2EC03FF147F9038 +07FF1FEB1FE0D97F805B3801FE00EA03F8485A4848133F485A003F5D49EC81C048C7FCA2 +157F48ED03804814FFA2007F5B913903BF0700903880073F3A3FC00E1F8E260FE03C13FC +3A03FFF00FF83A007FC003E02A2A7CA82D>97 D<EB3F80EA1FFFA3C6FC137FA291C9FCA5 +5B5BA512015BA4EC07F80003EB3FFF9039F8F80FC09039FBE003E09039FF8001F891C77E +5B4848147E49147F5B821780A2120F5B17C0A3167F001F16805BA4EEFF00123F5B4B5AA2 +4B5A5E007F4A5AA24B5A6D495A4BC7FCD87CE0137E39F87001F839F03C07E039E00FFF80 +260003FCC8FC2A4077BE33>I<EC1FF0ECFFFE903903F01F8090390FC003C0D93F0013E0 +017E130F49131F000115F04848EB3FE0485AA24848EB1FC0001FEC0F004990C7FC123FA2 +485AA412FF90C9FCA96CEC0380150716006C6C5B151E001F5C6C6C5B6C6C5B6C6C485A39 +01F80F8026007FFEC7FCEB0FF0242A7AA828>I<EE03F8ED01FFA3ED000F1607A217F0A4 +160FA217E0A4161FA217C0A491380FF03FECFFFC902603F81F138090390FC007BF90391F +8003FF90387E0001497F0001157F48481500485A120F5B001F5D485A5E5B127FA2150112 +FF90C75BA41503A25EA37E1507A26C4A5A7F001F141F6C6C133F6C6CEBFFF83B03F001EF +FFC03900F80F8F90383FFE0FD90FF0EBE0002D407ABE33>I<EC3FE0903801FFF8903807 +E07E90380F801F90393F000F80017E14C049EB07E0485A12034848EB03F0485AA2121F5B +123FA248481307A290B6FCA2D8FF80C8FC90C9FCA87EED01C015036C15806D1307001FEC +0F006D131E000F5C6C6C5B6C6C485A3900FC07C0D93FFFC7FCEB07F8242A7BA828>I<ED +07F0ED3FFCEDFC1E913803F03F4A48B4FC4A481380141FEC3F81DA7F0113008102FE137C +93C7FCA213015CA513035CA50007B512F8A3260007F0C8FCA3130F5CA5131F5CA5133F5C +A5137F91C9FCA55B5BA4EA03FF007F13FEB5FCA229407DBF1C>I<1478EB01FE130314FF +A25B14FE130314FCEB00F01400ACEB03F8EA01FF14F0A2EA001F130FA314E0A5131F14C0 +A5133F1480A5137F1400A55B5BA4EA03FF007F13F0A2B5FC183E7DBD1A>105 +D<143FEB1FFF5BA213017FA214FEA5130114FCA5130314F8A5130714F0A5130F14E0A513 +1F14C0A5133F1480A5137F1400A55B5BA4EA03FF007F13F8A2B5FC183F7DBE1A>108 +D<903907F007F8D803FFEB1FFF9139E0781FC09138E1E00F3B001FE38007E090380FE700 +02EE14F014FC14D814F85CA24A130F131F4A14E0A4161F133F4A14C0A4163F137F91C713 +80A4167F5B491500A300015D486C491380B5D8F87F13FCA32E287DA733>110 +D<EC0FF0ECFFFE903903F01F8090390FC007C049C66C7E013E6D7E01FC6D7E4848804914 +7C0003157E485A000F157F5B121FA2485AA2007F1680A2170048C85AA54B5AA25E5A6C4A +5A7E4B5A5E6C140F6C6C5C4B5A6C6C013EC7FC6C6C5B6C6C485A3900FC0FE090383FFF80 +D90FF8C8FC292A7BA82D>I<903907F01F80D803FFEB7FE09138E1E1F09138E387F83900 +1FE707EB0FE614EE02FC13F002D813E09138F801804AC7FCA25C131FA25CA4133F5CA513 +7F91C8FCA55B5BA31201487EB512FEA325287EA724>114 D<9138FF81C0010713E39038 +1F807F90397C003F8049131F4848130F5B00031407A248481400A27FA27F6D90C7FCEBFF +8014FC6C13FF6C14C015F06C6C7F011F7F13079038007FFE1403140100381300157EA212 +3C153E157E007C147CA2007E147815F8007F495A4A5A486C485A26F9E01FC7FC38E0FFFC +38C01FE0222A7DA824>I<EB0380A4130791C7FCA25BA25BA2133EA2137E13FE12011207 +001FB512C0B6FCA2D801FCC7FCA312035BA512075BA5120F5BA41407001F130E13C0A414 +1E141C1380A26D5AA2000F5B14F03807E1E03801FF80D8007EC7FC1A3978B723>I<B539 +E007FFF05D17E02707FE000313006C48EB01FC6F5A5E00014A5A5EA24B5A6D1307000092 +C7FC5D150E6D5B7F5DA25D1480013F5B14815D14C3011F5B02C7C8FCA214CE14EEEB0FFC +A25CA26D5A5CA25CA26D5A2C2878A630>118 D<B500C3B53803FFFCA204FE14F8290FFE +003FE00013C0D807F86D48EB7F000003173E183C150F18386D5E0001141F705B153F4D5A +15776D4B5A0000ECE7F04DC7FCEC01C3170E9038FF0383017F5D91380703F85FEC0E0102 +1E5CD93F9C14F002BC6D5A02B813FDDAF8005B4A13FF5F6D5A94C8FC5C4A137E167C6DC7 +FC1678010E14383E2878A642>I<90B539E007FFF05E18E0902707FE000313006D48EB01 +FC705A5F01014A5A5F16036E5C0100140794C7FC160E805E805E1678ED8070023F13F05E +ED81C015C191381FC38015C793C8FC15EF15EEEC0FFCA25DA26E5AA25DA26E5A5DA24AC9 +FC5C140E141E141C5C121C003F5B5A485B495A130300FE5B4848CAFCEA701EEA783CEA3F +F0EA0FC0343A80A630>121 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fi cmbx12 17.28 43 +/Fi 43 122 df<EA01FCEA07FF4813804813C04813E04813F0A2B512F8A76C13F0A26C13 +E06C13C06C13806C1300EA01FC151574942D>46 D<16F04B7E1507151F153FEC01FF1407 +147F010FB5FCB7FCA41487EBF007C7FCB3B3B3B3007FB91280A6395E74DD51>49 +D<913801FFF8021FEBFFC091B612F8010315FF010F16C0013F8290267FFC0114F89027FF +E0003F7F4890C7000F7F48486E7FD807F86E148048486E14C048486E14E048486F13F001 +FC17F8486C816D17FC6E80B56C16FE8380A219FFA283A36C5BA26C5B6C90C8FCD807FC5D +EA01F0CA14FEA34D13FCA219F85F19F04D13E0A294B512C019804C14004C5B604C5B4C5B +604C13804C90C7FC4C5A4C5A4B13F05F4B13804B90C8FC4B5AED1FF84B5A4B5A4B48143F +4A5B4A48C8FC4A5A4A48157E4A5A4A5AEC7F8092C9FC02FE16FE495A495A4948ED01FCD9 +0FC0150749B8FC5B5B90B9FC5A4818F85A5A5A5A5ABAFCA219F0A4405E78DD51>I<92B5 +FC020F14F8023F14FF49B712C04916F0010FD9C01F13FC90271FFC00077FD93FE001017F +49486D8049C86C7F484883486C6F7F14C0486D826E806E82487FA4805CA36C5E4A5E6C5B +6C5B6C495E011FC85A90C95CA294B55A614C91C7FC604C5B4C5B4C5B4C5B047F13809226 +0FFFFEC8FC020FB512F817E094C9FC17F817FF91C7003F13E0040713F8040113FE707F71 +7F7113E085717FA2717F85A285831A80A31AC0EA03FCEA0FFF487F487F487FA2B57EA31A +80A34D14005C7E4A5E5F6C495E49C8485BD81FF85F000F5ED807FE92B55A6C6C6C491480 +6C01F0010791C7FC6C9026FF803F5B6D90B65A011F16F0010716C001014BC8FCD9001F14 +F0020149C9FC426079DD51>I<F01F804E7E187F18FFA25F5F5F5FA25F5F5FA294B5FC5E +5E5EA25E5EEE3FBFEE7F3FA216FEED01FCED03F8ED07F0A2ED0FE0ED1FC0ED3F8016005D +15FE4A5A4A5AA24A5A4A5A4A5A4A5AA24AC7FC14FE495A5C1303495A495A495A5C133F49 +C8FC13FE485AA2485A485A485A5B121F485A48C9FC12FEBCFCA6CA6CEBC000B1037FB8FC +A6485E7CDD51>I<01C0EE01C0D801F8160F01FF167F02F0EC07FFDAFF8090B5FC92B712 +8019006060606060606095C7FC17FC5F17E0178004FCC8FC16E09026FC3FFCC9FC91CBFC +ADED3FFE0203B512F0020F14FE023F6E7E91B712E001FDD9E00F7F9027FFFE00037F02F8 +01007F02E06EB4FC02806E138091C8FC496F13C04917E07113F0EA00F090C914F8A219FC +83A219FEA419FFA3EA03F0EA0FFC487E487E487FA2B57EA319FEA35C4D13FC6C90C8FC5B +4917F8EA3FF001804B13F06D17E0001F5E6C6C17C06D4B1380D807FC92B512006C6C4A5B +6C6C6C01075B6C01E0011F5BD97FFE90B55A6DB712C0010F93C7FC6D15FC010115F0D900 +3F1480020301F0C8FC406078DD51>I<EE1FFF0303B512E0031F14F892B612FE0203814A +D9FC037F021F9039C0007FC04A90C7EA1FE0DAFFFC6E7E494914074949EC7FF8494914FF +49495B4949497F4990C7FC495D5C13FF485BA25A4A6E5B5A715B48496E5B725A4894C8FC +A35AA35C48913801FFE0030F13FE033F6D7E4B14E092B612F89126E1FE037FB53AE3F000 +7FFEDAE7E06D7EDAEFC06D7F4B6D7F02FFC76C7F4A82717F4A82A2854A8085A24A1780A5 +4A17C0A37EA77EA47E6E1780A27EA21A007E4D5B7E6E5E7E6E5E6C4C5B6D7E013F4B5B6D +6C4A5B6D01C0495B6D6D90B5C7FC6DD9FC0713FC6D90B65A6D5E023F15C0020F92C8FC02 +0114F8DA001F1380426079DD51>I<EA07E0120F7F13FCEBFFFC91B912F8A45AA21AF01A +E01AC01A801A00A248606161616101E0C9123F01804C5A48CA485A4D90C7FC60007E4C5A +17074D5A4D5A4D5A485F4D5A17FF4C90C8FCC9485A5F4C5A160F4C5A5F163F4C5A16FF5F +5D94C9FC5D5D5E150FA24B5AA2153FA24B5AA215FFA34A5BA25CA35CA44A5BA45CA65CAD +6E5BA26E5BDA03FECAFC6E5A456377E051>I<92383FFF800203B512FC021FECFF80027F +15E049B712F849D9F0077F010F90C76C7ED91FFCEC1FFFD93FF06E7F494802037F494882 +717F484980854890C9127FA24884183FA25A80A380806E157F6E5E14FE6E7E6F4A5A6C14 +F003FC495B03FF495B6C1580DCE0075B6CDBF80F90C7FC9338FE1FFE6C9238FF7FF84D5A +6D16C06D5E6D4BC8FC6D6F7E6D16E00101826D16FC023F814A8149B87E01078349839026 +3FFE3F8190267FFC0F819026FFF003814849C6FC48496D804849131F4890C70007801601 +48486E1580003F163F49150F007F7014C0491501717E8400FF835B8484A384A21A80A27F +007F1900607F003F606D160F001F606D4C5A6C6D153F6C6D4B5A6C01F04B5A6C01FC0203 +5B6C01FF021F5B6D9027F001FFFEC7FC6D90B65A010F16F001035E010093C8FC020F14F8 +DA007F90C9FC426079DD51>I<BB12F0F2FF801BF81BFEF3FFC088D800010280C7000114 +F8DF003F7F080F13FF74807480867480757FA2757FA28987A289A965A26365A2515BA298 +B55A505C505C5091C7FC505B505B087F13F00703B512C096B6C8FC93B812F81BC01BF8F3 +FF801CE00480C8001F13F8080713FE08016D7E7480757F757F757F89757F89871E80871E +C0A41EE087A663A21EC0A3631E80A2511400A2515B515B6398B55A505C08075C081F5C97 +B6C7FCBD5A1CF81CE099C8FC1BF898C9FC63627AE173>66 D<4DB5ED03C0057F02F01407 +0407B600FE140F047FDBFFC0131F4BB800F0133F030F05FC137F033F9127F8007FFE13FF +92B6C73807FF814A02F0020113C3020702C09138007FE74A91C9001FB5FC023F01FC1607 +4A01F08291B54882490280824991CB7E49498449498449498449865D49498490B5FC484A +84A2484A84A24891CD127FA25A4A1A3F5AA348491A1FA44899C7FCA25CA3B5FCB07EA380 +A27EA2F50FC0A26C7FA37E6E1A1F6C1D80A26C801D3F6C6E1A00A26C6E616D1BFE6D7F6F +4E5A7F6D6D4E5A6D6D4E5A6D6D4E5A6D6E171F6D02E04D5A6E6DEFFF806E01FC4C90C7FC +020F01FFEE07FE6E02C0ED1FF8020102F8ED7FF06E02FF913803FFE0033F02F8013F1380 +030F91B648C8FC030117F86F6C16E004071680DC007F02F8C9FC050191CAFC626677E375 +>I<BB12E0F2FF801BF01BFE757E1CF0D800010280C7000780DF007F13FE080F6D7E0801 +807480093F7F090F13FC757F757F877580767F8A88767F8A888AA2767FA28A881F80A376 +14C0A41FE0A5881FF0B05214E0A51FC0A4521480A31F006466A2525BA2525BA2525B6664 +99B55A515C5191C7FC515B515B515B097F5B50B512C008075C083F91C8FC0707B512FCBD +12F01CC051C9FC1BF81B8008E0CAFC6C627AE17C>I<BD12FCA488A2D8000102C0C71201 +F1000F1A01F2007F1B3F1B0F1B07757EA28787A288A3F43F80A31C1FA3197EA3F40FC0A4 +99C7FC19FEA31801A218031807181F18FF93B6FCA6EEC000181F180718031801A21800A2 +1D7E197EA21DFCA696C812011DF8A31C03A3F407F0A31C0FA21C1F1C3F1DE01C7F1CFF63 +631B0F093F13C098B5FC1A0797B6FCBEFCA31D80A35F617AE06A>I<BD12E0A41CF0A2D8 +000102C0C71207F1003F1A0F1A031A001B7F1B3FF31FF81B0FA21B07A21B03A21B011CFC +A31B00A419FCA21C7EA41C00A21801A31803A21807180F183FEF01FF93B6FCA6EEC001EF +003F180F18071803A21801A31800A896C9FCB3A5B912F8A657617AE065>I<B912E0A6C7 +02E0C7FCB3B3B3B3AEB912E0A633627CE13C>73 D<B912F8A6D8000102C0CBFCB3B3B1F3 +07E0A5F30FC0A61B1FA31B3F1C80A21B7FA21BFFA262A262625013006262624FB5FC1907 +191F4EB6FCBDFC63A553627AE161>76 D<94381FFFE00407B67E043F15F04BB712FE030F +EEFFC0033FD9FC0014F092B500C0010F13FC020349C7000113FF4A01F86E6C7F021F496F +13E04A01C0030F7F4A496F7F91B5C96C7F0103497013FF494970804B834949717F498749 +49717F49874B8390B586484A717FA24891CB6C7FA2481D804A84481DC0A348497214E0A3 +481DF0A34A85481DF8A5B51CFCB06C1DF8A36E96B5FCA36C1DF0A46C6D4E14E0A36C1DC0 +6E606C1D80A26C6E4D1400A26C6E4D5BA26C6E4D5BA26D6D4D5B6D636D6D4D5B6F94B5FC +6D636D6D4C5C6D6D4C91C7FC6D6E4B5B6D02E0031F5B023F6D4B13F06E01FC92B55A6E01 +FF02035C020302C0010F91C8FC020002FC90B512FC033F90B712F0030F17C0030394C9FC +DB007F15F804071580DC001F01E0CAFC666677E379>79 D<BB7E1AFCF2FFC01BF81BFE75 +7ED800010280C7001F80070114F0736C7F081F7F747F747F7414807414C0A27414E0A21D +F0A27513F8A41DFCA91DF8A498B512F0A21DE0A25014C01D8062501400505B505B087F5B +4FB512E0071F5C93B9C7FC1BFC1BF01B8008F0C8FC04C0CCFCB3B3A2B97EA65E627AE16E +>I<DBFFFCEC01E0020FD9FFE01303027F02FC130749B7130F0107EEC01F011F16F049D9 +C007EBF83F4948C7383FFE7FD9FFF8020FB5FC4801E014014849804849153F91C97E4848 +82001F834982003F83845B007F187FA2193FA200FF181FA27F190FA27FA26D1707808080 +6C01F893C7FC80ECFF8015F86CECFFC016FC6CEDFFE017FE6CEEFFE018F86C17FE6C717E +6C846C846D17F86D836D836D8313036D18806D6C17C0020F17E01401DA000F16F0150004 +0715F8EE007F1703050014FC183F84060713FE84A2007C8300FC83A2197FA3193F7EA31A +FC7EA27F1AF86D177F7F1AF06D17FF6D18E06D5E01FF18C06E4B138002E04B130002F84B +5A02FFED3FFC01CF01E0ECFFF8018301FF010F5B010191B65A6D6C5E48011F93C7FC4801 +0315FC48D9003F14E048020149C8FC476677E35A>83 D<001FBEFCA64849C79126E0000F +148002E0180091C8171F498601F81A0349864986A2491B7FA2491B3F007F1DC090C9181F +A4007E1C0FA600FE1DE0481C07A5CA95C7FCB3B3B3A3021FBAFCA663617AE070>I<B96C +023FB612FEA6D8000102C0CA0007EBF000E2007FC7FCB3B3B3AA656D63A2821C01806570 +170380525A6E7F6E4F5A70171F6E626E6D4D5A6E6D177F525A6E6E030390C8FC033F01E0 +4B5A6F6DED1FFC6F01FCED7FF80303D9FF80903803FFE06F02F8017F5B6F6C90B7C9FC04 +1F5E040716F8040016C0050F4ACAFCDD003F13C06F647AE17C>I<913803FFFE027FEBFF +F00103B612FE010F6F7E4916E090273FFE001F7FD97FE001077FD9FFF801017F486D6D7F +717E486D6E7F85717FA2717FA36C496E7FA26C5B6D5AEB1FC090C9FCA74BB6FC157F0207 +B7FC147F49B61207010F14C0013FEBFE004913F048B512C04891C7FC485B4813F85A5C48 +5B5A5CA2B55AA45FA25F806C5E806C047D7F6EEB01F96C6DD903F1EBFF806C01FED90FE1 +14FF6C9027FFC07FC01580000191B5487E6C6C4B7E011F02FC130F010302F001011400D9 +001F90CBFC49437CC14E>97 D<903807FF80B6FCA6C6FC7F7FB3A8EFFFF8040FEBFF8004 +7F14F00381B612FC038715FF038F010014C0DBBFF0011F7FDBFFC001077F93C76C7F4B02 +007F03F8824B6F7E4B6F13804B17C0851BE0A27313F0A21BF8A37313FCA41BFEAE1BFCA4 +4F13F8A31BF0A24F13E0A24F13C06F17804F1300816F4B5A6F4A5B4AB402075B4A6C6C49 +5B9126F83FE0013F13C09127F00FFC03B55A4A6CB648C7FCDAC00115F84A6C15E091C700 +1F91C8FC90C8000313E04F657BE35A>I<92380FFFF04AB67E020F15F0023F15FC91B77E +01039039FE001FFF4901F8010113804901E0010713C04901804913E0017F90C7FC49484A +13F0A2485B485B5A5C5A7113E0485B7113C048701380943800FE0095C7FC485BA4B5FCAE +7EA280A27EA2806C18FCA26C6D150119F87E6C6D15036EED07F06C18E06C6D150F6D6DEC +1FC06D01E0EC7F806D6DECFF00010701FCEB03FE6D9039FFC03FFC010091B512F0023F5D +020F1580020102FCC7FCDA000F13C03E437BC148>I<F17FF8050FB5FCA6EF000F8484B3 +A892380FFF804AB512F8020F14FE023FECFF8391B712E301039138807FF3499039F8000F +FB011F01E00103B5FC494913004990C87E49488148498148834A815A485BA2485BA25AA3 +485BA4B5FCAE7EA46C7FA37EA26C7FA26C5F806C5F6C6D5D6C6D5D017F93B5FC6D6C6C01 +03806D6D49806D01F0D91FF7EBFFFE6D9039FE01FFE7010190B612876D6CECFE07021F14 +F8020314E09127003FFE00ECC0004F657BE35A>I<92380FFFC04AB512FC020FECFF8002 +3F15E091B712F80103D9FE037F499039F0007FFF011F01C0011F7F49496D7F4990C76C7F +49486E7F48498048844A804884485B727E5A5C48717EA35A5C721380A2B5FCA391B9FCA4 +1A0002C0CBFCA67EA380A27EA27E6E160FF11F806C183F6C7FF17F006C7F6C6D16FE6C17 +016D6C4B5A6D6D4A5A6D01E04A5A6D6DEC3FE0010301FC49B45A6D9026FFC01F90C7FC6D +6C90B55A021F15F8020715E0020092C8FC030713F041437CC14A>I<EE3FFC0307B51280 +033F14C04AB612F0020715F84A9038F03FFC4AEB807F913A7FFE00FFFE4A5A4B4813FF49 +13F05B4913E0A24913C0A27013FE4949EB7FFCEF3FF8EF1FF0EF07C094C7FCB0B812C0A6 +D8001F01C0C8FCB3B3B0007FB612FCA638657CE431>I<F107F8DB7FFEEC3FFE020FB5D8 +F001B5FC027FDAFE03148049B7128F49DCDFFD13C0010FD9F00FEBFFC149D98001140149 +90C7EBFC0349486E6C7E4948EC3FFF48496E018113800780130048F0C03E97C7FC48496E +7FA34884A96C60A36C6D4A5BA26C60A26C6D4A90C8FC6D6C4A5A6D6C4A5A6D6D485BDBF0 +0F5B4990B612C060D97C7F4AC9FCD9FC0F14F09126007FFECAFC92CCFC1201A47FA27F80 +14F091B77E18FE6CEFFFC019F06D17FC19FF6D846D846D846D84013F8490BAFC00038548 +01E0C712014890C9000F7F484816014848EE007F4848717E8512FF5B85A56D5F007F616D +173F003F616D177F6C6C4D5A6C01C003035B6C6D4B5B6C01F8031F5BC601FF92B5C7FC6D +01F8011F5B011F90B712F8010717E0010094C8FC020F15F0DA003F01FCC9FC4A607CC151 +>I<903807FF80B6FCA6C6FC7F7FB3A8EF1FFF94B512F0040714FC041F14FF4C8193267F +E07F7F922781FE001F7FDB83F86D7FDB87F07FDB8FC0814C7F039FC78015BE03BC8003FC +825DA25DA25DA45DB3B2B7D8F007B71280A651647BE35A>I<EB0FE0EB3FF8497E48B5FC +A24880A24880A76C5CA26C91C7FCA238007FFC6D5AEB0FE090C9FCAF903807FF80007FB5 +FCA6C6FC7F7FB3B3AEB712C0A622657BE42C>I<903807FF80B6FCA6C6FC7F7FB3B3B3B3 +ADB712E0A623647BE32C>108 D<902607FF80D91FFFEEFFF8B691B500F00207EBFF8004 +0702FC023F14E0041F02FF91B612F84C6F488193267FE07F6D4801037F922781FE001F90 +27E00FF0007FC6DA83F86D9026F01FC06D7F6DD987F06D4A487F6DD98FC0DBF87EC7804C +6D027C80039FC76E488203BEEEFDF003BC6E4A8003FC04FF834B5FA24B5FA24B94C8FCA4 +4B5EB3B2B7D8F007B7D8803FB612FCA67E417BC087>I<902607FF80EB1FFFB691B512F0 +040714FC041F14FF4C8193267FE07F7F922781FE001F7FC6DA83F86D7F6DD987F07F6DD9 +8FC0814C7F039FC78015BE03BC8003FC825DA25DA25DA45DB3B2B7D8F007B71280A65141 +7BC05A>I<923807FFE092B6FC020715E0021F15F8027F15FE494848C66C6C7E010701F0 +010F13E04901C001037F49496D7F4990C87F49486F7E49486F7E48496F13804819C04A81 +4819E048496F13F0A24819F8A348496F13FCA34819FEA4B518FFAD6C19FEA46C6D4B13FC +A36C19F8A26C6D4B13F0A26C19E06C6D4B13C0A26C6D4B13806C6D4B13006D6C4B5A6D6D +495B6D6D495B010701F0010F13E06D01FE017F5B010090B7C7FC023F15FC020715E00200 +92C8FC030713E048437CC151>I<902607FF80EBFFF8B6010FEBFF80047F14F00381B612 +FC038715FF038F010114C09227BFF0003F7FC6DAFFC0010F7F6D91C76C7F6D496E7F03F8 +6E7F4B6E7F4B17804B6F13C0A27313E0A27313F0A21BF885A21BFCA3851BFEAE4F13FCA4 +1BF861A21BF0611BE0611BC06F92B512801B006F5C6F4A5B6F4A5B03FF4A5B70495B04E0 +017F13C09226CFFC03B55A03C7B648C7FC03C115F803C015E0041F91C8FC040313E093CB +FCB3A3B712F0A64F5D7BC05A>I<D90FFFEB0FFCB690383FFF8093B512E04B14F04B14F8 +923907FC7FFC92390FE0FFFEC6EC1F806DD93F0113FF6D133E157E157C15F8A215F07013 +FEA24BEB7FFCEF3FF8EF0FE04B90C7FCA55DB3B0B712F8A638417BC042>114 +D<913A3FFF8007800107B5EAF81F011FECFE7F017F91B5FC48B8FC48EBE0014890C7121F +D80FFC1407D81FF0801600485A007F167F49153FA212FF171FA27F7F7F6D92C7FC13FF14 +E014FF6C14F8EDFFC06C15FC16FF6C16C06C16F06C826C826C826C82013F1680010F16C0 +1303D9007F15E0020315F0EC001F1500041F13F81607007C150100FC81177F6C163FA217 +1F7EA26D16F0A27F173F6D16E06D157F6D16C001FEEDFF806D0203130002C0EB0FFE02FC +EB7FFC01DFB65A010F5DD8FE0315C026F8007F49C7FC48010F13E035437BC140>I<EC07 +E0A6140FA5141FA3143FA2147FA214FF5BA25B5B5B5B137F48B5FC000F91B512FEB8FCA5 +D8001F01E0C8FCB3AFEF0FC0AC171F6D6D1480A2173F6D16006F5B6D6D137E6D6D5B6DEB +FF836EEBFFF86E5C020F14C002035C9126003FFCC7FC325C7DDA3F>I<902607FFC0ED3F +FEB60207B5FCA6C6EE00076D826D82B3B3A260A360A2607F60183E6D6D147E4E7F6D6D49 +48806D6DD907F0ECFF806D01FFEB3FE06D91B55A6E1500021F5C020314F8DA003F018002 +F0C7FC51427BC05A>I<B700C00103B512FCA6C66C01C0C8381FFE006D6DED07F0A26D6D +5E190F6D6D5E191F6D606F153F6D95C7FC6F5DA26D6D157E19FE6D6E5C18016E5E701303 +6E5E701307A26E6D5C180F6E6D5C181F6E6D5C183F6E93C8FC705BA26E6D13FEA26E6E5A +17816FEBC1F817C36F5C17E76F5C17FFA26F5CA26F5CA26F91C9FCA26F5BA36F5BA2705A +A2705AA2705AA2705A4E417DBF55>I<B70081B600FC0103B512FCA6C66C0180C701FCC8 +381FFE006F6FED03F86D047F5F856F6E16076D646F70140F6D705F866F6E161F6D646F4A +6D143F6D99C7FC4E7F6F616D1B7E6F4A6D14FE6D6395B57E7001FC15016E62DCC0016E13 +036EDBF87F5D05038004E0496C14076E62DCF007ED800F6E4B6C5D050F15C004F8496C14 +1F6E62DCFC1FEDE03F6E4B6C92C8FC053F15F004FE496C5C6E197E7048EDF8FE6E027E6D +5C05FE15FC4D6D13FD6F601BFF6F496E5BA24D806F60A26F496E5BA24D806F60A26F496E +90C9FCA294C87E6F5FA26F486F5A047C6F5A6E417DBF75>I<007FB600C0017FB512F8A6 +D8001F01F8C70007EBF0006D040190C7FC6D6D5D6D6D4A5A6D6D4A5A70495A6D4C5A6E7F +6E6D495A6E6D495A7049C8FC6E4A5A6E6D485A6E6D485A6E13FFEF8FF06EEC9FE06FEBFF +C06F5C6F91C9FC5F6F5B816F7F6F7F8481707F8493B57E4B805D4B80DB0FF37FDB1FE17F +04C080153F4B486C7F4B486C7F4A486D7F4A486D7F4A5A4B6D7F020F6E7F4A486D7F4A48 +6D804A5A4AC86C7F49486F7F4A6F7F0107707FEB3FFFB600F049B7FCA650407EBF55>I< +B700C00103B512FCA6D8003F01C0C8381FFE006FED07F0A26D6D5E190F6D6D5E191F6D6D +5E193F6D95C7FC6F5D6D177E6F15FEA26D6E495AA26E6D5C18036E6D5C18076E5E70130F +6E5E70131FA26E6D495AA26E6D91C8FC606E6D137E18FE6E5D17816F5C17C3A26FEBE7F0 +A26FEBF7E017FF6F5CA26F5CA26F91C9FCA36F5BA26F5BA2705AA2705AA2705AA35FA25F +163F94CAFC5E167E16FED807E05CD81FF81301487E486C495AA2B5495AA24B5A5E151F4B +5A6C4849CBFC15FEEBFC01393FF807FC391FF03FF06CB55A6C5C6C91CCFCC613FCEB1FE0 +4E5D7DBF55>I E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fj cmtt10 10.95 76 +/Fj 76 126 df<00101304007C131F00FEEB3F80A26C137FA248133FB2007E1400007C7F +003C131E00101304191C75B830>34 D<D803C0EB01E0D80FF01303486C497E487E150F48 +7ED87E7E495AEAFE7F5E486C133FA25E157FA24BC7FC6C5A5D387E7E01EA7FFED83FFC5B +1403EA1FF86C48485AEA03C0C75B140FA25D141FA24A5AA25D147FA292C8FC5CA2495AA2 +5C1303A25C1307A290390FF001E0ED07F84A487E011F497EA24A487E133F163F90267F80 +7F1380ED7E1F14005BA25B1201A24848EB7F3F033F13004914FF12076F5A5B6F5A6C486D +5A0001EC01E029477DBE30>37 D<141E147F14FF5BEB03FEEB07FCEB0FF0EB1FE0EB3FC0 +EB7F80EBFF00485A5B12035B485A120F5BA2485AA2123F5BA2127F90C7FCA412FEAD127F +A47F123FA27F121FA26C7EA27F12076C7E7F12017F6C7EEB7F80EB3FC0EB1FE0EB0FF0EB +07FCEB03FEEB01FF7F147F141E184771BE30>40 D<127812FE7E7F6C7E6C7EEA0FF06C7E +6C7E6C7E6C7EEB7F80133F14C0131FEB0FE014F01307A2EB03F8A214FC1301A214FE1300 +A4147FAD14FEA4130114FCA2130314F8A2EB07F0A2130F14E0EB1FC0133F1480137FEBFF +00485A485A485A485AEA3FE0485A485A90C7FC5A1278184778BE30>I<14E0497E497EA6 +0038EC0380007EEC0FC0D8FF83EB3FE001C3137F9038F3F9FF267FFBFB13C06CB6128000 +0FECFE00000314F86C5C6C6C13C0011F90C7FC017F13C048B512F04880000F14FE003FEC +FF80267FFBFB13C026FFF3F913E09038C3F87F0183133FD87E03EB0FC00038EC03800000 +91C7FCA66D5A6D5A23277AAE30>I<143EA2147FAF007FB7FCA2B81280A36C1600A2C76C +C8FCAF143EA229297DAF30>I<EA03E0EA0FF0EA1FF813FCEA3FFEA213FFA27EA27E1203 +EA007FA2137E13FEEA01FC1203EA07F8EA3FF0127FEAFFE0EA7F801300123C1019708B30 +>I<007FB612F0A2B712F8A36C15F0A225077B9E30>I<120FEA3FC0EA7FE0A2EAFFF0A4EA +7FE0A2EA3FC0EA0F000C0C6E8B30>I<16F01501ED03F8A21507A2ED0FF0A2ED1FE0A2ED +3FC0A2ED7F80A2EDFF00A24A5AA25D1403A24A5AA24A5AA24A5AA24A5AA24A5AA24AC7FC +A2495AA25C1303A2495AA2495AA2495AA2495AA2495AA249C8FCA2485AA25B1203A2485A +A2485AA2485AA2485AA2485AA248C9FCA25AA2127CA225477BBE30>I<14FE903807FFC0 +497F013F13F8497F90B57E48EB83FF4848C6138049137F4848EB3FC04848EB1FE049130F +001F15F0491307A24848EB03F8A290C712014815FCA400FEEC00FEAD6C14016C15FCA36D +1303003F15F8A26D1307001F15F0A26D130F6C6CEB1FE0A26C6CEB3FC06C6CEB7F806D13 +FF2601FF8313006CEBFFFE6D5B6D5B010F13E06D5BD900FEC7FC273A7CB830>I<EB03C0 +497EA2130FA2131FA2133F137F13FF1203123FB5FCA213EF138FEA7E0F1200B3B0003FB5 +12F84814FCB612FEA26C14FC6C14F81F3977B830>I<EB07FC90383FFFC090B512F00003 +804814FE4880261FF80F1380263FE00113C09038C0007F4848EB3FE090C7121FED0FF048 +14075A6C15F81503A3127E1218C8FCA2150716F0150F16E0151F16C0153FED7F8015FF4A +13005DEC07FC4A5A4A5A4A5A4A5A4A5A4990C7FC495A495AEB0FF0EB3FE0495A495A4890 +C8FC4848EB01F04848EB03F8485AEA1FE048B6FCB7FCA37E6C15F025397BB830>I<EB03 +FF013F13E090B512F84814FE4880481580260FFE0113C09038F0007F4848EB1FE0150F16 +F01507A26C5A6C5AC8FC150F16E0A2151FED3FC0157FEDFF8002071300903807FFFE495B +5D8115FF6D1480D9000113C09138003FE0ED1FF0ED07F8150316FC150116FE1500A21218 +127EB4FCA2150116FC4814036C15F86C6C13076DEB1FF0D83FF0133F3A1FFE01FFE06CB6 +12C06C15806CECFE00C65C013F13F001031380273A7CB830>I<EC03FC4A7E140F141FA2 +143F147F157E14FEA2EB01FCEB03F8A2EB07F0A2EB0FE0EB1FC0A2EB3F80A2EB7F0013FE +A2485A485AA2485AA2485A485AA2485AA248C7FC12FEB8FC1780A46C1600C8007EC7FCAA +91387FFFFE91B6FCA46E5B29397DB830>I<000FB612804815C05AA316800180C8FCAEEB +83FF019F13C090B512F015FC8181D9FE0313809039F0007FC049133F0180EB1FE06CC712 +0F000E15F0C81207A216F81503A31218127EA2B4FC150716F048140F6C15E06C141F6DEB +3FC06D137F3A3FE001FF80261FFC0F13006CB55A6C5C6C5C6C14E06C6C1380D90FFCC7FC +25397BB730>I<EC0FF8EC7FFF49B51280010714E0131F4914F090387FF80F9039FFC007 +F84813803803FE005B485A4848EB03F0ED01E0484890C7FC5B123F5BA2127FEB000C9038 +03FFE0010F13F8D8FF3F13FE48B6FCB7128016C09039FE007FE001F8EB1FF001E0130F49 +EB07F849EB03FCA290C7120116FE1500A37EA46C7E15016D14FC121F6D1303000FEC07F8 +6D130F6C6CEB1FF06DEB3FE03A03FF81FFC06C90B512806C15006D5B011F13F8010713E0 +01011380273A7CB830>I<127CB712FC16FEA416FC48C7EA0FF816F0ED1FE0007CEC3FC0 +C8EA7F80EDFF00A24A5A4A5A5D14075D140F5D4A5AA24A5AA24AC7FCA25C5C13015CA213 +035CA213075CA4495AA6131F5CA96D5A6DC8FC273A7CB830>I<49B4FC011F13F0017F13 +FC90B57E0003ECFF804815C048010113E03A1FF8003FF049131FD83FC0EB07F8A24848EB +03FC90C71201A56D1303003F15F86D13076C6CEB0FF06C6CEB1FE0D807FCEB7FC03A03FF +83FF806C90B512006C6C13FC011F13F0497F90B512FE48802607FE0013C0D80FF8EB3FE0 +D81FE0EB0FF04848EB07F8491303007F15FC90C712014815FE481400A66C14016C15FC6D +1303003F15F86D1307D81FF0EB1FF06D133F3A0FFF01FFE06C90B512C06C1580C6ECFE00 +6D5B011F13F0010190C7FC273A7CB830>I<49B4FC010F13E0013F13F890B57E48804880 +48010113803A0FFC007FC0D81FF0EB3FE04848131F49EB0FF048481307A290C7EA03F85A +4815FC1501A416FEA37E7E6D1303A26C6C13076C6C130F6D133FD80FFC13FF6CB6FC7E6C +14FE6C14F9013FEBE1FC010F138190380060011400ED03F8A2150716F0150F000F15E048 +6C131F486CEB3FC0157FEDFF804A1300EC07FE391FF01FFC90B55A6C5C6C5C6C1480C649 +C7FCEB3FF0273A7CB830>I<120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F00C7 +FCAF120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F000C276EA630>I<EA03C0EA +0FF0EA1FF8A2EA3FFCA4EA1FF8A2EA0FF0EA03C0C7FCAFEA03C0EA0FF0121F13F8123F13 +FCA3121FA2120F12031200120113F8120313F01207EA1FE0123FEA7FC0EAFF80EA7F0012 +7E12380E3470A630>I<16F01503ED07F8151F157FEDFFF014034A13C0021F138091383F +FE00ECFFF8495B010713C0495BD93FFEC7FC495A3801FFF0485B000F13804890C8FCEA7F +FC5BEAFFE05B7FEA7FF87FEA1FFF6C7F000313E06C7F38007FFC6D7E90380FFF806D7F01 +0113F06D7FEC3FFE91381FFF80020713C06E13F01400ED7FF8151F1507ED03F01500252F +7BB230>I<1278127EB4FC13C07FEA7FF813FEEA1FFF6C13C000037F6C13F86C6C7EEB1F +FF6D7F010313E06D7F9038007FFC6E7E91380FFF806E13C0020113F080ED3FF8151F153F +EDFFF05C020713C04A138091383FFE004A5A903801FFF0495B010F13804990C7FCEB7FFC +48485A4813E0000F5B4890C8FCEA7FFE13F8EAFFE05B90C9FC127E1278252F7BB230>62 +D<EC1FE0ECFFF8010313FE010F7F4914804914C090397FF03FE09038FF800F4890380007 +F0D803FC13033A07F801FBF89038F007FF380FE01F4A13FCEA1FC0495A003FEBFF0F9038 +00FE07903901FC03FE007FEBF801EA7E03ECF000A2EAFE0700FC49137EAA00FE6D13FED8 +7E0314FCA2ECF801D87F0114F8003FEBFC03903900FE07F0903880FF0F001F90387FFFE0 +6D6C13C0EA0FE06E13803A07F007FE009038F801F86C6CC7127C6CB414FE6CEB80039038 +7FF01F6DB512FC6D14F86D14E0010314C00100EBFE00EC1FF0273A7CB830>64 +D<147F4A7EA2497FA4497F14F7A401077F14E3A3010F7FA314C1A2011F7FA490383F80FE +A590387F007FA4498049133F90B6FCA34881A39038FC001F00038149130FA40007814913 +07A2D87FFFEB7FFFB56CB51280A46C496C130029397DB830>I<007FB512F0B612FE6F7E +82826C813A03F8001FF815076F7E1501A26F7EA615015EA24B5A1507ED1FF0ED7FE090B6 +5A5E4BC7FC6F7E16E0829039F8000FF8ED03FC6F7E1500167FA3EE3F80A6167F1700A25E +4B5A1503ED1FFC007FB6FCB75A5E16C05E6C02FCC7FC29387EB730>I<91387F803C9039 +03FFF03E49EBFC7E011F13FE49EBFFFE5B9038FFE07F48EB801F3903FE000F484813075B +48481303A2484813015B123F491300A2127F90C8FC167C16005A5AAC7E7EA2167C6D14FE +123FA27F121F6D13016C6C14FCA26C6CEB03F86D13076C6CEB0FF03901FF801F6C9038E0 +7FE06DB512C06D14806D1400010713FC6D13F09038007FC0273A7CB830>I<003FB512E0 +4814FCB67E6F7E6C816C813A03F8007FF0ED1FF8150F6F7E6F7E15016F7EA2EE7F80A216 +3F17C0161FA4EE0FE0AC161F17C0A3163F1780A2167F17005E4B5A15034B5A150F4B5AED +7FF0003FB65A485DB75A93C7FC6C14FC6C14E02B387FB730>I<007FB7FCB81280A47ED8 +03F8C7123FA8EE1F0093C7FCA4157C15FEA490B5FCA6EBF800A4157C92C8FCA5EE07C0EE +0FE0A9007FB7FCB8FCA46C16C02B387EB730>I<003FB712804816C0B8FCA27E7ED801FC +C7121FA8EE0F8093C7FCA5153E157FA490B6FCA69038FC007FA4153E92C8FCAE383FFFF8 +487FB5FCA27E6C5B2A387EB730>I<02FF13F00103EBC0F8010F13F1013F13FD4913FF90 +B6FC4813C1EC007F4848133F4848131F49130F485A491307121F5B123F491303A2127F90 +C7FC6F5A92C8FC5A5AA892B5FC4A14805CA26C7F6C6D1400ED03F8A27F003F1407A27F12 +1F6D130F120F7F6C6C131FA2D803FE133F6C6C137FECC1FF6C90B5FC7F6D13FB010F13F3 +0103EBC1F0010090C8FC293A7DB830>I<3B3FFF800FFFE0486D4813F0B56C4813F8A26C +496C13F06C496C13E0D803F8C7EAFE00B290B6FCA601F8C7FCB3A23B3FFF800FFFE0486D +4813F0B56C4813F8A26C496C13F06C496C13E02D387FB730>I<007FB6FCB71280A46C15 +00260007F0C7FCB3B3A8007FB6FCB71280A46C1500213879B730>I<D83FFF90380FFF80 +486D4813C0B56C5AA26C497E6C496C1380D803F0903803F8004B5A4B5A151F4B5A5E4BC7 +FC15FE14014A5A5D4A5A4A5A141F5D4A5A4AC8FC5C13F18101F37F13F790B57E14EFECC7 +F01483EC03F8140101FE7F496C7E5B157F497F82151F82150F826F7EA26F7E1501821500 +D83FFF903803FFC0486D4813E0B56C5AA26C497E6C496C13C02B387FB730>75 +D<383FFFF8487FB57EA26C5B6C5BD801FCC9FCB3B0EE0F80EE1FC0A9003FB7FC5AB8FCA2 +7E6C16802A387EB730>I<D83FF8ECFFE0486C4913F0486C4913F8A2007F16F06C6C4913 +E00007160001EF14BFEC800FA39039E7C01F3FA4ECE03F01E3133EA2ECF07EA201E1137C +A2ECF8FCA201E013F8A214FDEC7DF0A3147FEC3FE0A3EC1FC0A2EC070091C7FCADD83FFC +903801FFE0486C4913F0B54913F8A26C486D13F06C486D13E02D387FB730>I<D83FFC90 +381FFF80486C4913C0B54913E0A26C6D6C13C06C6E13800003913801F800EBF7C0A3EBF3 +E0A314F013F1A214F8A213F014FCA2147C147EA2143E143FA2141FA21581A2140F15C1A2 +140715E1A2140315F1A21401A215F91400A3157DA3153FEA3FFF481380B5EAC01FA26CEB +800F6C496C5A2B387EB730>I<90383FFFE048B512FC000714FF4815804815C04815E0EB +F80001E0133FD87F80EB0FF0A290C71207A44815F8481403B3A96C1407A26C15F0A36D13 +0FA26D131F6C6CEB3FE001F813FF90B6FC6C15C06C15806C1500000114FCD8003F13E025 +3A7BB830>I<007FB512F0B612FE6F7E16E0826C813903F8003FED0FFCED03FE15016F7E +A2821780163FA6167F17005EA24B5A1503ED0FFCED3FF890B6FC5E5E16804BC7FC15F001 +F8C9FCB0387FFFC0B57EA46C5B29387EB730>I<003FB57E4814F0B612FC15FF6C816C81 +2603F8017F9138003FF0151F6F7E15071503821501A515035E1507150F4B5A153F4AB45A +90B65A5E93C7FC5D8182D9F8007FED3FE0151F150F821507A817F8EEF1FCA53A3FFF8003 +FB4801C0EBFFF8B56C7E17F06C496C13E06C49EB7FC0C9EA1F002E397FB730>82 +D<90390FF803C0D97FFF13E048B512C74814F74814FF5A381FF80F383FE001497E484813 +7F90C7123F5A48141FA2150FA37EED07C06C91C7FC7F7FEA3FF0EA1FFEEBFFF06C13FF6C +14E0000114F86C80011F13FF01031480D9003F13C014019138007FE0151FED0FF0A2ED07 +F8A2007C140312FEA56C140716F07F6DEB0FE06D131F01F8EB3FC001FF13FF91B5128016 +0000FD5CD8FC7F13F8D8F81F5BD878011380253A7BB830>I<003FB712C04816E0B8FCA4 +3AFE003F800FA8007CED07C0C791C7FCB3B1011FB5FC4980A46D91C7FC2B387EB730>I< +3B7FFFC007FFFCB56C4813FEA46C496C13FCD803F8C7EA3F80B3B16D147F00011600A36C +6C14FE6D13016D5CEC800390393FE00FF890391FF83FF06DB55A6D5C6D5C6D91C7FC9038 +007FFCEC1FF02F3980B730>I<D87FFE90380FFFC0B54913E06E5AA24A7E6C486D13C0D8 +07F0903801FC00A26D130300035DA46C6C495AA46C6C495AA46D131F6D5CA3EC803F013F +5CA46D6C48C7FCA490380FE0FEA401075B14F1A301035BA314FB01015BA314FFA26D5BA4 +6E5A6E5A2B397EB730>I<D83FFC903801FFE0486C4913F000FF16F8A2007F16F06C486D +13E0D81FC09038001FC0000F1680A76D143F00071600A7000390380F803E9039F01FC07E +EC3FE0A3EC7FF0A2147D0001157CA29039F8FDF8FCA314F8A300005D01F913FCA2ECF07C +A201FD137DA2017D5CECE03DA3017F133FA2ECC01FA2013F5CA2EC800F6D486C5A2D397F +B730>I<3A3FFF01FFF84801837F02C77FA202835B6C01015B3A01FC007F806D91C7FC00 +005C6D5BEB7F01EC81FCEB3F8314C3011F5B14E7010F5B14FF6D5BA26D5BA26D5BA26D90 +C8FCA4497FA2497FA2815B81EB0FE781EB1FC381EB3F8181EB7F0081497F49800001143F +49800003141F49800007140FD87FFEEB7FFFB590B5128080A25C6C486D130029387DB730 +>I<D87FFF90381FFFC0B56C4813E0A46C496C13C0D803F8903803F8006D1307A26C6C49 +5AA26C6C5C151F6D5CEC803F013F5CECC07F011F91C7FCA290380FE0FEA214F101075BA2 +903803FBF8A201015B14FF6D5BA26E5AA36E5AB1903803FFF8497F497FA26D5B6D5B2B38 +7EB730>I<007FB612F0A2B712F8A36C15F0A225077B7D30>95 D<EB3FFC48B57E4814E0 +4880488048809038F00FFE9038E001FF806F7E6C48133F6C4880C8121FA491B5FC130F13 +7F48B6FC12075A48EBC01F383FFC00EA7FE0138048C7FC5AA46C143FA26C6C137F9038C0 +01FF263FF80FEBFFC06CB712E0A2000714F76C14C3C6020013C0D93FF090C7FC2B2A7CA8 +30>97 D<EA3FFC487E12FFA2127F123F1200AAEC03FE91381FFF80027F13E091B57E90B6 +12FC82ECFE079138F001FF4A6C13804A137F4AEB3FC091C7121F4915E0160FA217F01607 +A8160FA217E07F161F6EEB3FC0A26EEB7F806E13FFDAF00313009138FC0FFE91B55A5E49 +5CD97E7F13C0D93C1F90C7FC90380003FC2C3980B730>I<ECFFE0010713FC011F7F017F +7F90B612804815C048EB807F3907FC003F485A485A49EB1F804848EB0F004990C7FC127F +90C9FCA25A5AA87E7EA27F003FEC07C06DEB0FE06C7E6D131F6C6C14C0D807FE133F9039 +FFC0FF806C90B5FCC615006D5B011F13F801075B01011380232A7AA830>I<913801FFE0 +4A7F5CA28080EC0007AAEB03FE90381FFF874913E790B6FC5A5A481303380FFC00D81FF0 +133F49131F485A150F4848130790C7FCA25AA25AA87E6C140FA27F003F141F6D133F6C7E +6D137F390FF801FF2607FE07EBFFC06CB712E06C16F06C14F76D01C713E0011F010313C0 +D907FCC8FC2C397DB730>I<49B4FC010713E0011F13F8017F7F90B57E48804801811380 +3A07FC007FC04848133FD81FE0EB1FE0150F484814F0491307127F90C7FCED03F85A5AB7 +FCA516F048C9FC7E7EA27F003FEC01F06DEB03F86C7E6C7E6D1307D807FEEB1FF03A03FF +C07FE06C90B5FC6C15C0013F14806DEBFE00010713F8010013C0252A7CA830>I<EDFF80 +020713E0021F13F05C4A13F891B5FC491387903803FE079138FC03F0903907F800C04A13 +00A8003FB612C04815E0B7FCA36C15C0260007F0C7FCB3A9003FB512FE4880B71280A26C +15006C5C25397DB830>I<D903FC13FF90261FFF8713C04913DF90B712E05A5A2607FE07 +138F903AF801FE07C048486C6CC7FCA2497F001F8149133FA56D137F000F92C7FC6D5BA2 +6C6C485AEBFE0790B55A5D485C15C001DF5BD9C3FCC8FC01C0C9FCA37F7F6CB512F015FF +6C15C04815F0488148813A3FE0001FFE0180130148C8127F007E8100FE168048151FA56C +153F007FED7F006D5C6C6C495A01F013076CB4EB7FFC6C90B55A6C5D000115C06C6C91C7 +FC011F13FC010113C02B3E7DA730>I<EA3FFC487E12FFA2127F123F1200AAEC01FE9138 +0FFF80023F13E091B57E90B67EA29138FE07FCECF8039138E001FE14C0EC8000A291C7FC +A25BB3A23B3FFFF81FFFF8486D4813FCB500FE14FEA26C01FC14FC6C496C13F82F3880B7 +30>I<14E0EB03F8A2497EA36D5AA2EB00E091C8FCA9381FFFF8487F5AA27E7EEA0001B3 +A9003FB612C04815E0B7FCA27E6C15C023397AB830>I<EA7FF8487EA4127F1200AB0203 +B512804A14C017E0A217C06E14809139001FE0004B5A4B5A4BC7FC4A5A4A5AEC0FF84A5A +4A5A4A5A4A5A01FD7F90B57E8114F7ECE3F8ECC1FCEC81FEEC00FF497F496D7E6F7E826F +7E15076F7E6F7E3B7FFFF81FFFE0B56C4813F017F8A217F06C496C13E02D387FB730> +107 D<387FFFF8B57EA47EEA0001B3B3A8007FB612F0B712F8A46C15F025387BB730>I< +02FC137E3B7FC3FF01FF80D8FFEF01877F90B500CF7F15DF92B57E6C010F13872607FE07 +EB03F801FC13FE9039F803FC01A201F013F8A301E013F0B3A23C7FFE0FFF07FF80B54801 +8F13C0A46C486C01071380322881A730>I<EC01FE3A3FFC0FFF80267FFE3F13E000FF90 +B57E90B67E7E6C9038FE07FCC6EBF8039138E001FE14C0EC8000A291C7FCA25BB3A23B3F +FFF81FFFF8486D4813FCB500FE14FEA26C01FC14FC6C496C13F82F2880A730>I<49B4FC +010F13E0013F13F8497F90B57E0003ECFF8014013A07FC007FC04848EB3FE0D81FE0EB0F +F0A24848EB07F8491303007F15FC90C71201A300FEEC00FEA86C14016C15FCA26D130300 +3F15F86D13076D130F6C6CEB1FF06C6CEB3FE06D137F3A07FF01FFC06C90B512806C1500 +6C6C13FC6D5B010F13E0010190C7FC272A7CA830>I<EC03FE3A3FFC1FFF80267FFE7F13 +E000FF90B57E90B612FC6C816CEBFE07C69038F001FF4A6C13804A137F4AEB3FC091C712 +1F4915E0160FA217F01607A8160FA217E07F161F6EEB3FC0A26EEB7F806E13FFDAF00313 +009138FC0FFE91B55A5E495C6E13C0021F90C7FCEC03FC91C9FCAD383FFFF8487FB57EA2 +6C5B6C5B2C3C80A730>I<49B413F8010FEBC1FC013F13F14913FD48B6FC5A481381390F +FC007F49131F4848130F491307485A491303127F90C7FC15015A5AA77E7E15037FA26C6C +1307150F6C6C131F6C6C133F01FC137F3907FF01FF6C90B5FC6C14FD6C14F9013F13F101 +0F13C1903803FE0190C7FCAD92B512F84A14FCA46E14F82E3C7DA730>I<ED07F83A3FFF +803FFF486DB51280B512C302CF14C06C13DF6C9038FFFC3FD8001F13E09238801F809238 +000F004A90C7FC5C5C5CA25CA45CAF003FB512FC4880B7FCA26C5C6C5C2A287EA730>I< +90381FFC1E48B5129F000714FF5A5A5A387FF007EB800100FEC7FC4880A46C143E007F91 +C7FC13E06CB4FC6C13FC6CEBFF806C14E0000114F86C6C7F01037F9038000FFF02001380 +007C147F00FEEC1FC0A2150F7EA27F151F6DEB3F806D137F9039FC03FF0090B6FC5D5D00 +FC14F0D8F83F13C026780FFEC7FC222A79A830>I<EB0780497E131FA9003FB612E04815 +F0B7FCA36C15E026001FC0C7FCB216F8ED01FCA5ECE003010FEB07F814F09138FC1FF06D +B512E06D14C016806D14009038007FFCEC1FF026337EB130>I<D83FFCEB3FFC486C497E +00FF14FFA2007F147F003F143F00001400B3A41501A2150315076D130F903A7FC07FFFF8 +91B612FC6D15FE7F6D4913FC6D9038F87FF8010001C0C7FC2F2880A630>I<3B3FFFC07F +FF80486DB512C0B515E0A26C16C06C496C13803B01F80003F000A26D130700005DA26D13 +0F017E5CA2017F131F6D5CA2EC803F011F91C7FCA26E5A010F137EA2ECE0FE01075BA214 +F101035BA3903801FBF0A314FF6D5BA36E5A6E5A2B277EA630>I<3B3FFFC01FFFE0486D +4813F0B515F8A26C16F06C496C13E0D807E0C7EA3F00A26D5C0003157EA56D14FE00015D +EC0F80EC1FC0EC3FE0A33A00FC7FF1F8A2147DA2ECFDF9017C5C14F8A3017E13FBA29039 +3FF07FE0A3ECE03FA2011F5C90390F800F802D277FA630>I<3A3FFF81FFFC4801C37FB5 +80A26C5D6C01815BC648C66CC7FC137FEC80FE90383F81FC90381FC3F8EB0FE3ECE7F06D +B45A6D5B7F6D5B92C8FC147E147F5C497F81903803F7E0EB07E790380FE3F0ECC1F89038 +1F81FC90383F80FE90387F007E017E137F01FE6D7E48486D7E267FFF80B5FCB500C11480 +14E3A214C16C0180140029277DA630>I<3B3FFFC07FFF80486DB512C0B515E0A26C16C0 +6C496C13803B01FC0003F000A2000014076D5C137E150F017F5C7F151FD91F805BA214C0 +010F49C7FCA214E00107137EA2EB03F0157C15FCEB01F85DA2EB00F9ECFDF0147D147FA2 +6E5AA36E5AA35DA2143F92C8FCA25C147EA2000F13FE486C5AEA3FC1EBC3F81387EB8FF0 +EBFFE06C5B5C6C90C9FC6C5AEA01F02B3C7EA630>I<001FB612FC4815FE5AA316FC90C7 +EA0FF8ED1FF0ED3FE0ED7FC0EDFF80003E491300C7485A4A5A4A5A4A5A4A5A4A5A4A5A49 +90C7FC495A495A495A495A495A495A4948133E4890C7127F485A485A485A485A485A48B7 +FCB8FCA46C15FE28277DA630>I<ED3FF0913803FFF8140F5C147F16F09138FFF00092C7 +FC495A5CB3A21303495A133F383FFFF0B55A5C91C8FC14C080003F7F38003FF813076D7E +1301B3A2806D7E15F091387FFFF016F8141F8014039138003FF025477BBE30>I<EA7FE0 +EAFFFE6D7E8014F07EC66C7E13076D7E1301B3A2806D7E15E091387FFFE06E13F8801407 +141F5C4A13E09138FFE00092C7FC495A5CB3A21303495A137F387FFFF0B5FC14C05C49C8 +FCEA7FE025477BBE30>125 D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fk cmbx12 14.4 49 +/Fk 49 122 df<151E153E157E15FCEC01F8EC07F0EC0FE0EC1FC01580143FEC7F0014FE +1301495A5C1307495AA2495A133F5C137FA2495AA24890C7FCA25A5BA21207A2485AA312 +1F5BA3123FA25BA3127FA55B12FFB3A3127F7FA5123FA37FA2121FA37F120FA36C7EA212 +03A27F7EA26C7FA26D7EA2133F80131F6D7EA26D7E1303806D7E1300147FEC3F80141F15 +C0EC0FE0EC07F0EC01F8EC00FC157E153E151E1F7973D934>40 D<127012F8127C127E7E +EA1FC06C7E6C7E12037F6C7E6C7E7F6D7E133F806D7EA26D7E80130780A26D7EA26D7EA2 +15807FA215C0A2EC7FE0A315F0143FA315F8A2141FA315FCA5140F15FEB3A315FC141FA5 +15F8A3143FA215F0A3147F15E0A3ECFFC0A21580A25B1500A2495AA2495AA25C130F5C49 +5AA2495A5C137F49C7FC5B485A485A5B1207485A485A48C8FC127E127C5A12701F7979D9 +34>I<EA07F0487E487E487E487EB51280A76C13006C5A6C5A6C5A6C5A1111769025>46 +D<913803FFC0023F13FC91B6FC010315C0010F018113F0903A1FFC003FF849486D7E4948 +6D7E49486D7E48496D138048496D13C0A24817E04890C813F0A34817F8A24817FC49157F +A3007F17FEA600FF17FFB3A5007F17FEA6003F17FCA26D15FFA26C17F8A36C17F0A26C6D +4913E0A26C6D4913C06C17806E5B6C6D4913006D6C495AD91FFCEB3FF8903A0FFF81FFF0 +6D90B55A01011580D9003F01FCC7FC020313C0384F7BCD43>48 D<157815FC1403140714 +1F14FF130F0007B5FCB6FCA2147F13F0EAF800C7FCB3B3B3A6007FB712FEA52F4E76CD43 +>I<EC3FFE0103B512E0010F14FC013F14FF90B712C048D9C07F7F2703FE000F13F8D807 +F801037FD80FE06D7F48486D7F48488001F01680486C6E13C07F486C6E13E07FA27013F0 +A56C5AA26C5AEA0FF0EA03C0C914E05EA218C05E1880A24C13005F4C5A4B5B5F4B5B5F4B +5B4B90C7FC4B5A5E4B5AED7FE04B5A4A5B4A48C8FC4A5A5D4A48EB01F04A5AEC3F804AC7 +FC02FEEC03E0495A495A495A495AD91F80140749C8FC013E150F017FB7FC90B812C05A5A +5A5A5A5A5AB9FC1880A4344E79CD43>I<91380FFFC091B512FC0107ECFF80011F15E090 +263FF8077F9026FF800113FC4848C76C7ED803F86E7E491680D807FC8048B416C080486D +15E0A4805CA36C17C06C5B6C90C75AD801FC1680C9FC4C13005FA24C5A4B5B4B5B4B13C0 +4B5BDBFFFEC7FC91B512F816E016FCEEFF80DA000713E0030113F89238007FFE707E7013 +807013C018E07013F0A218F8A27013FCA218FEA2EA03E0EA0FF8487E487E487EB57EA318 +FCA25E18F891C7FC6C17F0495C6C4816E001F04A13C06C484A1380D80FF84A13006CB44A +5A6CD9F0075BC690B612F06D5D011F1580010302FCC7FCD9001F1380374F7ACD43>I<17 +7C17FEA2160116031607160FA2161F163F167FA216FF5D5DA25D5DED1FBFED3F3F153E15 +7C15FCEC01F815F0EC03E01407EC0FC01580EC1F005C147E147C5C1301495A495A5C495A +131F49C7FC133E5B13FC485A5B485A1207485A485A90C8FC123E127E5ABA12C0A5C96C48 +C7FCAF020FB712C0A53A4F7CCE43>I<D80380150ED807E0157E01FEEC03FED9FFF0137F +91B65A5F5F5F5F5F94C7FC5E5E16F016C093C8FC15F801E190C9FC01E0CAFCABEC0FFF02 +7F13F001E3B512FE01E76E7E9026FFF8077FDAC0017F49C713F8496E7E49143F4981496E +7E6C481680C9FC18C08218E0A418F0A3EA0FE0487E487E487E487EA418E0A35B6C484A13 +C05B491680003EC85A003F17006C6C4A5A6D5D6C6C4A5AD807F8495BD803FE01075B2701 +FFC03F5B6C90B65A013F4AC7FC6D14F8010314C09026007FF8C8FC344F79CD43>I<ED0F +FF92B512E0020780021F14FC91397FFE03FE903A01FFF0007F4901C0EB3F804990C7121F +4948EC7FC0494814FF49484913E049485B01FF5C485BA2485B5AA2486F13C04A6D138048 +6F1300177E94C7FC5AA291CAFC5AA21508913801FFF8020713FFB54814C04A14F04AC66C +7E023C6D7E4A6D7E4A6D7E7013804A15C0A24A15E07013F05C18F8A491C714FCA37EA67E +A46C17F880A27E18F06C5D18E06C6D15C07E6E4913806C6D15006D6C495A6D6CEB7FFC6D +B448485A6D90B55A010315C0010092C7FC023F13FC020713C0364F7ACD43>I<121F7F7F +EBFF8091B81280A45A1900606060A2606060485F0180C86CC7FC007EC95A4C5A007C4B5A +5F4C5A160F4C5A484B5A4C5A94C8FC16FEC812014B5A5E4B5A150F4B5AA24B5AA24B5A15 +FFA24A90C9FCA25C5D1407A2140FA25D141FA2143FA4147F5DA314FFA55BAC6D5BA2EC3F +C06E5A395279D043>I<913807FFC0027F13FC0103B67E010F15E090261FFC0113F8903A +3FE0003FFCD97F80EB0FFE49C76C7E48488048486E1380000717C04980120F18E0177FA2 +121F7FA27F7F6E14FF02E015C014F802FE4913806C7FDBC00313009238F007FE6C02F85B +9238FE1FF86C9138FFBFF06CEDFFE017806C4BC7FC6D806D81010F15E06D81010115FC01 +0781011F81491680EBFFE748018115C048D9007F14E04848011F14F048487F4848130303 +0014F8484880161F4848020713FC1601824848157F173FA2171FA2170FA218F8A27F007F +17F06D151FA26C6CED3FE0001F17C06D157F6C6CEDFF806C6C6C010313006C01E0EB0FFE +6C01FCEBFFFC6C6CB612F06D5D010F1580010102FCC7FCD9000F13C0364F7ACD43>I<91 +380FFF8091B512F8010314FE010F6E7E4901037F90267FF8007F4948EB3FF048496D7E48 +4980486F7E484980824817805A91C714C05A7013E0A218F0B5FCA318F8A618FCA46C5DA3 +7EA25E6C7F6C5DA26C5D6C7F6C6D137B6C6D13F390387FF803011FB512E36D14C3010302 +8313F89039007FFE03EC00401500A218F05EA3D801F816E0487E486C16C0487E486D4913 +80A218005E5F4C5A91C7FC6C484A5A494A5A49495B6C48495BD803FC010F5B9027FF807F +FEC7FC6C90B55A6C6C14F06D14C0010F49C8FC010013F0364F7ACD43>I<171F4D7E4D7E +A24D7EA34C7FA24C7FA34C7FA34C7FA24C7FA34C8083047F80167E8304FE804C7E030181 +16F8830303814C7E03078116E083030F814C7E031F81168083033F8293C77E4B82157E84 +03FE824B800201835D840203834B800207835D844AB87EA24A83A3DA3F80C88092C97E4A +84A2027E8202FE844A82010185A24A820103854A82010785A24A82010F855C011F717FEB +FFFCB600F8020FB712E0A55B547BD366>65 D<BA12C019FEF1FFC01AF01AFCD8000701F0 +C7000313FFDE007F7F737F070F7F737F878587858785A287A84F5BA263616361634F5B4F +5B077F90C7FC4E485A060713F892B812E097C8FC861AF003F0C7000313FE9539003FFF80 +070F13E0737F07017F87737F747E1C807413C0A27413E0A31CF0A386A362A31CE0A2621C +C0A250138097B5FC1C004F5B19074F5B073F13F04EB55ABC128098C7FC1AF81AC007F8C8 +FC54527CD160>I<932601FFFCEC01C0047FD9FFC013030307B600F81307033F03FE131F +92B8EA803F0203DAE003EBC07F020F01FCC7383FF0FF023F01E0EC0FF94A01800203B5FC +494848C9FC4901F8824949824949824949824949824990CA7E494883A2484983485B1B7F +485B481A3FA24849181FA3485B1B0FA25AA298C7FC5CA2B5FCAE7EA280A2F307C07EA36C +7FA21B0F6C6D1980A26C1A1F6C7F1C006C6D606C6D187EA26D6C606D6D4C5A6D6D16036D +6D4C5A6D6D4C5A6D01FC4C5A6D6DEE7F806D6C6C6C4BC7FC6E01E0EC07FE020F01FEEC1F +F80203903AFFE001FFF0020091B612C0033F93C8FC030715FCDB007F14E0040101FCC9FC +525479D261>I<BA7E19FCF1FF801AF01AFCD8000701F0C7000F13FF060014C0071F7F07 +0713F807017F737F747E747F747F86747F747F8886888688A2757EA31D8087A21DC0A51D +E0A387A963A31DC0A51D80A2631D00A3515AA2646264505B6264505B505B5090C7FCF2FF +FE4F5B07075B071F5B96B512C0060F91C8FCBB5A1AF01AC007FCC9FC19805B527CD167> +I<BC1280A5D8000701F8C7000114C0F0001F19071901851A7F1A3F1A1FA2F20FE0A21A07 +A31A03A318F81BF01A01A497C7FC1701A317031707170F177F92B6FCA59238F8007F170F +170717031701A317001B3EA31B7CA395C8FCA21BFCA21BF8A21A01A31A031BF01A071A0F +A21A1F1A3FF27FE0F101FF1907191F0603B5FCBCFCA21BC0A34F517CD058>I<BB12FEA5 +D8000701F8C700077FF0007F191F190785858586861B80A21A1FA31A0FA41BC006F81307 +A497C7FCA31701A317031707170F177F92B6FCA59238F8007F170F170717031701A31700 +A795C9FCB3B812F8A54A517CD055>I<B812C0A5D8000701F8C7FCB3B3B3B2B812C0A52A +527CD132>73 D<B812F8A5D8000701F8CAFCB3B3A91A7CA41AFC1AF8A51901A31903A219 +071AF0190FA2191F193F197F19FF180360183F4DB5FCBB12E0A546527CD151>76 +D<93380FFFC00303B6FC031F15E092B712FC0203D9FC0013FF020F01C0010F13C0023F90 +C7000313F0DA7FFC02007F494848ED7FFE4901E0ED1FFF49496F7F49496F7F4990C96C7F +49854948707F4948707FA24849717E48864A83481B804A83481BC0A2481BE04A83A2481B +F0A348497113F8A5B51AFCAF6C1BF86E5FA46C1BF0A26E5F6C1BE0A36C6D4D13C0A26C6D +4D1380A26C1B006C6D4D5A6E5E6C626D6C4C5B6D6D4B5B6D6D4B5B6D6D4B5B6D6D4B5B6D +6D4B90C7FC6D6D4B5A6D01FF02035B023F01E0011F13F0020F01FC90B512C0020390B7C8 +FC020016FC031F15E0030392C9FCDB001F13E0565479D265>79 D<BAFC19F819FF1AE086 +D8000701F0C7001F13FC060113FF726C13807313C0070F13E01BF0857313F81BFCA27313 +FEA41BFFA81BFEA31BFC61A21BF84F13F04F13E0614F13C04F13004E485A061F5B92B812 +F01AC04FC7FC19E003F8CBFCB3AEB812C0A550527CD15C>I<B912F0F0FF8019F819FF1A +C0D8000701F0C714F0060F7F060113FE727F737F737F85737F87A2737FA387A863A26163 +63A24F5B4F5B4F90C8FC4F5A06035B060F13F095B512C092B8C9FC19F819E019F89226F0 +000313FE9439007FFF80727F727F727F727F727F8684A28684A787A71D1C75133EA38575 +137E73157C7513FC731401B86C6D9038F803F807039038FE07F07390B512E0736C14C008 +0F1400CEEA7FFC5F537CD164>82 D<91260FFF80130791B500F85B010702FF5B011FEDC0 +3F49EDF07F9026FFFC006D5A4801E0EB0FFD4801800101B5FC4848C87E48488149150F00 +1F824981123F4981007F82A28412FF84A27FA26D82A27F7F6D93C7FC14C06C13F014FF15 +F86CECFF8016FC6CEDFFC017F06C16FC6C16FF6C17C06C836C836D826D82010F82130301 +0082021F16801400030F15C0ED007F040714E01600173F050F13F08383A200788200F882 +A3187FA27EA219E07EA26CEFFFC0A27F6D4B13806D17006D5D01FC4B5A01FF4B5A02C04A +5A02F8EC7FF0903B1FFFC003FFE0486C90B65AD8FC0393C7FC48C66C14FC48010F14F048 +D9007F90C8FC3C5479D24B>I<003FBC1280A59126C0003F9038C0007F49C71607D87FF8 +060113C001E08449197F49193F90C8171FA2007E1A0FA3007C1A07A500FC1BE0481A03A6 +C994C7FCB3B3AC91B912F0A553517BD05E>I<B800C00103B612FCA5D8000701F8CAEBF0 +00F31F80B3B3B11B3FA26D97C7FC81637F1B7E6D6D17FE505A6E7E505A6E6D15076E4D5A +6E6D4B5A6E6D4B5A6E01F84B5A6E6DDA03FFC8FC6E6CB46CEB0FFE6F9039F001FFF8030F +90B65A030316C0DB007F92C9FC040F14F8DC007F13805E537CD167>I<EC7FFF0107B512 +F0013F14FE90B77E48D9E00F7F2703FE000113F0486C6D7F6EEB3FFC48826E131F83707F +A36C496D7FA26C90C7FC6C5AC9FCA6037FB5FC020FB6FC91B7FC01071487013FEBF00749 +13803901FFFC004813F0485B485B485B4890C7FC5A5BA2485AA45EA26D5C007F151D163D +6C6C02797F6C6D01F113F86C9026C003E1EBFFE06C9026F81FC014F06C90B5487EC6ED00 +1F011F01FC010713E0010101E090C8FC3C387CB641>97 D<EB3FF0B5FCA51203C6FCB3A4 +923801FFE0030F13FE033FEBFFC092B612F002F301017F913AF7F8003FFEDAFFE0EB0FFF +03806D7F92C76C7F4A6E7F4A824A6E7FA2727EA285A28584A31A80AC1A00A44E5AA36118 +FF616E4A5BA26E4A5B6E4A5B6F495BDACFC04990C7FCDA87F0EB7FFC913A03FE03FFF849 +C6B612E0496D148049011F01FCC8FC90C7000313C041547BD24B>I<913801FFF8021FEB +FF8091B612F0010315FC010F9038C00FFE903A1FFE0001FFD97FFC491380D9FFF05B4817 +C048495B5C5A485BA2486F138091C7FC486F1300705A4892C8FC5BA312FFAD127F7FA27E +A2EF03E06C7F17076C6D15C07E6E140F6CEE1F806C6DEC3F006C6D147ED97FFE5C6D6CEB +03F8010F9038E01FF0010390B55A01001580023F49C7FC020113E033387CB63C>I<4DB4 +7E0407B5FCA5EE001F1707B3A4913801FFE0021F13FC91B6FC010315C7010F9038E03FE7 +4990380007F7D97FFC0101B5FC49487F4849143F484980485B83485B5A91C8FC5AA3485A +A412FFAC127FA36C7EA37EA26C7F5F6C6D5C7E6C6D5C6C6D49B5FC6D6C4914E0D93FFED9 +0FEFEBFF80903A0FFFC07FCF6D90B5128F0101ECFE0FD9003F13F8020301C049C7FC4154 +7CD24B>I<913803FFC0023F13FC49B6FC010715C04901817F903A3FFC007FF849486D7E +49486D7E4849130F48496D7E48178048497F18C0488191C7FC4817E0A248815B18F0A212 +FFA490B8FCA318E049CAFCA6127FA27F7EA218E06CEE01F06E14037E6C6DEC07E0A26C6D +EC0FC06C6D141F6C6DEC3F806D6CECFF00D91FFEEB03FE903A0FFFC03FF8010390B55A01 +0015C0021F49C7FC020113F034387CB63D>I<ED3FFC0203B5FC020F14C0023F14E09139 +FFF81FF0499038C03FF849EB807F49903800FFFC495A495AA2495AA2EE7FF8495AEE3FF0 +EE0FC093C7FCAEB712E0A526007FF8C8FCB3B3A7007FB512FEA52E547CD329>I<DA3FFF +14FF0103B5D8F00713C0010FDAFC1F13E0013FECFF7F90267FFC0F9038FF9FF09026FFE0 +01EBF83F48496C13E0484990387FF01F4890C7D83FF813E0489338FC0FC0F0078048486E +6CC7FCA2003F82A9001F5EA26C6C4A5AA26C5E6C6D495A6C6D495A6C6D485BDAFC0F5B48 +90B6C8FCD803EF14FC01C314F02607C03F90C9FC91CBFCA2120FA37FA213F813FE90B7FC +6C16F817FF18C06C836C836C836D828448B9FC12074848C700031480D81FF8EC003F4848 +150748486F13C083485A83A56D5D007F18806D5D003F18006C6C4B5AD80FFEED1FFC6C6C +6CEC7FF86C01E049485A6C01FE011F5B6C6CB71280010F03FCC7FC010115E0D9000F01FC +C8FC3C4F7CB543>I<EB3FF0B5FCA51203C6FCB3A4EE1FFC93B512C0030314F0030F8092 +391FE07FFC92393F001FFE037C8003F07FDAF1E081ECF3C0DAF7807F8502FFC7FC5CA25C +A45CB3ACB6D8F807B612C0A542537BD24B>I<137F497E000313E0487FA2487FA76C5BA2 +6C5BC613806DC7FC90C8FCADEB3FF0B5FCA512017EB3B3A6B612E0A51B547BD325>I<EB +3FF0B5FCA512017EB3B3B3B1B612F0A51C537BD225>108 D<D93FF0D91FFCEDFFE0B591 +B500C0010713FE030302F0011F6D7E030F6E017F8092271FE07FFCD9FF037F922A3F001F +FE01F8007F0003027C9126FF03E080C602F06DD90780137FDAF1E0038FC77FDAF3C0159E +DAF7806D01BC143F07FC8102FFC75C4A5EA24A5EA44A5EB3ACB6D8F807B6D8C03FB512FE +A567367BB570>I<D93FF0EB1FFCB591B512C0030314F0030F8092391FE07FFC92393F00 +1FFE0003027C80C602F07FDAF1E081ECF3C0DAF7807F8502FFC7FC5CA25CA45CB3ACB6D8 +F807B612C0A542367BB54B>I<913801FFE0021F13FE91B612C0010315F0010F9038807F +FC903A1FFC000FFED97FF86D6C7E49486D7F48496D7F48496D7F4A147F48834890C86C7E +A24883A248486F7EA3007F1880A400FF18C0AC007F1880A3003F18006D5DA26C5FA26C5F +6E147F6C5F6C6D4A5A6C6D495B6C6D495B6D6C495BD93FFE011F90C7FC903A0FFF807FFC +6D90B55A010015C0023F91C8FC020113E03A387CB643>I<903A3FF001FFE0B5010F13FE +033FEBFFC092B612F002F301017F913AF7F8007FFE0003D9FFE0EB1FFFC602806D7F92C7 +6C7F4A824A6E7F4A6E7FA2717FA285187F85A4721380AC1A0060A36118FFA2615F616E4A +5BA26E4A5B6E4A5B6F495B6F4990C7FC03F0EBFFFC9126FBFE075B02F8B612E06F148003 +1F01FCC8FC030313C092CBFCB1B612F8A5414D7BB54B>I<90397FE003FEB590380FFF80 +033F13E04B13F09238FE1FF89139E1F83FFC0003D9E3E013FEC6ECC07FECE78014EF1500 +14EE02FEEB3FFC5CEE1FF8EE0FF04A90C7FCA55CB3AAB612FCA52F367CB537>114 +D<903903FFF00F013FEBFE1F90B7FC120348EB003FD80FF81307D81FE0130148487F4980 +127F90C87EA24881A27FA27F01F091C7FC13FCEBFFC06C13FF15F86C14FF16C06C15F06C +816C816C81C681013F1580010F15C01300020714E0EC003F030713F015010078EC007F00 +F8153F161F7E160FA27E17E07E6D141F17C07F6DEC3F8001F8EC7F0001FEEB01FE9039FF +C00FFC6DB55AD8FC1F14E0D8F807148048C601F8C7FC2C387CB635>I<143EA6147EA414 +FEA21301A313031307A2130F131F133F13FF5A000F90B6FCB8FCA426003FFEC8FCB3A9EE +07C0AB011FEC0F8080A26DEC1F0015806DEBC03E6DEBF0FC6DEBFFF86D6C5B021F5B0203 +13802A4D7ECB34>I<D93FF8913801FFC0B50207B5FCA50003ED001FC61607B3AE5FA35F +A2017F5D173B177B6D6C14F3DC01E313F06D6CD907C3EBFFC0903A0FFFC03F836D90B512 +03010114FE6D6C13F8020701E091C7FC42377BB54B>I<B600F00107B5FCA5000101F8C8 +EA7FE06C6DED3F00A2017F163E6E157E013F167C6E15FC6D5E6F13016D5E8117036D5E6F +13076D5E6F130F6D5E6F131F6D93C7FC815F6E6C133E177E023F147C6F13FC6E5C16816E +5C16C3A26EEBE3E016E76E5C16FF6E5CA26E91C8FCA26F5AA36F5AA26F5AA26F5AA26F5A +6F5A40367DB447>I<B6D8E07FB5D8C003B512C0A5000101F0C701F0C7381FF8006E027F +ED07E06C715DA26E023F150F017F705DA26E181F013F4B6C92C7FC6E606D70143E94B5FC +6F177E6D4A6E137C03C001F315FC6D715B160303E001E114016D020702E05B03F013C06D +71485A160F03F8D9807F13076D05F85B93381F003F03FC160F027F4902FC5BDBFE3E011F +131F023F04FE90C8FC167EDBFF7C010F5B6E01FCECFF3E4C6D137E6E5FA24C7F6E5F4C7F +6E5FA24C7F6E5F4C147FA26E5F93C8123F6F5EA2033E6FC9FC5A367DB461>I<007FB500 +F090387FFFFEA5C66C48C7000F90C7FC6D6CEC07F86D6D5C6D6D495A6D4B5A6F495A6D6D +91C8FC6D6D137E6D6D5B91387FFE014C5A6E6C485A6EEB8FE06EEBCFC06EEBFF806E91C9 +FCA26E5B6E5B6F7E6F7EA26F7F834B7F4B7F92B5FCDA01FD7F03F87F4A486C7E4A486C7E +020F7FDA1FC0804A486C7F4A486C7F02FE6D7F4A6D7F495A49486D7F01076F7E49486E7E +49486E7FEBFFF0B500FE49B612C0A542357EB447>I<B600F00107B5FCA5C601F8C8EA7F +E06EED3F00A26D6C153E187E013F167C6E15FC6D5E6F13016D5E6F13036D5E8117076D6D +5C170F6D6D5C171F6D93C7FC6F5B027F143E6F137E023F147C6F13FCA26E6D5A16816EEB +C1F016C36E5C16E76E5C16FF6E5CA26E91C8FCA36F5AA26F5AA26F5AA26F5AA26F5AA35E +150F5E151F93C9FC5DD81FC0133E486C137E486C137C486C13FC5D14015D14034A5A6C48 +485A49485A263FC07FCAFCEB81FE6CB45A6C13F000035BC690CBFC404D7DB447>I +E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fl cmr10 10.95 83 +/Fl 83 124 df<4AB4EB0FE0021F9038E03FFC913A7F00F8FC1ED901FC90383FF03FD907 +F090397FE07F80494801FF13FF4948485BD93F805C137F0200ED7F00EF003E01FE6D91C7 +FC82ADB97EA3C648C76CC8FCB3AE486C4A7E007FD9FC3FEBFF80A339407FBF35>11 +D<4AB4FC021F13C091387F01F0903901FC0078D907F0131C4948133E494813FF49485A13 +7F1400A213FE6F5A163893C7FCAA167FB8FCA33900FE00018182B3AC486CECFF80007FD9 +FC3F13FEA32F407FBF33>I<4AB47E021F13F791387F00FFEB01F8903807F001EB0FE0EB +1FC0EB3F80137F14008101FE80AEB8FCA3C648C77EB3AE486CECFF80007FD9FC3F13FEA3 +2F407FBF33>I<001E130F397F803FC000FF137F01C013E0A201E013F0A3007F133F391E +600F3000001300A401E01370491360A3000114E04913C00003130101001380481303000E +EB070048130E0018130C0038131C003013181C1C7DBE2D>34 D<14E0A4EB07FC90383FFF +8090B512E03901F8E3F03903E0E0FCD807C0133CD80F807FD81F007F003E80003C158000 +7C140316C00078141F00F8143F157FA47EED3F806CEC0E0092C7FC127F138013C0EA3FF0 +13FEEA1FFF6C13FC6C13FF6C14C06C806C6C13F8011F7F130301007FECE7FF14E102E013 +80157F153FED1FC0A2003E140F127FD8FF801307A5130000FC158000F0140F1270007815 +005D6C141E153E6C5C6C5C3907C0E1F03903F8EFE0C6B51280D93FFEC7FCEB0FF8EB00E0 +A422497BC32D>36 D<013F4C7ED9FFC04B7E2601E0E015072607C070150F48486C4B5A02 +3E4BC7FC48486C5D48D90FC0EB01FE003ED90EF0EB07FCDA0F3F133E007E903A070FFFF8 +F8007C0200EBC1F0EE000300FC6D6C495A604D5A171F95C8FC173E177E177C5F16015F00 +7C4948485A1607007E5E003E49495A020E131F003F93C9FC6C49133E260F803C137E0238 +137C6C6C485B3901E0E0016CB448485AD93F0049133F90C74848EBFFC0030F903801E0E0 +93398007C0704B4848487E4B153C033E90381F001C4B497F03FC133E4B150F4A48017E7F +0203147C5D4A4801FCEB0380140F5D4AC7FC5C143E5C14FC5C495A13034948027CEB0700 +5C4948147E011F033E5B91C8140E013E153F017E6F5B017C92380F803C4917380001706C +5A49923801E0E0496FB45A6C48043FC7FC41497BC34C>I<EC0FC0EC3FF0ECF878903801 +F01CEB03E049487E130FEC800F011F7FA2EB3F00A5EC800EA25DA25DA25D6D6C5AECC1C0 +A2ECC38002E7C7387FFFFCEB0FEE14FC4A020713C06D48913801FE006E5DEF00F06D7E4D +5A496C5D010F1503D91DFF4A5A013893C7FC496C6C5B01E0150E48486C6C131E00036E13 +1C2607801F143C000F6E5B001F6D6C1370263F000714F06F485A48D903FE5B913801FF03 +486D495A0487C8FCED7FCFED3FFE6F4814386D6D5AA2007F6E6C14786D6D6C14704B6C14 +F06C6C496C6C13E0001F91393E3FC0016C6C903AFC1FF003C03D07FC07F007FC1F800001 +B5D8C001B512006C6C90C7EA7FFCD90FF8EC0FF03E437CC047>I<121EEA7F8012FF13C0 +A213E0A3127FEA1E601200A413E013C0A312011380120313005A120E5A1218123812300B +1C79BE19>I<1430147014E0EB01C0EB03801307EB0F00131E133E133C5B13F85B12015B +1203A2485AA2120F5BA2121F90C7FCA25AA3123E127EA6127C12FCB2127C127EA6123E12 +3FA37EA27F120FA27F1207A26C7EA212017F12007F13787F133E131E7FEB07801303EB01 +C0EB00E014701430145A77C323>I<12C07E12707E7E121E7E6C7E7F12036C7E7F12007F +1378137CA27FA2133F7FA21480130FA214C0A3130714E0A6130314F0B214E01307A614C0 +130FA31480A2131F1400A25B133EA25BA2137813F85B12015B485A12075B48C7FC121E12 +1C5A5A5A5A145A7BC323>I<EB03C0A2805CA600F0140F00FC143F00FE147F00FF14FF39 +3FC3C3FC390FE187F03903F18FC03900FDBF00EB3FFCEB0FF0EB03C0EB0FF0EB3FFCEBFD +BF3903F18FC0390FE187F0393FC3C3FC39FF03C0FF00FE147F00FC143F00F0140F000014 +00A6805CA220277AC32D>I<121EEA7F8012FF13C0A213E0A3127FEA1E601200A413E013 +C0A312011380120313005A120E5A1218123812300B1C798919>44 +D<B512FEA617067F961E>I<121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A0A798919>I<ED +0180ED03C01507A21680150FA216005DA2151E153EA2153C157CA2157815F8A25D1401A2 +5D1403A25D1407A25D140FA24AC7FCA2141E143EA2143C147CA2147814F8A25C1301A25C +1303A25C1307A25C130FA291C8FC5BA2131E133EA25BA2137813F8A25B1201A25B1203A2 +5B1207A25B120FA290C9FC5AA2121E123EA2123C127CA2127812F8A25A1260225B7BC32D +>I<EB01FE90380FFFC090383F03F090387C00F849137C48487F48487F4848EB0F80A200 +0F15C04848EB07E0A3003F15F0A290C712034815F8A64815FCB3A26C15F8A56C6CEB07F0 +A3001F15E0A36C6CEB0FC0A26C6CEB1F80000315006C6C133E6C6C5B017C5B90383F03F0 +90380FFFC0D901FEC7FC263F7DBC2D>I<EB01C013031307131F137FEA07FFB5FC139FEA +F81F1200B3B3ACEB7FF0B612F8A31D3D78BC2D>I<EB07FC90383FFF8090B512E03903F0 +1FF83907C007FC390F0001FE001E6D7E001C1580003CEC7FC05AED3FE01270B4FC6DEB1F +F07FA56C5A6CC7FC120CC813E0153FA216C0157F168015FF16004A5A5D4A5A4A5A5D4A5A +4A5A4AC7FC147E147C5C495A495A495A495A49C71270133E133C5B4914E0485A485A485A +48C7120148B6FCA25A4815C0B7FCA3243D7CBC2D>I<EB07FC90383FFF809038F80FE039 +01E003F839078001FCD80F007F000E6D7E001E1580D81F80137F486C14C07FA27F5BA212 +1F6C5AC8138015FF1600A24A5AA24A5A5DEC07E04A5A023FC7FCEB1FFCECFF809038000F +E0EC07F86E7E6E7E6E7E1680ED7FC0A216E0153FA216F0A2120C123F487E487EA316E0A2 +49137F6CC713C01278EDFF807E6C4913006C495A3907C007FC3903F80FF0C6B55A013F13 +80D907F8C7FC243F7CBC2D>I<150E151E153EA2157EA215FE1401A21403EC077E140614 +0E141CA214381470A214E0EB01C0A2EB0380EB0700A2130E5BA25B5BA25B5B1201485A90 +C7FC5A120E120C121C5AA25A5AB8FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD2D>I<0006 +1403D80780131F01F813FE90B5FC5D5D5D15C092C7FC14FCEB3FE090C9FCACEB01FE9038 +0FFF8090383E03E090387001F8496C7E49137E497F90C713800006141FC813C0A216E015 +0FA316F0A3120C127F7F12FFA416E090C7121F12FC007015C012780038EC3F80123C6CEC +7F00001F14FE6C6C485A6C6C485A3903F80FE0C6B55A013F90C7FCEB07F8243F7CBC2D> +I<EC1FE0ECFFF8903803F03E90380FC00F90391F000780133E017EEB1FC049133F484813 +7F12035B12074848EB3F80ED1F00001F91C7FC5BA2123FA3485AA214FE903887FF8039FF +8F07E090389C01F09038B800FC01B0137E13F0497F16804914C0A2ED1FE0A34914F0A512 +7FA6123F6D14E0A2121FED3FC0A26C6C1480A20007EC7F006C6C137E6C6C5B6C6C485A90 +387E07F06DB45A010F1380D903FCC7FC243F7CBC2D>I<1238123C123F90B612FCA316F8 +5A16F016E00078C712010070EC03C0ED078016005D48141E151C153C5DC8127015F04A5A +5D14034A5A92C7FC5C141EA25CA2147C147814F8A213015C1303A31307A3130F5CA2131F +A6133FAA6D5A0107C8FC26407BBD2D>I<EB03FC90381FFF8090387C07E09038F001F839 +01E0007C48487F48487F48C7FCED0F80121E16C0003E1407A4123FA26DEB0F807F6C6C13 +1F6D140001FC133E6C6C5B9038FF80786C6D5A6CEBF3E06CEBFF806C91C7FC133F6D13C0 +6D7F013F13F801787F48486C7E3903E01FFF48486C1380260F800313C048487E48903800 +7FE0003E143F007E141F007CEC0FF01507481403A31501A46C15E0007C1403A2007E15C0 +6C14076CEC0F806DEB1F006C6C133ED807F05B3901FC03F86CB512E0011F1380D903FCC7 +FC243F7CBC2D>I<EB03FCEB1FFF90387E07C09038FC03F048486C7E48486C7E4848137C +000F147E4848137F81003F15805B007F15C0A2151F12FF16E0A516F0A5127F153FA36C7E +A2001F147F120F6C6C13FF6D13DF000313013900F8039F90387E0F1FD91FFE13E0EB07F0 +90C7FCA2ED3FC0A41680157FD80F801400487E486C13FEA24A5A5D49485AEB8007391E00 +0FE0001F495A260FC07FC7FC3803FFFE6C13F838003FC0243F7CBC2D>I<121EEA7F80A2 +EAFFC0A4EA7F80A2EA1E00C7FCB3121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A2779A619 +>I<121EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FCB3121E127FEAFF80A213C0A4127F12 +1E1200A412011380A3120313005A1206120E120C121C5A1230A20A3979A619>I<EB1FF8 +90B5FC3903E01FC0390F0007F0001EEB03F848EB01FC4814FE140000FE14FF7E7FA46CC7 +FC123EC7EA01FEA2EC03FCEC07F815F0EC0FC0EC1F80EC3F00143E5C147814F85C13015C +A2495AA25CAB91C7FC90C8FCA8EB0780EB1FE0A2497EA46D5AA2EB078020407BBF2B>63 +D<15074B7EA34B7EA34B7EA34B7EA34B7E15E7A2913801C7FC15C3A291380381FEA34AC6 +7EA3020E6D7EA34A6D7EA34A6D7EA34A6D7EA34A6D7EA349486D7E91B6FCA24981913880 +0001A249C87EA24982010E157FA2011E82011C153FA2013C820138151FA2017882170F13 +FC00034C7ED80FFF4B7EB500F0010FB512F8A33D417DC044>65 D<B712FCEEFF8017F000 +01903980000FF86C6CC7EA03FE707E701380EF7FC0EF3FE0A2EF1FF0A218F8A3170F171F +A318F0A2EF3FE0177F18C0EFFF804C1300EE03FCEE0FF8EE7FE091B6C7FC17E091C7EA07 +FCEE01FE933800FF80EF7FC0EF3FE0EF1FF018F8170F18FC1707A218FEA718FC170FA2EF +1FF818F0173FEF7FE0EFFFC00403138048486C90380FFE00B85A17E094C7FC373E7DBD40 +>I<DB3FF01306912603FFFE130E020F9038FF801E913A3FF007E03E9139FF8000F8D903 +FEC7EA7C7ED907F8EC1EFE4948140FD93FE0140749481403495A91C81201484815001203 +4848167E5B000F173EA24848161EA2123F5B180E127FA349160012FFAC127F7F180EA212 +3FA27F001F171E181C6C7EA20007173C6D16386C6C1678000117706C6C16F06EEC01E06D +6C15C06D6C1403D90FF0EC07806D6CEC1F00D903FE143E902600FF8013F891393FF007F0 +020FB512C0020391C7FC9138003FF037427BBF42>I<B712FCEEFF8017E000019039C000 +1FF86C6C48EB03FEEE00FF717E717EEF0FE084717E717E170184717EA21980187F19C0A3 +F03FE0A519F0AB19E0A5F07FC0A21980A218FF19004D5AA24D5A6017074D5A4D5AEF7FC0 +4DC7FCEE03FE48486CEB1FF8B85A178004FCC8FC3C3E7DBD45>I<B912E0A300019038C0 +00016C6C48EB001FEF0FF01703A217011700A31870A41838161CA41800A2163CA2167C16 +FC150391B5FCA3EC80031500167C163CA2161CA21807A3180E93C7FCA4181E181CA2183C +A2187CA218F8170117031707171F48486CEB01FFB912F0A3383E7DBD3E>I<B91280A300 +019038C000036C6C48EB007FEF1FC0170F1707A21703A31701A4EF00E0A21638A31800A3 +1678A216F81501150791B5FCA3EC8007150115001678A21638A693C8FCAF3801FFE0B612 +F0A3333E7DBD3B>I<DB3FE0130C912603FFFE131C021F9038FF803C913A7FF00FC07C91 +39FF0001F0D903FC90380078FC4948143DD91FE0141F4948140F4948140701FF15034890 +C8FC491501485A000716005B000F177C5B001F173CA2485AA2181C127FA25B95C7FC12FF +AB041FB512F0127FA26D9139000FFE00EF03FC123FA27F121FA26C7EA212077F12036C7E +7F6C7F6D6C14076D7E6D6C140FD907F8141ED903FEEC3C7C902600FF80EBF83C913A7FF0 +07F01C021FB5EAC00C020391C8FC9138003FF03C427BBF47>I<B6D8C01FB512F8A30001 +01E0C7383FFC0026007F80EC0FF0B3A691B7FCA30280C7120FB3A92601FFE0EC3FFCB6D8 +C01FB512F8A33D3E7DBD44>I<B612F0A3C6EBF000EB3FC0B3B3B2EBFFF0B612F0A31C3E +7EBD21>I<011FB512FCA3D9000713006E5A1401B3B3A6123FEA7F80EAFFC0A44A5A1380 +D87F005B007C130700385C003C495A6C495A6C495A2603E07EC7FC3800FFF8EB3FC02640 +7CBD2F>I<B600C090387FFFFCA3000101E0C7000F138026007F80913807FE0018F818E0 +604D5A4DC7FC173E5F5F4C5A4C5A4C5A4C5A4CC8FC163E5E5E4B5A4B5AED07804B7E151F +4B7E4B7E15FF913881EFF8913883C7FCEC878791388F03FE91389E01FF14BCDAF8007F4A +6D7E5C4A6D7E4A6D7EA2707E707EA2707E707EA2707F717E84173F717E717EA2717E8484 +19802601FFE04A13C0B600C090B6FCA3403E7DBD47>I<B612F8A3000101E0C9FC38007F +80B3B0EF0380A517071800A45FA35FA25F5F5F4C5A160748486C133FB8FCA3313E7DBD39 +>I<B500C093383FFFF0A300016D93387FF800D8007F18E0D977F016EFA3D973F8ED01CF +A2D971FCED038FA3D970FEED070FA26E150E80A26E6C141CA36E6C1438A26E6C1470A36E +6C14E0A26E6CEB01C0A36E6CEB0380A36E6CEB0700A2037F130EA36F6C5AA26F6C5AA36F +6C5AA25FED07F0A2923803F9C0A36FB45AA26F90C7FCA213F8486C147ED807FFEF3FF8B5 +00F8013C011FB512F0A34C3E7DBD53>I<B56C91B512F88080D8007F030713006EEC01FC +6E6E5A1870EB77FCEB73FEA2EB71FF01707FA26E7E6E7EA26E7E6E7EA26E7E6E7EA26E7E +6E7FA26F7E6F7EA26F7E6F7EA26F7E6F7EA26F7E6F1380A2EE7FC0EE3FE0A2EE1FF0EE0F +F8A2EE07FCEE03FEA2EE01FF7013F0A2177F173FA2171F170FA2170701F81503487ED807 +FF1501B500F81400A218703D3E7DBD44>I<ED7FE0913807FFFE91391FC03F8091397E00 +07E04948EB03F8D907F0EB00FE4948147F49486E7E49486E7E49C86C7E01FE6F7E000183 +49150300038348486F7EA248486F7EA2001F188049167F003F18C0A3007F18E049163FA3 +00FF18F0AC007F18E06D167FA4003F18C0A26C6CEEFF80A36C6C4B1300A26C6C4B5A0003 +5F6D150700015F6C6C4B5A6D5E6D6C4A5A6D6C4A5A6D6C4AC7FC6D6C14FED901FCEB03F8 +D9007FEB0FE091391FC03F80912607FFFEC8FC9138007FE03C427BBF47>I<B712F8EEFF +8017E000019039C0003FF86C6C48EB07FCEE01FE707EEF7F80EF3FC018E0A2EF1FF0A218 +F8A818F0A2EF3FE0A218C0EF7F80EFFF004C5AEE07FCEE3FF091B612C04CC7FC0280C9FC +B3A73801FFE0B612C0A3353E7DBD3E>I<B712C016FCEEFF800001D9C00013E06C6C48EB +1FF0EE07FCEE01FE707E84717EA2717EA284A760177F606017FF95C7FCEE01FCEE07F8EE +1FE0EEFF8091B500FCC8FC16F091388001FCED003FEE1FC0707E707E83160383160183A3 +83A484A4F0C004190EA28218E0057F131E2601FFE0161CB600C0EB3FF094381FF8380507 +1370CA3801FFE09438003F803F407DBD43>82 D<D907FC130C90391FFF801C017FEBF03C +3901FC03F83A03F0007E7CD807C0EB1FFC4848130F001F140748C71203003E1401007E14 +00A2007C157C12FCA2163CA36C151CA27EA26C6C14007F7FEA3FF8EBFF806C13F86CEBFF +806C14F06C14FC6C14FF6C15C0013F14E0010714F0EB007F020713F89138007FFC150FED +07FE15031501ED00FFA200E0157FA3163FA27EA3163E7E167E6C157C6C15FC6C15F86D13 +016DEB03F06DEB07E0D8F9FCEB0FC03AF07F803F8090391FFFFE00D8E00713F839C0007F +C028427BBF33>I<003FB91280A3903AF0007FE001018090393FC0003F48C7ED1FC0007E +1707127C00781703A300701701A548EF00E0A5C81600B3B14B7E4B7E0107B612FEA33B3D +7DBC42>I<B600C090B512F8A3000101E0C70007130026007F80EC01FC715A1870B3B3A4 +013F16F06E5DA21701011F5E80010F15036E4A5A010793C7FC6D6C5C6D6C141E6D6C5C02 +7F14F86E6C485A91390FF00FE00203B51280020049C8FCED1FF03D407DBD44>I<B69138 +0FFFFEA3000301E0020113E06C01809138007F806CEF3F00017F163E181C6E153C013F16 +38A26E1578011F1670A26D6C5DA26E140101075EA26E140301035EA26D6C4AC7FCA2806D +150EA26F131E027F141CA26F133C023F1438A26E6C5BA26F13F0020F5CA2EDF80102075C +A26E6C485AA2EDFE07020191C8FCA26F5A6E130EA2ED7F9CA216DCED3FF8A36F5AA36F5A +A26F5AA36F5A3F407EBD44>I<B500FE017FB5D88007B5FCA3000301C0010101E0C713F8 +6C90C849EC3FE07148EC0F807E7215006E143F017F190E84A26D6C60A24D7E6D6C60A2EF +E7F86D6C60A2933801C3FC6E18F001076104037F6E0281140101036104077F17006D6C4D +5AA2040EEB7F806D6C4DC7FCA24CEB3FC0DA7F80160EA24CEB1FE003C0161E023F171C04 +7814F0DBE070010F133C021F173804F014F84C1307DA0FF05EA2DBF1C0EB03FCDA07F95E +A2DBFB80EB01FEDA03FF6F5AA293C8FCA26E5FA24B157F020094C8FCA24B81037C153EA2 +0378151E0338151C58407EBD5D>I<B66C0103B51280A3000101F0C8EBF8006C6C48ED3F +C0725A013F041EC7FC6D7E606D6C15386D6C1578606D6C5D6E14016D5E6D6D1303606E6C +49C8FC6E6C5B170E6E6C131E171C6E6C5B6E6C137817706E6C13F06F5B6E13016EEB83C0 +5FED7FC7DB3FE7C9FC16EFED1FFE5E150F6F5AB3A4ED1FFC020FB512FCA3413E7FBD44> +89 D<003FB712F8A391C7EA1FF013F801E0EC3FE00180EC7FC090C8FC003EEDFF80A200 +3C4A1300007C4A5A12784B5A4B5AA200704A5AA24B5A4B5AA2C8485A4A90C7FCA24A5A4A +5AA24A5AA24A5A4A5AA24A5A4A5AA24990C8FCA2495A4948141CA2495A495AA2495A495A +173C495AA24890C8FC485A1778485A484815F8A24848140116034848140F4848143FED01 +FFB8FCA32E3E7BBD38>I<EAFFFCA4EAF000B3B3B3B3ABEAFFFCA40E5B77C319>I<486C13 +C00003130101001380481303000EEB070048130E0018130C0038131C0030131800701338 +00601330A300E01370481360A400CFEB678039FFC07FE001E013F0A3007F133FA2003F13 +1F01C013E0390F0007801C1C73BE2D>I<EAFFFCA4EA003CB3B3B3B3ABEAFFFCA40E5B7F +C319>I<EA0180120313005A120E5A12181238123012701260A312E05AA412CFEAFFC013 +E0A3127FA2123F13C0EA0F000B1C7ABE19>96 D<EB0FF8EBFFFE3903F01F8039078007E0 +000F6D7E9038E001F8D81FF07F6E7EA3157F6C5AEA0380C8FCA4EC1FFF0103B5FC90381F +F87FEB7F803801FC00EA07F8EA0FE0485A485AA248C7FCEE038012FEA315FFA3007F5BEC +03BF3B3F80071F8700261FC00E13CF3A07F03C0FFE3A01FFF807FC3A003FC001F0292A7D +A82D>I<EA01FC12FFA3120712031201B1EC03FC91381FFF8091387C07E09039FDE001F0 +9039FFC000FC4A137E91C77E49158049141F17C0EE0FE0A217F0A2160717F8AA17F0A216 +0FA217E0161F17C06D1580EE3F006D5C6E13FE9039F3C001F89039F1E003F09039E0780F +C09026C03FFFC7FCC7EA07F82D407EBE33>I<49B4FC010F13E090383F00F8017C131E48 +48131F4848137F0007ECFF80485A5B121FA24848EB7F00151C007F91C7FCA290C9FC5AAB +6C7EA3003FEC01C07F001F140316806C6C13076C6C14000003140E6C6C131E6C6C137890 +383F01F090380FFFC0D901FEC7FC222A7DA828>I<ED01FC15FFA3150715031501B114FF +010713E190381F80F990387E003D49131FD803F81307485A49130348481301121F123F5B +127FA290C7FCA25AAA7E7FA2123FA26C7E000F14037F000714076C6C497E6C6C497ED800 +7C017913F890383F01F190380FFFC1903A01FE01FC002D407DBE33>I<EB01FE90380FFF +C090383F03F09038FC01F848486C7E4848137E48487F000F158049131F001F15C0484813 +0FA2127F16E090C7FCA25AA290B6FCA290C9FCA67EA27F123F16E06C7E1501000F15C06C +6C13036DEB07806C6C1400C66C131E017E5B90381F80F8903807FFE0010090C7FC232A7E +A828>I<EC1FC0EC7FF8903801F83C903807E07E90380FC0FFEB1FC1EB3F811401137FEC +00FE01FE137C1500AEB6FCA3C648C7FCB3AE487E007F13FFA320407EBF1C>I<167C9039 +03F801FF903A1FFF078F8090397E0FDE1F9038F803F83803F001A23B07E000FC0600000F +6EC7FC49137E001F147FA8000F147E6D13FE00075C6C6C485AA23901F803E03903FE0FC0 +26071FFFC8FCEB03F80006CAFC120EA3120FA27F7F6CB512E015FE6C6E7E6C15E06C8100 +03813A0FC0001FFC48C7EA01FE003E140048157E825A82A46C5D007C153E007E157E6C5D +6C6C495A6C6C495AD803F0EB0FC0D800FE017FC7FC90383FFFFC010313C0293D7EA82D> +I<EA01FC12FFA3120712031201B1EC01FE913807FFC091381E07E091387803F09138E001 +F8D9FDC07F148001FF6D7E91C7FCA25BA25BB3A6486C497EB5D8F87F13FCA32E3F7DBE33 +>I<EA01E0EA07F8A2487EA46C5AA2EA01E0C8FCACEA01FC127FA3120712031201B3AC48 +7EB512F0A3143E7DBD1A>I<1478EB01FEA2EB03FFA4EB01FEA2EB00781400AC147FEB7F +FFA313017F147FB3B3A5123E127F38FF807E14FEA214FCEB81F8EA7F01387C03F0381E07 +C0380FFF803801FC00185185BD1C>I<EA01FC12FFA3120712031201B292B51280A39238 +3FFC0016E0168093C7FC153C5D5D4A5AEC07C04A5A4AC8FC143E147F4A7E13FD9038FFDF +C0EC9FE0140F496C7E01FC7F496C7E1401816E7E81826F7E151F826F7EA282486C14FEB5 +39F07FFFE0A32B3F7EBE30>I<EA01FC12FFA3120712031201B3B3B1487EB512F8A3153F +7DBE1A>I<2701F801FE14FF00FF902707FFC00313E0913B1E07E00F03F0913B7803F03C +01F80007903BE001F87000FC2603F9C06D487F000101805C01FBD900FF147F91C75B13FF +4992C7FCA2495CB3A6486C496CECFF80B5D8F87FD9FC3F13FEA347287DA74C>I<3901F8 +01FE00FF903807FFC091381E07E091387803F000079038E001F82603F9C07F0001138001 +FB6D7E91C7FC13FF5BA25BB3A6486C497EB5D8F87F13FCA32E287DA733>I<14FF010713 +E090381F81F890387E007E01F8131F4848EB0F804848EB07C04848EB03E0000F15F04848 +EB01F8A2003F15FCA248C812FEA44815FFA96C15FEA36C6CEB01FCA3001F15F86C6CEB03 +F0A26C6CEB07E06C6CEB0FC06C6CEB1F80D8007EEB7E0090383F81FC90380FFFF0010090 +C7FC282A7EA82D>I<3901FC03FC00FF90381FFF8091387C0FE09039FDE003F03A07FFC0 +01FC6C496C7E6C90C7127F49EC3F805BEE1FC017E0A2EE0FF0A3EE07F8AAEE0FF0A4EE1F +E0A2EE3FC06D1580EE7F007F6E13FE9138C001F89039FDE007F09039FC780FC0DA3FFFC7 +FCEC07F891C9FCAD487EB512F8A32D3A7EA733>I<02FF131C0107EBC03C90381F80F090 +397F00387C01FC131CD803F8130E4848EB0FFC150748481303121F485A1501485AA448C7 +FCAA6C7EA36C7EA2001F14036C7E15076C6C130F6C7E6C6C133DD8007E137990383F81F1 +90380FFFC1903801FE0190C7FCAD4B7E92B512F8A32D3A7DA730>I<3901F807E000FFEB +1FF8EC787CECE1FE3807F9C100031381EA01FB1401EC00FC01FF1330491300A35BB3A548 +7EB512FEA31F287EA724>I<90383FC0603901FFF8E03807C03F381F000F003E1307003C +1303127C0078130112F81400A27E7E7E6D1300EA7FF8EBFFC06C13F86C13FE6C7F6C1480 +000114C0D8003F13E0010313F0EB001FEC0FF800E01303A214017E1400A27E15F07E1401 +6C14E06CEB03C0903880078039F3E01F0038E0FFFC38C01FE01D2A7DA824>I<131CA613 +3CA4137CA213FCA2120112031207001FB512C0B6FCA2D801FCC7FCB3A215E0A912009038 +FE01C0A2EB7F03013F138090381F8700EB07FEEB01F81B397EB723>I<D801FC14FE00FF +147FA3000714030003140100011400B3A51501A31503120015076DEB06FF017E010E1380 +6D4913FC90381FC078903807FFE00100903880FE002E297DA733>I<B539E00FFFE0A327 +07FE000313006C48EB00FC5E00015D7F00005DA26D13016D5CA26D6C485AA2ECC007011F +91C7FCA290380FE00EA2ECF01E0107131CA26D6C5AA2ECFC7801011370A2ECFEF001005B +A2EC7FC0A36E5AA26EC8FCA3140E2B287EA630>I<B53BC3FFFE03FFF8A3290FFE003FE0 +0013C06C486D48EB3F806C4817006D010F141E00016F131C15076D163C00004A6C1338A2 +017F5E4B7E151DD93F805DED3DFC1538D91FC04A5AED78FE9238707E03D90FE0017F5BED +E03F02F0140701070387C7FC9138F1C01F02F9148F010315CE9138FB800F02FF14DE6D15 +FCED00076D5DA24A1303027E5CA2027C1301023C5C023813003D287EA642>I<B539F01F +FFE0A30003D9C00F1300C690388007F8D97F0013E002805BD93FC05B011F49C7FC90380F +E00EECF01E6D6C5A01035B6D6C5A6E5AEB00FF6E5A6E5A81141F814A7E81147BECF1FC90 +3801E1FEECC0FF01037F49486C7ED90F007F011E6D7E013E130F496D7E01FC80486C8000 +0F4A7EB539803FFFF8A32D277FA630>I<B539E00FFFE0A32707FE000313006C48EB01FC +6F5A00015D7F00005DA2017F495AA2EC8003013F5CA26D6C48C7FCA26E5A010F130EA26D +6C5AA2ECF83C01031338A26D6C5AA2ECFEF001005BA2EC7FC0A36E5AA36EC8FCA2140EA2 +141E141C143C1438A2147800181370127EB45BA2495AA248485AD87E07C9FCEA780EEA3C +3CEA1FF8EA07E02B3A7EA630>I<001FB61280A2EBE0000180140049485A001E495A121C +4A5A003C495A141F00385C4A5A147F5D4AC7FCC6485AA2495A495A130F5C495A90393FC0 +0380A2EB7F80EBFF005A5B484813071207491400485A48485BA248485B4848137F00FF49 +5A90B6FCA221277EA628>I<B812F0A22C0280982D>I E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fm cmbx12 20.736 11 +/Fm 11 115 df<137F3801FFC0000713F0487F487F487F487FA2B61280A96C1400A26C5B +6C5B6C5B6C5B000113C06C6CC7FC1919729836>46 D<EE3FFF0307B512F8033F14FF4AB7 +12E0020716F8021F16FE4AD9F8077F91B5D8C00014C04991C7003F7F4901FC020F7F4949 +6E7F49496E7F49496E7F49496E7F4B81498590B5C96C7FA24849707FA24886A248864A82 +4886A34886A448864A82A4481B80A8B51AC0B3AA6C1B80A86C1B006E5EA46C62A36C62A3 +6C6D4C5BA36C62A26C6D4C5BA26C6E4B5B6D616F92B5FC6D96C7FC6D6D4A5B6D6D4A5B6D +6D4A5B6D6D4A5B6D01FF023F5B6D02C090B55A6ED9F8075C021F90B648C8FC020716F802 +0116E06E6C1580030702F8C9FCDB003F90CAFC527379F061>48 D<93B57E031F14FC92B7 +7E020316F0020F16FC023F16FF4A8349B5D8800314E04901F8C7003F7F4901C0020F7F49 +90C800037FD91FFC6F7F49486F6C7E137F4A7013804948827313C05A4A821BE05AA28548 +7FA38080806E5E8003C017C08103F85D03FE17806F6C5C6C6F160004F05C04FC4A5A6C6F +5D706C13FFDDE0015B6CDCF8035BDDFC0F13C06DDBFF1F5B6D93B5C7FC19FC6D17F06D5F +6D17806D17E06D836D6C16FC6E16FF020F836E17E06E83020F83023F8391B97E49840107 +01F0178049D9C07F16C0013FD9801F16E049EB00074948010116F048497F4849023F15F8 +4849140F4A6E15FC48160148496E6C14FE4A151F488391C9120348050014FF193F498385 +00FF84854983A28586A3861BFEA27FA2007F1AFC7F1A7F1BF86C7FF2FFF06C7F6E4C13E0 +6C6D4C13C06C6D5E6E4C13806C6D4C13006C6D6CED7FFE6C02E04A485A013F01FC020F13 +F06D9026FFC001B55A010791B712806D95C7FC010017FC021F16F002071680DA007F02FC +C8FC030191C9FC507378F061>56 D<93B5FC031F14F092B612FE02076F7E021F16E04A16 +F891B87E49DAF00713FF0107DA0001804901FC6D6C7F49496E7F49496E7F49496E7F90B5 +486E7F484A8048854891C86C7FA2487114805C481AC0A2487213E0A2484918F0A31BF8A2 +B5FCA27313FCA51BFEA71BFF61A27EA396B6FC7EA2806C5FA27E606C7F607E6C6E5C6CEF +1FBF6D6DEC3F3F6D6D147F6D6D14FE6D6DEB01FC6D01FE130701019039FFC01FF86D91B5 +00F014FE023F15C06E15800203ECFE00DA007F13F8030713C092C9FC4F13FCA41BF8A31B +F0D91FF093B5FCEB7FFC496C18E0487F486E17C06048801B804E1400A26260624E5B4B5C +626C91C8485B4A4B5B4A92B55A6C01F04A91C7FC02804A5B6C01E0020F5B6D6C023F13F0 +02FE91B55A90273FFFE00F5C6D90B7C8FC010716FC6D16F0010016C0023F92C9FC020714 +F09126007FFECAFC507378F061>I<92383FFFF80207B612E0027F15FC49B87E010717E0 +011F83499026F0007F13FC4948C7000F7F90B502036D7E486E6D806F6D80727F486E6E7F +8486727FA28684A26C5C72806C5C6D90C8FC6D5AEB0FF8EB03E090CAFCA70507B6FC041F +B7FC0303B8FC157F0203B9FC021FECFE0391B612800103ECF800010F14C04991C7FC017F +13FC90B512F04814C0485C4891C8FC485B5A485B5C5A5CA2B5FC5CA360A36E5DA26C5F6E +5D187E6C6D846E4A48806C6D4A4814FC6C6ED90FF0ECFFFC6C02E090263FE07F14FE0001 +9139FC03FFC06C91B6487E013F4B487E010F4B1307010303F01301D9003F0280D9003F13 +FC020101F8CBFC57507ACE5E>97 D<903801FFFCB6FCA8C67E131F7FB3ADF0FFFC050FEB +FFE0057F14FE0403B77E040F16E0043F16F84CD9007F13FE9226FDFFF001077F92B500C0 +01018094C86C13E004FC6F7F4C6F7F04E06F7F4C6F7F5E747F93C915804B7014C0A27414 +E0A21DF087A21DF8A31DFC87A41DFEAF1DFCA4631DF8A31DF098B5FC1DE0A25014C0A26F +1980501400705D705F704B5B505B704B5B04FC4B5BDBE7FE92B55A9226C3FF8001035C03 +8101E0011F49C7FC9226807FFC90B55A4B6CB712F04A010F16C04A010393C8FC4A010015 +F84A023F14C090C9000301F0C9FC5F797AF76C>I<93383FFFF00307B612C0033F15F84A +B712FE0207707E021F17E0027F8391B526FC001F7F010302C001037F4991C7487F49495C +495B4901F04A7F5B90B55A485CA2485C4891C8FCA248715B5C48715B725B4A6F5B489438 +007FC0071FC7FC96C8FC5AA25CA3B5FCAF7E80A47E80A27E806CF11F80F23FC06C6E167F +A26C6EEEFF80816C606C6E17006D6D4B5A6D6D15076D6D4B5A6D6D6C4A5A6D02E0EC7FF0 +6D02F849485A01009126FF801F5B6E91B6C7FC021F5E020716F8020116E06E6C15800307 +02FCC8FCDB003F13804A507ACE56>I<97380FFFE00607B6FCA8F00003190086B3AD9338 +3FFF800307B512F8033F14FF4AB712C0020716F0021F16FC027F9039FE007FFE91B500F0 +EB0FFF01030280010190B5FC4949C87E49498149498149498149498190B548814884484A +8192CAFC5AA2485BA25A5C5AA35A5CA4B5FCAF7EA4807EA37EA2807EA26C7F616C6E5D6C +606C80616D6D5D6D6D5D6D6D92B67E6D6D4A15FC010301FF0207EDFFFE6D02C0EB3FFE6D +6C9039FC01FFF86E90B65A020F16C002031600DA007F14FC030F14E09226007FFEC749C7 +FC5F797AF76C>I<93387FFF80030FB512FC037FECFF804AB712E0020716F8021F16FE02 +7FD9F8077F49B5D8C000804991C7003F13E04901FC020F7F49496E7F49498049496E7F49 +496E7F90B55A48727E92C914804884485B1BC048841BE0485BA27313F05AA25C5AA21BF8 +85A2B5FCA391BAFCA41BF002F8CCFCA67EA3807EA47E806CF103F0F207F86C7F1A0F6C6E +17F06C191F6F17E06C6E163F6D6DEE7FC06D6D16FF6D6D4B13806D6D4B13006D6D6CEC0F +FE6D02E0EC3FFC6D02F8ECFFF86D9126FFC00F5B023F91B65A020F178002034CC7FC0200 +16F8031F15E0030392C8FCDB000F13E04D507BCE58>I<93381FFFE00303B6FC031F15E0 +92B712FC020316FF020F17C0023FD9FC0014F091B500C0010F13FC4991C700037F4901FC +02007F010F496F13C049496F7F49496F7F4B8149496F7F90B5C96C7F4886A24849707F48 +1B80A248497014C0A2481BE0A348497113F0A3481BF8A5B51AFCAE6C1BF8A46C1BF06E94 +B5FCA36C1BE0A26C6D4C14C0A26C1B806E5E6C1B006C6E4B5BA26C6E4B5B6D6D4B5B6D6D +4B5B6D6D4B5B6D6D92B55A6D01FF02035C6D02C0010F91C7FC010002FC90B512FC6E90B7 +5A021F17E00207178002014CC8FCDA003F15F0030392C9FCDB001F13E056507BCE61> +111 D<902601FFF8EB07FEB691383FFFC094B512F00403804C14FE4C8093261FFC3F1380 +93263FE07F13C0DC7F80B5FCC66C5D011FDAFE0114E06DEBF9FC16F815FB16F016E015FF +16C07114C05E72138095381FFE0093C76C5AF001E095C8FCA25DA65DB3B3A2B812F8A843 +4E7ACD4F>114 D E +%EndDVIPSBitmapFont +end +%%EndProlog +%%BeginSetup +%%Feature: *Resolution 600dpi +TeXDict begin +%%PaperSize: A4 + +%%EndSetup +%%Page: 1 1 +1 0 bop 94 1385 a Fm(barco)5 b(de)65 b(0.98)p 94 1451 +3780 34 v 2617 1548 a Fl(A)31 b(library)d(for)i(dra)m(wing)f(bar)h(co)s +(des)3409 1656 y(Marc)m(h)h(2002)94 5367 y Fk(b)l(y)45 +b(Alessandro)h(Rubini)f(\()p Fj(rubini@gnu.org)p Fk(\))p +94 5446 3780 17 v eop +%%Page: 1 2 +1 1 bop 94 -116 a Fl(Chapter)30 b(2:)41 b(The)30 b(Underlying)e(Data)k +(Structure)2012 b(1)94 365 y Fi(Barco)t(de)54 b(to)t(ols)219 +549 y Fl(This)29 b(\014le)g(do)s(cumen)m(ts)h(v)m(ersion)g(0.98)i(of)e +(the)h(barco)s(de)f(library)e(and)i(sample)f(programs)h(\(Marc)m(h)i +(2002\).)94 815 y Fi(1)81 b(Ov)l(erview)219 999 y Fl(The)26 +b Fh(barco)s(de)32 b Fl(pac)m(k)-5 b(age)29 b(is)d(mainly)f(a)i(C)f +(library)f(for)h(creating)i(bar-co)s(de)f(output)f(\014les.)39 +b(It)27 b(also)f(includes)94 1099 y(a)31 b(command)f(line)f(fron)m +(t-end)h(and)g(\(in)f(a)i(foreseeable)g(future\))f(a)h(graphic)e(fron)m +(tend.)219 1215 y(The)k(pac)m(k)-5 b(age)35 b(is)d(designed)g(as)i(a)f +(library)e(b)s(ecause)i(w)m(e)h(think)e(the)h(main)g(use)f(for)h(barco) +s(de-generation)94 1315 y(to)s(ols)23 b(is)f(inside)f(more)i(featured)g +(applications.)37 b(The)22 b(library)f(addresses)h(bar)h(co)s(de)g +(prin)m(ting)e(as)i(t)m(w)m(o)i(distinct)94 1415 y(problems:)43 +b(creation)33 b(of)f(bar)g(information)e(and)i(actual)h(con)m(v)m +(ersion)f(to)h(an)f(output)g(format.)47 b(T)-8 b(o)32 +b(this)g(aim)94 1514 y(w)m(e)25 b(use)f(an)g(in)m(termediate)g +(represen)m(tation)g(for)g(bar)f(co)s(des,)j(whic)m(h)d(is)g(curren)m +(tly)g(do)s(cumen)m(ted)h(in)e(the)j(`)p Fj(ps.c)p Fl(')94 +1614 y(source)31 b(\014le)e(\(not)i(in)f(this)f(do)s(cumen)m(t\).)219 +1730 y(Note)24 b(that)e(the)h(library)d(and)h(the)i(accompan)m(ying)g +(material)e(is)h(released)g(according)g(to)h(the)f(GPL)h(license,)94 +1830 y(not)31 b(the)g(LGPL)f(one.)41 b(A)30 b(cop)m(y)h(of)g(the)g(GPL) +f(is)f(included)f(in)h(the)i(distribution)26 b(tarball.)94 +2096 y Fi(2)81 b(The)53 b(Underlying)h(Data)g(Structure)219 +2280 y Fl(Ev)m(ery)33 b(barco)s(de-related)g(function)f(acts)i(on)f(a)h +(data)f(structure)g(de\014ned)f(in)g(the)h(`)p Fj(barcode.h)p +Fl(')e(header,)94 2380 y(whic)m(h)j(m)m(ust)h(b)s(e)f(included)e(b)m(y) +j(an)m(y)g(C)g(source)g(\014le)f(that)h(uses)g(the)g(library)-8 +b(.)52 b(The)35 b(header)f(is)g(installed)f(b)m(y)94 +2480 y Fj(make)47 b(install)p Fl(.)219 2596 y(The)30 +b(de\014nition)e(of)i(the)h(data)g(structure)f(is)f(included)f(here)i +(for)g(reference:)334 2717 y Fj(struct)47 b(Barcode_Item)d({)525 +2820 y(int)j(flags;)428 b(/*)47 b(type)g(of)g(encoding)f(and)h(other)f +(flags)g(*/)525 2924 y(char)h(*ascii;)332 b(/*)47 b(malloced)f(*/)525 +3028 y(char)h(*partial;)236 b(/*)47 b(malloced)f(too)h(*/)525 +3132 y(char)g(*textinfo;)188 b(/*)47 b(information)e(about)h(text)h +(placement)e(*/)525 3236 y(char)i(*encoding;)188 b(/*)47 +b(code)g(name,)f(filled)g(by)i(encoding)d(engine)h(*/)525 +3339 y(int)h(width,)f(height;)g(/*)h(output)f(units)h(*/)525 +3443 y(int)g(xoff,)g(yoff;)189 b(/*)47 b(output)f(units)h(*/)525 +3547 y(int)g(margin;)380 b(/*)47 b(output)f(units)h(*/)525 +3651 y(double)f(scalef;)237 b(/*)47 b(requested)f(scaling)f(for)i +(barcode)f(*/)525 3754 y(int)h(error;)428 b(/*)47 b(an)h(errno-like)d +(value,)h(in)h(case)f(of)i(failure)d(*/)334 3858 y(};)219 +3975 y Fl(The)e(exact)i(meaning)e(of)g(eac)m(h)i(\014eld)d(and)h(the)g +(v)-5 b(arious)43 b(\015ags)g(implemen)m(ted)f(are)i(describ)s(ed)e(in) +g(the)94 4074 y(follo)m(wing)29 b(sections.)219 4191 +y(Ev)m(en)38 b(though)f(y)m(ou)h(w)m(on't)g(usually)d(need)i(to)h(act)h +(on)e(the)h(con)m(ten)m(ts)h(of)f(this)e(structure,)j(some)f(of)g(the) +94 4290 y(functions)25 b(in)f(the)i(library)d(receiv)m(e)k(argumen)m +(ts)e(that)i(are)f(directly)e(related)i(to)g(one)g(or)g(more)f(of)h +(these)g(\014elds.)94 4524 y Fk(2.1)69 b(The)44 b(Fields)94 +4715 y Fj(int)30 b(flags;)574 4815 y Fl(The)42 b(\015ags)g(are,)j(as)d +(y)m(ou)g(ma)m(y)g(susp)s(ect,)j(mean)m(t)d(to)h(sp)s(ecify)d(the)i +(exact)h(b)s(eha)m(viour)e(of)h(the)574 4914 y(library)-8 +b(.)37 b(They)22 b(are)h(often)h(passed)e(as)h(an)g(argumen)m(t)g(to)h +Fg(b)-5 b(ar)g(c)g(o)g(de)32 b Fl(functions)21 b(and)i(are)g(discussed) +574 5014 y(in)30 b(the)g(next)h(section.)94 5147 y Fj(char)f(*ascii;)94 +5247 y(char)g(*partial;)94 5347 y(char)g(*textinfo;)94 +5446 y(char)g(*encoding;)574 5546 y Fl(These)41 b(\014elds)f(are)h(in)m +(ternally)e(managed)i(b)m(y)g(the)h(library)-8 b(,)41 +b(and)g(y)m(ou)g(are)h(not)f(exp)s(ected)g(to)574 5645 +y(touc)m(h)31 b(them)g(if)e(y)m(ou)i(use)f(the)h(pro)m(vided)d(API.)j +(All)e(of)h(them)h(are)g(allo)s(cated)f(with)f Fg(mal)5 +b(lo)-5 b(c)p Fl(.)p eop +%%Page: 2 3 +2 2 bop 94 -116 a Fl(Chapter)30 b(2:)41 b(The)30 b(Underlying)e(Data)k +(Structure)2012 b(2)94 365 y Fj(int)30 b(width;)94 465 +y(int)g(height;)574 565 y Fl(They)i(sp)s(ecify)e(the)i(width)d(and)i +(heigh)m(t)h(of)g(the)f Fg(active)39 b Fl(barco)s(de)31 +b(region)g(\(i.e.,)i(excluding)d(the)574 664 y(white)21 +b(margin\),)i(in)d(the)i(units)e(used)h(to)h(create)i(output)d(data)h +(\(for)g(p)s(ostscript)e(they)i(are)g(p)s(oin)m(ts,)574 +764 y(1/72th)33 b(of)d(an)g(inc)m(h,)g(0.352)j(mm\).)40 +b(The)30 b(\014elds)f(can)i(b)s(e)f(either)g(assigned)f(to)j(in)d(the)h +(structure)574 863 y(or)37 b(via)e Fg(Bar)-5 b(c)g(o)g(de)p +1161 863 28 4 v 36 w(Position\(\))p Fl(,)39 b(at)e(y)m(our)f(c)m +(hoice.)59 b(If)35 b(either)h(v)-5 b(alue)35 b(or)h(b)s(oth)g(are)g +(left)g(to)h(their)574 963 y(default)c(v)-5 b(alue)33 +b(of)g(zero,)i(the)e(output)g(engine)g(will)d(assign)j(default)f(v)-5 +b(alues)33 b(according)g(to)h(the)574 1063 y(sp)s(eci\014ed)g(scaling)f +(factor.)55 b(If)35 b(the)g(sp)s(eci\014ed)e(width)g(is)h(bigger)g +(than)h(needed)f(\(according)h(to)574 1162 y(the)g(scaling)f(factor\),) +j(the)d(output)g(barco)s(de)h(will)c(b)s(e)j(cen)m(tered)i(in)d(its)h +(requested)g(region.)52 b(If)574 1262 y(either)27 b(the)h(width)d(of)i +(the)h(heigh)m(t)f(are)h(to)s(o)g(small)d(for)i(the)h(sp)s(eci\014ed)d +(scale)j(factor,)h(the)e(output)574 1362 y(bar)j(co)s(de)h(will)d +(expand)h(symmetrically)g(around)g(the)i(requested)f(region.)94 +1513 y Fj(int)g(xoff;)94 1612 y(int)g(yoff;)574 1738 +y Fl(The)53 b(\014elds)f(sp)s(ecify)g(o\013set)j(from)e(the)g(co)s +(ordinate)h(origin)e(of)h(the)h(output)f(engine)g(\(for)574 +1838 y(p)s(ostscript,)46 b(p)s(osition)c(0,0)i(is)f(the)g(lo)m(w)m(er)h +(left)f(corner)h(of)f(the)h(page\).)81 b(The)43 b(\014elds)f(can)i(b)s +(e)574 1937 y(either)36 b(assigned)e(to)j(in)d(the)i(structure)f(or)g +(via)g Fg(Bar)-5 b(c)g(o)g(de)p 2572 1937 V 36 w(Position\(\))p +Fl(,)39 b(at)d(y)m(our)f(c)m(hoice.)57 b(The)574 2037 +y(o\013set)24 b(sp)s(eci\014es)d(where)h(the)g(white)g(margin)f(b)s +(egins,)h(not)h(where)f(the)g(\014rst)g(bar)g(will)d(b)s(e)j(prin)m +(ted.)574 2136 y(T)-8 b(o)31 b(prin)m(t)e(real)h(ink)f(to)j(the)e(sp)s +(eci\014ed)f(p)s(osition)f(y)m(ou)j(should)d(set)j Fg(mar)-5 +b(gin)39 b Fl(to)31 b(0.)94 2288 y Fj(int)f(margin;)574 +2387 y Fl(The)36 b(white)g(margin)f(that)j(will)33 b(b)s(e)j(left)g +(around)g(the)h(prin)m(ted)e(area)i(of)g(the)f(bar)g(co)s(de.)59 +b(The)574 2487 y(same)37 b(margin)e(is)g(applied)f(to)j(all)e(sides)g +(of)h(the)g(prin)m(ted)f(area.)59 b(The)35 b(default)g(v)-5 +b(alue)36 b(for)g(the)574 2587 y(margin)30 b(is)f(de\014ned)g(in)g(`)p +Fj(barcode.h)p Fl(')g(as)h Fj(BARCODE_DEFAULT_MARGIN)25 +b Fl(\(10\).)94 2738 y Fj(double)k(scalef;)574 2837 y +Fl(The)j(enlarge)f(or)h(shrink)d(v)-5 b(alue)31 b(for)g(the)h(bar)f(co) +s(de)h(o)m(v)m(er)h(its)e(default)g(dimension.)42 b(The)31 +b Fg(width)574 2937 y Fl(and)j Fg(sc)-5 b(alef)54 b Fl(\014elds)33 +b(in)m(teract)h(deeply)f(in)g(the)h(creation)h(of)f(the)g(output,)h +(and)f(a)g(complete)h(de-)574 3037 y(scription)29 b(of)i(the)f(issues)f +(app)s(ears)h(later)g(in)f(this)g(section.)94 3188 y +Fj(int)h(error;)574 3288 y Fl(The)g(\014eld)f(is)h(used)f(when)h(a)g +Fg(b)-5 b(ar)g(c)g(o)g(de)40 b Fl(function)29 b(fails)g(to)i(host)g(an) +f Fj(errno)p Fl(-lik)m(e)f(in)m(teger)h(v)-5 b(alue.)94 +3515 y Ff(Use)42 b(of)f(the)g Fe(width)50 b Ff(and)41 +b Fe(sc)-6 b(alef)64 b Ff(\014elds.)219 3700 y Fl(A)29 +b(width)f(unit)f(is)h(the)i(width)d(of)i(the)h(thinnest)d(bar)i(and/or) +g(space)h(in)d(the)j(c)m(hosen)f(co)s(de;)h(it)f(defaults)f(to)94 +3800 y(1)j(p)s(oin)m(t)f(if)f(the)i(output)e(is)h(p)s(ostscript)f(or)h +(encapsulated)g(p)s(ostscript.)219 3926 y(Either)j(or)h(b)s(oth)g(the)g +(co)s(de)h(width)d(and)i(the)g(scale)h(factor)g(can)g(b)s(e)e(left)h +(unsp)s(eci\014ed)e(\(i.e.,)k(zero\).)53 b(The)94 4026 +y(library)28 b(deals)i(with)f(defaults)h(in)f(the)h(follo)m(wing)f(w)m +(a)m(y:)94 4178 y Fg(Both)34 b(unsp)-5 b(e)g(ci\014e)g(d)574 +4277 y Fl(If)26 b(b)s(oth)f(the)h(width)e(and)h(the)h(scale)g(factor)g +(are)g(unsp)s(eci\014ed,)f(the)h(scale)g(factor)g(will)d(default)i(to) +574 4377 y(1.0)31 b(and)e(the)h(width)e(is)g(calculated)i(according)f +(to)i(the)e(actual)h(width)e(of)i(the)g(bar)f(co)s(de)g(b)s(eing)574 +4477 y(prin)m(ted.)94 4628 y Fg(Width)34 b(unsp)-5 b(e)g(ci\014e)g(d) +574 4728 y Fl(If)30 b(the)h(width)e(is)g(not)i(sp)s(eci\014ed,)d(it)i +(is)g(calculated)g(according)g(to)i(the)e(v)-5 b(alues)30 +b(of)g Fg(sc)-5 b(alef)p Fl(.)94 4879 y Fg(Sc)g(ale)34 +b(factor)f(unsp)-5 b(e)g(ci\014e)g(d)574 4978 y Fl(If)32 +b(the)h(scale)f(factor)i(is)d(not)i(sp)s(eci\014ed,)e(it)h(will)d(b)s +(e)j(c)m(hosen)h(so)f(that)h(the)g(generated)g(bar)f(co)s(de)574 +5078 y(exactly)g(\014ts)e(the)g(sp)s(eci\014ed)f(width.)94 +5229 y Fg(Both)34 b(sp)-5 b(e)g(ci\014e)g(d)574 5329 +y Fl(The)31 b(co)s(de)g(will)d(b)s(e)i(prin)m(ted)g(inside)e(the)j(sp)s +(eci\014ed)f(region)g(according)h(to)g(the)g(sp)s(eci\014ed)f(scale)574 +5429 y(factor.)48 b(It)33 b(will)d(b)s(e)h(aligned)h(to)h(the)f(left.) +47 b(If,)33 b(ho)m(w)m(ev)m(er,)h(the)f(c)m(hosen)g(width)e(is)g(to)s +(o)i(small)e(for)574 5528 y(the)f(sp)s(eci\014c)e(bar)h(co)s(de)h(and)e +(scaling)h(factor,)h(then)f(the)h(co)s(de)g(will)c(extend)k +(symmetrically)d(to)574 5628 y(the)k(left)f(and)g(to)h(the)g(righ)m(t)f +(of)g(the)h(c)m(hosen)g(region.)p eop +%%Page: 3 4 +3 3 bop 94 -116 a Fl(Chapter)30 b(3:)41 b(The)30 b(Flags)2872 +b(3)94 365 y Fk(2.2)69 b(The)44 b(In)l(termediate)j(Represen)l(tation) +219 565 y Fl(The)23 b(enco)s(ding)g(functions)f(prin)m(t)g(their)g +(output)h(in)m(to)h(the)g Fj(partial)d Fl(and)i Fj(texinfo)f +Fl(\014elds)g(of)h(the)h(barco)s(de)94 664 y(data)g(structure.)37 +b(Those)23 b(\014elds,)g(together)h(with)d(p)s(osition)g(information,)h +(are)h(then)f(used)g(to)i(generate)g(actual)94 764 y(output.)41 +b(This)28 b(is)i(an)g(informal)e(description)h(of)h(the)h(in)m +(termediate)f(format.)219 905 y(The)38 b(\014rst)g(c)m(har)h(in)f +Fj(partial)f Fl(tells)g(ho)m(w)i(m)m(uc)m(h)g(extra)g(space)h(to)f(add) +f(to)i(the)f(left)f(of)h(the)g(bars.)65 b(F)-8 b(or)94 +1005 y(EAN-13,)33 b(it)d(is)f(used)h(to)h(lea)m(v)m(e)h(space)f(to)g +(prin)m(t)e(the)i(\014rst)f(digit,)f(other)i(co)s(des)f(ma)m(y)h(ha)m +(v)m(e)h('0')f(for)g(no-extra-)94 1104 y(space-needed.)219 +1245 y(The)23 b(next)h(c)m(haracters)i(are)e(alternating)f(bars)g(and)h +(spaces,)h(as)g(m)m(ultiples)c(of)j(the)g(base)g(dimension)d(whic)m(h) +94 1345 y(is)35 b(1)g(unless)f(the)i(co)s(de)f(is)f(rescaled.)56 +b(Rescaling)34 b(is)h(calculated)g(as)g(the)h(ratio)f(from)g(the)h +(requested)f(width)94 1445 y(and)e(the)h(calculated)f(width.)48 +b(Digits)33 b(represen)m(t)g(bar/space)h(dimensions.)47 +b(Lo)m(w)m(er-case)35 b(letters)f(represen)m(t)94 1544 +y(those)d(bars)f(that)h(should)e(extend)i(lo)m(w)m(er)f(than)h(the)f +(others:)41 b('a')32 b(is)d(equiv)-5 b(alen)m(t)30 b(to)h('1',)h('b')f +(is)e('2')i(and)f(so)h(on)94 1644 y(up)e(to)h('i')g(whic)m(h)e(is)g +(equiv)-5 b(alen)m(t)29 b(to)i('9'.)41 b(Other)29 b(letters)h(will)d(b) +s(e)i(used)g(for)g(enco)s(ding-sp)s(eci\014c)f(meanings,)h(as)94 +1743 y(so)s(on)i(as)f(I)g(implemen)m(t)f(them.)219 1885 +y(The)35 b Fj(textinfo)e Fl(string)h(is)h(made)g(up)f(of)i(\014elds)e +Fj(\045lf:\045lf:\045c)e Fl(separated)k(b)m(y)g(blank)e(space.)56 +b(The)35 b(\014rst)94 1984 y(in)m(teger)f(is)e(the)h(x)g(p)s(osition)e +(of)i(the)h(c)m(haracter,)h(the)e(second)g(is)f(the)i(fon)m(t)f(size)g +(\(b)s(efore)g(rescaling\))f(and)h(the)94 2084 y(c)m(har)e(item)f(is)g +(the)g(c)m(haracter)i(to)f(b)s(e)f(prin)m(ted.)219 2225 +y(Both)39 b(the)g Fj(partial)d Fl(and)i Fj(textinfo)f +Fl(strings)g(ma)m(y)i(include)d(\\)p Fj(-)p Fl(")j(or)g(\\)p +Fj(+)p Fl(")g(as)g(sp)s(ecial)e(c)m(haracters)j(\(in)94 +2325 y Fj(textinfo)25 b Fl(the)j(c)m(har)f(should)e(b)s(e)i(a)g +(stand-alone)g(w)m(ord\).)40 b(They)26 b(state)j(where)d(the)i(text)g +(should)d(b)s(e)h(prin)m(ted:)94 2424 y(b)s(elo)m(w)34 +b(the)g(bars)f(\(\\)p Fj(-)p Fl(",)j(default\))e(or)g(ab)s(o)m(v)m(e)h +(the)f(bars.)51 b(This)32 b(is)h(used,)i(for)e(example,)i(to)g(prin)m +(t)e(the)h(add-5)94 2524 y(and)27 b(add-2)g(co)s(des)g(to)h(the)f(righ) +m(t)f(of)i(UPC)e(or)h(EAN)g(co)s(des)g(\(the)h(add-5)f(extension)g(is)f +(mostly)g(used)g(in)g(ISBN)94 2623 y(co)s(des\).)94 2939 +y Fi(3)81 b(The)53 b(Flags)219 3213 y Fl(The)30 b(follo)m(wing)f +(\015ags)h(are)h(supp)s(orted)e(b)m(y)h(v)m(ersion)g(0.98)i(of)e(the)h +(library:)94 3387 y Fj(BARCODE_ENCODING_MASK)574 3487 +y Fl(The)f(mask)h(is)e(used)h(to)h(extract)h(the)e(enco)s(ding-t)m(yp)s +(e)g(iden)m(ti\014er)f(from)h(the)g Fg(\015ags)39 b Fl(\014eld.)94 +3653 y Fj(BARCODE_EAN)94 3753 y(BARCODE_UPC)94 3852 y(BARCODE_ISBN)94 +3952 y(BARCODE_128B)94 4051 y(BARCODE_128C)94 4151 y(BARCODE_128)94 +4251 y(BARCODE_128RAW)94 4350 y(BARCODE_39)94 4450 y(BARCODE_I25)94 +4550 y(BARCODE_CBR)94 4649 y(BARCODE_MSI)94 4749 y(BARCODE_PLS)94 +4848 y(BARCODE_93)574 4948 y Fl(The)d(curren)m(tly)f(supp)s(orted)g +(enco)s(ding)g(t)m(yp)s(es:)52 b(EAN)36 b(\(13)i(digits,)e(8)h(digits,) +f(13)h Fj(+)f Fl(2)g(add-on)574 5048 y(and)26 b(13)i +Fj(+)e Fl(5)h(add-on\),)g(UPC)f(\(UPC-A,)i(UPC-E,)e(UPC-A)h(with)e(2)i +(or)f(5)h(digit)f(add-on\),)h(ISBN)574 5147 y(\(with)e(or)f(without)g +(the)i(5-digit)e(add-on\),)i(CODE128-B)h(\(the)e(whole)g(set)g(of)g +(prin)m(table)e(ASCI)s(I)574 5247 y(c)m(haracters\),)36 +b(CODE128-C)d(\(t)m(w)m(o)i(digits)c(enco)s(ded)h(b)m(y)h(eac)m(h)h +(barco)s(de)e(sym)m(b)s(ol\),)h(CODE128)574 5347 y(\(all)41 +b(ASCI)s(I)f(v)-5 b(alues\),)44 b(a)e(\\ra)m(w-input")f(pseudo-co)s(de) +h(that)g(generates)h(CODE128)f(output,)574 5446 y(CODE39)32 +b(\(alphan)m(umeric\),)e Fj(")p Fl(in)m(terlea)m(v)m(ed)i(2)f(of)h(5)p +Fj(")f Fl(\(n)m(umeric\),)g(Co)s(dabar)f(\(n)m(umeric)g(plus)g(a)574 +5546 y(few)36 b(sym)m(b)s(ols\),)g(MSI)f(\(n)m(umeric\))g(and)g +(Plessey)g(\(hex)g(digits\).)55 b(See)36 b(Chapter)f(6)h([Supp)s(orted) +574 5645 y(Enco)s(dings],)30 b(page)h(7.)p eop +%%Page: 4 5 +4 4 bop 94 -116 a Fl(Chapter)30 b(4:)41 b(F)-8 b(unctions)30 +b(Exp)s(orted)g(b)m(y)g(the)h(Library)1871 b(4)94 365 +y Fj(BARCODE_ANY)574 465 y Fl(This)27 b(sp)s(ecial)g(enco)s(ding)g(t)m +(yp)s(e)h(\(represen)m(ted)h(b)m(y)f(a)h(v)-5 b(alue)27 +b(of)i(zero,)h(so)e(it)g(will)d(b)s(e)j(the)g(default\))574 +565 y(tells)33 b(the)g(enco)s(ding)f(pro)s(cedure)g(to)h(lo)s(ok)g(for) +g(the)g(\014rst)f(enco)s(ding)g(t)m(yp)s(e)i(that)f(can)h(deal)e(with) +574 664 y(a)44 b(textual)f(string.)77 b(Therefore,)46 +b(a)d(11-digit)f(co)s(de)h(will)e(b)s(e)h(prin)m(ted)f(as)i(UPC)g(\(as) +g(w)m(ell)f(as)574 764 y(6-digit,)48 b(11)p Fj(+)p Fl(2)e(and)e(11)p +Fj(+)p Fl(5\),)49 b(a)c(12-digit)g(\(or)g(7-digit,)i(or)e(12)p +Fj(+)p Fl(2)h(or)e(12)p Fj(+)p Fl(5\))i(as)f(EAN13,)k(an)574 +863 y(ISBN)39 b(co)s(de)f(\(with)g(or)g(without)f(h)m(yphens,)i(with)e +(or)i(without)e(add-5\))i(will)d(b)s(e)h(enco)s(ded)h(in)574 +963 y(its)e(EAN13)i(represen)m(tation,)g(an)e(ev)m(en)h(n)m(um)m(b)s +(er)e(of)i(digits)e(is)g(enco)s(ded)h(using)f(CODE128C)574 +1063 y(and)45 b(a)h(generic)f(string)f(is)h(enco)s(ded)g(using)f +(CODE128B.)j(Since)d(co)s(de-39)j(o\013ers)e(a)h(m)m(uc)m(h)574 +1162 y(larger)38 b(represen)m(tation)f(for)h(the)f(same)h(text)h +(string,)f(co)s(de128-b)h(is)e(preferred)f(o)m(v)m(er)j(co)s(de39)574 +1262 y(for)31 b(alphan)m(umeric)d(strings.)94 1411 y +Fj(BARCODE_NO_ASCII)574 1510 y Fl(Instructs)f(the)h(engine)e(not)i(to)g +(prin)m(t)e(the)i(ascii)e(string)h(on)g(output.)39 b(By)28 +b(default)e(the)i(bar)f(co)s(de)574 1610 y(is)j(accompanied)g(with)f +(an)i(ascii)e(v)m(ersion)h(of)h(the)f(text)i(it)d(enco)s(des.)94 +1759 y Fj(BARCODE_NO_CHECKSUM)574 1858 y Fl(Instructs)j(the)h(engine)f +(not)h(to)g(add)f(the)h(c)m(hec)m(ksum)g(c)m(haracter)h(to)f(the)g +(output.)47 b(Not)33 b(all)f(the)574 1958 y(enco)s(ding)23 +b(t)m(yp)s(es)g(can)h(drop)f(the)h(c)m(hec)m(ksum;)i(those)e(where)f +(the)h(c)m(hec)m(ksum)g(is)f(mandatory)g(\(lik)m(e)574 +2058 y(EAN)31 b(and)f(UPC\))g(just)g(ignore)g(the)h(\015ag.)94 +2206 y Fj(BARCODE_OUTPUT_MASK)574 2306 y Fl(The)f(mask)h(is)e(used)h +(to)h(extract)h(the)e(output-t)m(yp)s(e)h(iden)m(ti\014er)d(from)i(the) +h Fg(\015ags)38 b Fl(\014eld.)94 2455 y Fj(BARCODE_OUT_PS)94 +2554 y(BARCODE_OUT_EPS)94 2654 y(BARCODE_OUT_PCL)94 2753 +y(BARCODE_OUT_PCL_III)574 2853 y Fl(The)48 b(curren)m(tly)f(supp)s +(orted)f(enco)s(ding)g(t)m(yp)s(es:)76 b(full-page)47 +b(p)s(ostscript)f(and)h(encapsulated)574 2953 y(p)s(ostscript;)h(PCL)41 +b(\(prin)m(t)g(command)i(language,)j(for)c(HP)g(prin)m(ters\))f(and)h +(PCL-I)s(I)s(I)e(\(same)574 3052 y(as)31 b(PCL,)f(but)g(uses)g(a)g(fon) +m(t)h(not)g(a)m(v)-5 b(ailable)30 b(on)g(older)f(prin)m(ters\).)94 +3201 y Fj(BARCODE_OUT_NOHEADERS)574 3301 y Fl(The)f(\015ag)h(instructs) +d(the)j(prin)m(ting)d(engine)h(not)i(to)f(prin)m(t)f(the)h(header)g +(and)g(fo)s(oter)h(part)e(of)i(the)574 3400 y(\014le.)40 +b(This)29 b(mak)m(es)i(sense)f(for)f(the)i(p)s(ostscript)d(engine)i +(but)f(migh)m(t)h(not)h(mak)m(e)g(sense)f(for)g(other)574 +3500 y(engines;)k(suc)m(h)f(other)h(engines)e(will)e(silen)m(tly)i +(ignore)g(the)i(\015ag)f(just)g(lik)m(e)f(the)h(PCL)f(bac)m(k-end)574 +3600 y(do)s(es.)94 3881 y Fi(4)81 b(F)-13 b(unctions)52 +b(Exp)t(orted)h(b)l(y)g(the)g(Library)219 4103 y Fl(The)41 +b(functions)f(included)f(in)h(the)i(barco)s(de)f(library)e(are)j +(declared)f(in)g(the)g(header)h(\014le)e Fj(barcode.h)p +Fl(.)94 4203 y(They)30 b(p)s(erform)f(the)i(follo)m(wing)e(tasks:)94 +4352 y Fj(struct)g(Barcode_Item)e(*Barcode_Create\(char)e(*text\);)574 +4451 y Fl(The)35 b(function)e(creates)j(a)f(new)g(barco)s(de)f(ob)5 +b(ject)36 b(to)f(deal)g(with)e(a)i(sp)s(eci\014ed)e(text)j(string.)53 +b(It)574 4551 y(returns)27 b(NULL)h(in)e(case)j(of)f(failure)e(and)i(a) +g(p)s(oin)m(ter)f(to)h(a)h(barco)s(de)e(data)i(structure)e(in)g(case)i +(of)574 4651 y(success.)94 4799 y Fj(int)h(Barcode_Delete\(struct)25 +b(Barcode_Item)i(*bc\);)574 4899 y Fl(Destro)m(y)32 b(a)f(barco)s(de)f +(ob)5 b(ject.)42 b(Alw)m(a)m(ys)31 b(returns)e(0)h(\(success\))94 +5048 y Fj(int)g(Barcode_Encode\(struct)25 b(Barcode_Item)i(*bc,)i(int)g +(flags\);)574 5147 y Fl(Enco)s(de)h(the)h(text)g(included)d(in)h(the)h +Fg(b)-5 b(c)35 b Fl(ob)5 b(ject.)42 b(V)-8 b(alid)29 +b(\015ags)i(are)f(the)h(enco)s(ding)e(t)m(yp)s(e)h(\(other)574 +5247 y(\015ags)45 b(are)f(ignored\))g(and)g(BAR)m(CODE)p +1994 5247 28 4 v 33 w(NO)p 2166 5247 V 33 w(CHECKSUM)f(\(other)i +(\015ags)f(are)h(silen)m(tly)d(ig-)574 5347 y(nored\);)35 +b(if)e(the)g(\015ag)h(argumen)m(t)g(is)e(zero,)j Fj(bc->flags)c +Fl(will)g(apply)-8 b(.)49 b(The)32 b(function)g(returns)h(0)574 +5446 y(on)h(success)g(and)f(-1)i(in)d(case)j(of)f(error.)51 +b(After)34 b(successful)e(termination)h(the)h(data)g(structure)574 +5546 y(will)21 b(host)i(the)h(description)d(of)j(the)f(bar)g(co)s(de)g +(and)g(its)g(textual)g(represen)m(tation,)i(after)f(a)g(failure)574 +5645 y(the)31 b Fj(error)e Fl(\014eld)g(will)f(include)g(the)i(reason)h +(of)f(the)h(failure.)p eop +%%Page: 5 6 +5 5 bop 94 -116 a Fl(Chapter)30 b(5:)41 b(The)30 b Fg(b)-5 +b(ar)g(c)g(o)g(de)40 b Fl(fron)m(tend)30 b(program)2063 +b(5)94 365 y Fj(int)30 b(Barcode_Print\(struct)25 b(Barcode_Item)i +(*bc,)i(FILE)g(*f,)h(int)f(flags\);)574 465 y Fl(Prin)m(t)39 +b(the)g(bar)g(co)s(de)g(describ)s(ed)e(b)m(y)i Fj(bc)g +Fl(to)h(the)f(sp)s(eci\014ed)f(\014le.)66 b(V)-8 b(alid)38 +b(\015ags)h(are)h(the)f(out-)574 565 y(put)25 b(t)m(yp)s(e,)h +Fj(BARCODE_NO_ASCII)21 b Fl(and)j Fj(BARCODE_OUT_NOHEADERS)p +Fl(,)d(other)k(\015ags)g(are)h(ignored.)574 664 y(If)39 +b(an)m(y)h(of)f(these)h(\015ags)g(is)e(zero,)43 b(it)c(will)d(b)s(e)j +(inherited)e(from)i Fj(bc->flags)d Fl(whic)m(h)i(therefore)574 +764 y(tak)m(es)f(precedence.)57 b(The)35 b(function)g(returns)f(0)i(on) +f(success)h(and)f(-1)h(in)e(case)j(of)f(error)f(\(with)574 +863 y Fj(bc->error)28 b Fl(set)j(accordingly\).)40 b(In)29 +b(case)j(of)e(success,)h(the)f(bar)g(co)s(de)g(is)f(prin)m(ted)g(to)i +(the)f(sp)s(ec-)574 963 y(i\014ed)f(\014le,)h(whic)m(h)f(w)m(on't)i(b)s +(e)f(closed)g(after)h(use.)94 1115 y Fj(int)f(Barcode_Position\(struct) +24 b(Barcode_Item)j(*bc,)i(int)h(wid,)f(int)g(hei,)h(int)f(xoff,)g(int) +h(yoff,)94 1215 y(double)f(scalef\);)574 1315 y Fl(The)h(function)f(is) +h(a)h(shortcut)f(to)h(assign)f(v)-5 b(alues)29 b(to)j(the)e(data)h +(structure.)94 1467 y Fj(int)f(Barcode_Encode_and_Print)o(\(cha)o(r)24 +b(*text,)29 b(FILE)g(*f,)h(int)f(wid,)g(int)h(hei,)f(int)h(xoff,)f(int) +94 1567 y(yoff,)g(int)h(flags\);)574 1666 y Fl(The)38 +b(function)e(deals)h(with)g(the)h(whole)f(life)f(of)i(the)g(barco)s(de) +g(ob)5 b(ject)39 b(b)m(y)e(calling)g(the)h(other)574 +1766 y(functions;)30 b(it)g(uses)g(all)f(the)h(sp)s(eci\014ed)f +(\015ags.)94 1918 y Fj(int)h(Barcode_Version\(char)25 +b(*versionname\);)574 2018 y Fl(Returns)g(the)g(curren)m(t)f(v)m +(ersion)h(as)g(an)g(in)m(teger)g(n)m(um)m(b)s(er)f(of)h(the)g(form)f +(ma)5 b(jor)25 b(*)h(10000)h Fj(+)d Fl(minor)574 2118 +y(*)k(100)h Fj(+)e Fl(release.)40 b(Therefore,)28 b(v)m(ersion)f +(1.03.5)i(will)c(b)s(e)i(returned)f(as)h(10305)j(and)d(v)m(ersion)f +(0.53)574 2217 y(as)i(5300.)41 b(If)27 b(the)h(argumen)m(t)f(is)f +(non-n)m(ull,)g(it)h(will)e(b)s(e)h(used)h(to)h(return)e(the)h(v)m +(ersion)g(n)m(um)m(b)s(er)f(as)574 2317 y(a)h(string.)39 +b(Note)28 b(that)f(the)f(same)h(information)e(is)h(a)m(v)-5 +b(ailable)26 b(from)g(t)m(w)m(o)i(prepro)s(cessor)d(macros:)574 +2416 y Fj(BARCODE_VERSION)i Fl(\(the)k(string\))e(and)h +Fj(BARCODE_VERSION_INT)25 b Fl(\(the)31 b(in)m(teger)g(n)m(um)m(b)s +(er\).)94 2705 y Fi(5)81 b(The)53 b Fd(b)-8 b(ar)g(c)g(o)g(de)65 +b Fi(fron)l(tend)51 b(program)219 2938 y Fl(The)26 b +Fc(barco)s(de)g Fl(program)g(is)f(a)h(fron)m(t-end)g(to)h(access)h +(some)e(features)h(of)f(the)g(library)e(from)i(the)g(command)94 +3037 y(line.)63 b(It)38 b(is)g(able)f(to)i(read)f(user)g(supplied)d +(strings)i(from)h(the)g(command)g(line)e(or)j(a)f(data)h(\014le)e +(\(standard)94 3137 y(input)29 b(b)m(y)h(default\))g(and)g(enco)s(de)g +(all)g(of)g(them.)94 3401 y Fk(5.1)69 b(The)44 b(Command)h(Line)219 +3587 y Fc(barco)s(de)30 b Fl(accepts)i(the)e(follo)m(wing)f(options:)94 +3741 y Fj(--help)g(or)h(-h)574 3840 y Fl(Prin)m(t)g(a)h(usage)g +(summary)e(and)h(exit.)94 3993 y Fj(-i)g(filename)574 +4092 y Fl(Iden)m(tify)35 b(a)h(\014le)f(where)g(strings)f(to)j(b)s(e)e +(enco)s(ded)g(are)h(read)f(from.)56 b(If)36 b(missing)d(\(and)i(if)g +Fj(-b)g Fl(is)574 4192 y(not)29 b(used\))f(it)g(defaults)f(to)i +(standard)e(input.)38 b(Eac)m(h)29 b(data)g(line)e(of)h(the)h(input)d +(\014le)i(will)d(b)s(e)j(used)574 4292 y(to)k(create)g(one)e(barco)s +(de)g(output.)94 4444 y Fj(-o)g(filename)574 4544 y Fl(Output)g +(\014le.)40 b(It)30 b(defaults)f(to)j(standard)d(output.)94 +4696 y Fj(-b)h(string)66 b Fl(Sp)s(ecify)32 b(a)j(single)d(\\barco)s +(de")i(string)f(to)h(b)s(e)g(enco)s(ded.)50 b(The)33 +b(option)g(can)h(b)s(e)f(used)g(m)m(ultiple)574 4796 +y(times)j(in)e(order)h(to)h(enco)s(de)g(m)m(ultiple)d(strings)i(\(this) +f(will)f(result)i(in)f(m)m(ulti-page)h(p)s(ostscript)574 +4895 y(output)22 b(or)g(a)g(table)g(of)g(barco)s(des)g(if)f +Fj(-t)g Fl(is)g(sp)s(eci\014ed\).)37 b(The)21 b(strings)g(m)m(ust)h +(matc)m(h)h(the)f(enco)s(ding)574 4995 y(c)m(hosen;)29 +b(if)c(it)g(do)s(esn't)h(matc)m(h)h(the)f(program)g(will)d(prin)m(t)i +(a)h(w)m(arning)f(to)i Fj(stderr)d Fl(and)h(generate)574 +5095 y(\\blank")44 b(output)g(\(although)h(not)f(zero-length\).)84 +b(Please)44 b(note)h(that)g(a)g(string)e(including)574 +5194 y(spaces)31 b(or)g(other)f(sp)s(ecial)f(c)m(haracters)j(m)m(ust)e +(b)s(e)g(prop)s(erly)e(quoted.)94 5347 y Fj(-e)i(encoding)574 +5446 y Fc(enco)s(ding)j Fl(is)e(the)i(name)f(of)h(the)g(c)m(hosen)g +(enco)s(ding)e(format)i(b)s(eing)e(used.)46 b(It)32 b(defaults)g(to)h +(the)574 5546 y(v)-5 b(alue)41 b(of)f(the)h(en)m(vironmen)m(t)g(v)-5 +b(ariable)39 b Fj(BARCODE_ENCODING)d Fl(or)41 b(to)g(auto)h(detection)f +(if)f(the)574 5645 y(en)m(vironmen)m(t)30 b(is)g(also)g(unset.)p +eop +%%Page: 6 7 +6 6 bop 94 -116 a Fl(Chapter)30 b(6:)41 b(Supp)s(orted)29 +b(Enco)s(dings)2417 b(6)94 365 y Fj(-g)30 b(geometry)574 +465 y Fl(The)e(geometry)g(argumen)m(t)g(is)f(of)h(the)f(form)g(\\[)p +Fj(<)p Fg(width)p Fj(>)i(x)f(<)p Fg(height)p Fj(>)p Fl(])f([)p +Fj(+)h(<)p Fg(xmar)-5 b(gin)p Fj(>)28 b(+)f(<)p Fg(ymar-)574 +565 y(gin)p Fj(>)p Fl(]")42 b(\(with)f(no)h(in)m(terv)m(ening)f +(spaces\).)75 b(Unsp)s(eci\014ed)40 b(margin)h(v)-5 b(alues)41 +b(will)e(result)i(in)f(no)574 664 y(margin;)31 b(unsp)s(eci\014ed)d +(size)j(results)e(in)h(default)g(size.)42 b(The)30 b(sp)s(eci\014ed)f +(v)-5 b(alues)30 b(represen)m(t)h(prin)m(t)574 764 y(p)s(oin)m(ts)e(b)m +(y)g(default,)g(and)g(can)g(b)s(e)g(inc)m(hes,)g(millimeters)e(or)i +(other)h(units)e(according)h(to)h(the)g Fj(-u)574 863 +y Fl(option)j(or)h(the)g Fj(BARCODE_UNIT)c Fl(en)m(vironmen)m(t)j(v)-5 +b(ariable.)49 b(The)33 b(argumen)m(t)h(is)e(used)h(to)h(place)574 +963 y(the)g(prin)m(tout)f(co)s(de)h(on)f(the)h(page.)51 +b(Note)35 b(that)f(an)f(additional)f(white)g(margin)h(of)h(10)g(p)s +(oin)m(ts)574 1063 y(is)e(added)f(to)i(the)g(prin)m(tout.)45 +b(If)31 b(the)i(option)f(is)f(unsp)s(eci\014ed,)f Fj(BARCODE_GEOMETRY)e +Fl(is)j(lo)s(ok)m(ed)574 1162 y(up)h(in)f(the)h(en)m(vironmen)m(t,)h +(if)e(missing)f(a)j(default)f(size)g(and)g(no)g(margin)f(\(but)h(the)h +(default)e(10)574 1262 y(p)s(oin)m(ts\))f(are)h(used.)94 +1409 y Fj(-t)f(table-geometry)574 1508 y Fl(Used)j(to)g(prin)m(t)e(sev) +m(eral)i(barco)s(des)f(to)i(a)f(single)e(page,)j(this)d(option)h(is)g +(mean)m(t)h(to)h(b)s(e)d(used)h(to)574 1608 y(prin)m(t)e(stic)m(k)m +(ers.)43 b(The)30 b(argumen)m(t)h(is)f(of)h(the)g(form)g(\\)p +Fj(<)p Fg(c)-5 b(olumns)p Fj(>)32 b(x)e(<)p Fg(lines)p +Fj(>)h Fl([)p Fj(+)g(<)p Fg(leftmar)-5 b(gin)p Fj(>)31 +b(+)574 1707 y(<)p Fg(b)-5 b(ottommar)g(gin)p Fj(>)39 +b Fl([)p Fj(-)d(<)p Fg(rightmar)-5 b(gin)p Fj(>)38 b +Fl([)p Fj(-)e(<)p Fg(topmar)-5 b(gin)p Fj(>)p Fl(]]]")39 +b(\(with)c(no)h(in)m(terv)m(ening)f(spaces\);)574 1807 +y(if)42 b(missing,)i(the)f(top)g(and)f(righ)m(t)g(margin)g(will)e +(default)i(to)i(b)s(e)e(the)h(same)g(as)g(the)g(b)s(ottom)574 +1907 y(and)c(left)g(margin.)66 b(The)38 b(margins)g(are)i(sp)s +(eci\014ed)d(in)h(prin)m(t)g(p)s(oin)m(ts)g(or)h(in)e(the)j(c)m(hosen)f +(unit)574 2006 y(\(see)f Fj(-u)d Fl(b)s(elo)m(w\).)59 +b(If)35 b(the)i(option)f(is)f(not)i(sp)s(eci\014ed,)f +Fj(BARCODE_TABLE)d Fl(is)i(lo)s(ok)m(ed)h(up)g(in)f(the)574 +2106 y(en)m(vironmen)m(t,)d(otherwise)f(no)h(table)f(is)g(prin)m(ted)f +(and)h(eac)m(h)i(barco)s(de)f(will)c(get)33 b(its)e(o)m(wn)h(page.)574 +2206 y(The)27 b(size)g(\(but)f(not)h(the)g(p)s(osition\))e(of)j(a)f +(barco)s(de)f(item)h(within)d(a)k(table)e(can)h(also)g(b)s(e)f +(selected)574 2305 y(using)43 b Fj(-g)g Fl(\(see)i Fj(")p +Fl(geometry)p Fj(")g Fl(ab)s(o)m(v)m(e\),)k(without)43 +b(struggling)f(with)h(external)h(and)f(in)m(ternal)574 +2405 y(margins.)71 b(I)40 b(still)e(think)h(managemen)m(t)j(of)f +(geometries)g(in)f(a)h(table)f(is)g(sub)s(optimal,)g(but)g(I)574 +2504 y(can't)32 b(mak)m(e)f(it)f(b)s(etter)h(without)e(in)m(tro)s +(ducing)f(incompatibilities.)94 2651 y Fj(-m)i(margin\(s\))574 +2751 y Fl(Sp)s(eci\014es)21 b(an)g(in)m(ternal)g(margin)g(for)g(eac)m +(h)i(stic)m(k)m(er)g(in)d(the)i(table.)38 b(The)21 b(argumen)m(t)i(is)d +(of)i(the)g(form)574 2850 y(\\)p Fj(<)p Fg(xmar)-5 b(gin)p +Fj(>,<)p Fg(ymar)g(gin)p Fj(>)p Fl(")35 b(and)c(the)g(margin)g(is)g +(applied)e(symmetrically)h(to)i(the)g(stic)m(k)m(er.)45 +b(If)574 2950 y(unsp)s(eci\014ed,)28 b(the)h(en)m(vironmen)m(t)g(v)-5 +b(ariable)28 b Fj(BARCODE_MARGIN)e Fl(is)i(used)h(or)g(a)h(default)e +(in)m(ternal)574 3050 y(margin)i(of)g(10)i(p)s(oin)m(ts)d(is)g(used.)94 +3196 y Fj(-n)384 b Fl(\\Numeric")31 b(output:)40 b(don't)31 +b(prin)m(t)e(the)h(ASCI)s(I)f(form)h(of)g(the)h(co)s(de,)g(only)e(the)i +(bars.)94 3343 y Fj(-c)384 b Fl(No)35 b(c)m(hec)m(ksum)f(c)m(haracter)h +(\(for)f(enco)s(dings)e(that)j(allo)m(w)e(it,)h(lik)m(e)f(co)s(de)h +(39,)h(other)f(co)s(des,)h(lik)m(e)574 3442 y(UPC)c(or)f(EAN,)h(ignore) +f(this)f(option\).)94 3589 y Fj(-E)384 b Fl(Encapsulated)32 +b(p)s(ostscript)f(\(default)h(is)g(normal)f(p)s(ostscript\).)47 +b(When)32 b(the)h(output)f(is)f(gener-)574 3689 y(ated)h(as)e(EPS)g +(only)f(one)i(barco)s(de)f(is)f(enco)s(ded.)94 3835 y +Fj(-P)384 b Fl(PCL)35 b(output.)56 b(Please)36 b(note)g(that)g(the)f(Y) +h(direction)e(go)s(es)i(from)f(top)h(to)g(b)s(ottom)g(for)f(PCL,)574 +3935 y(and)30 b(the)h(origin)e(for)h(an)g(image)h(is)e(the)i(top-left)f +(corner)h(instead)e(of)i(the)f(b)s(ottom-left)94 4081 +y Fj(-p)g(pagesize)574 4181 y Fl(Sp)s(ecify)44 b(a)h(non-default)f +(page)i(size.)85 b(The)45 b(page)h(size)f(can)g(b)s(e)f(sp)s(eci\014ed) +g(in)g(millimeters,)574 4281 y(inc)m(hes)34 b(or)g(plain)e(n)m(um)m(b)s +(ers)g(\(for)i(example:)48 b Fj("210x297mm")p Fl(,)32 +b Fj("8.5x11in")p Fl(,)g Fj("595x842")p Fl(\).)50 b(A)574 +4380 y(page)27 b(sp)s(eci\014cation)d(as)i(n)m(um)m(b)s(ers)e(will)f(b) +s(e)i(in)m(terpreted)g(according)g(to)i(the)f(curren)m(t)f(unit)f(sp)s +(ec-)574 4480 y(i\014cation)33 b(\(see)h Fj(-u)e Fl(b)s(elo)m(w\).)49 +b(If)33 b(libpap)s(er)d(is)i(a)m(v)-5 b(ailable,)33 b(y)m(ou)h(can)f +(also)g(sp)s(ecify)f(the)h(page)h(size)574 4580 y(with)40 +b(its)g(name,)k(lik)m(e)d Fj("A3")e Fl(or)i Fj("letter")e +Fl(\(libpap)s(er)f(is)i(a)h(standard)g(comp)s(onen)m(t)g(of)g(De-)574 +4679 y(bian)d(GNU/Lin)m(ux,)k(but)d(ma)m(y)h(b)s(e)e(missing)f +(elsewhere\).)68 b(The)39 b(default)f(page)i(size)g(is)e(y)m(our)574 +4779 y(system-wide)30 b(default)g(if)f(libpap)s(er)e(is)j(there,)h(A4)g +(otherwise.)94 4925 y Fj(-u)f(unit)162 b Fl(Cho)s(ose)32 +b(the)f(unit)f(used)g(in)g(size)i(sp)s(eci\014cations.)42 +b(Accepted)32 b(v)-5 b(alues)31 b(are)g(\\mm",)i(\\cm",)f(\\in")574 +5025 y(and)37 b(\\pt".)61 b(By)37 b(default,)h(the)f(program)f(will)f +(c)m(hec)m(k)j Fj(BARCODE_UNIT)33 b Fl(in)j(the)h(en)m(vironmen)m(t,) +574 5125 y(and)c(assume)g(p)s(oin)m(ts)g(otherwise)f(\(this)h(b)s(eha)m +(viour)f(is)g(compatible)h(with)f(0.92)j(and)d(previous)574 +5224 y(v)m(ersions.)50 b(If)33 b Fj(-u)g Fl(app)s(ears)g(more)g(than)g +(once,)j(eac)m(h)e(instance)f(will)e(mo)s(di\014ed)h(the)h(b)s(eha)m +(viour)574 5324 y(for)h(the)g(argumen)m(ts)g(at)g(its)f(righ)m(t,)i(as) +f(the)g(command)f(line)f(is)h(pro)s(cesses)g(left)h(to)g(righ)m(t.)50 +b(The)574 5424 y(program)32 b(in)m(ternally)f(w)m(orks)h(with)f(p)s +(oin)m(ts,)h(and)f(an)m(y)i(size)f(is)f(appro)m(ximated)h(to)h(the)f +(nearest)574 5523 y(m)m(ultiple)c(of)j(one)f(p)s(oin)m(t.)40 +b(The)30 b Fj(-u)f Fl(option)h(a\013ect)i Fj(-g)e Fl(\(geometry\),)i +Fj(-t)e Fl(\(table\))h(and)e Fj(-p)h Fl(\(page)574 5623 +y(size\).)p eop +%%Page: 7 8 +7 7 bop 94 -116 a Fl(Chapter)30 b(6:)41 b(Supp)s(orted)29 +b(Enco)s(dings)2417 b(7)94 365 y Fi(6)81 b(Supp)t(orted)51 +b(Enco)t(dings)219 558 y Fl(The)31 b(program)h(enco)s(des)g(text)g +(strings)f(passed)g(either)g(on)h(the)g(command)g(line)e(\(with)g(-b\)) +i(or)g(retriev)m(ed)94 658 y(from)38 b(standard)f(input.)61 +b(The)37 b(text)i(represen)m(tation)f(is)f(in)m(terpreted)g(according)g +(to)i(the)f(follo)m(wing)e(rules.)94 758 y(When)42 b(auto-detection)g +(of)g(the)f(enco)s(ding)f(is)h(enabled)f(\(i.e,)k(no)e(explicit)d(enco) +s(ding)h(t)m(yp)s(e)i(is)e(sp)s(eci\014ed\),)94 857 y(the)c(enco)s +(ding)e(t)m(yp)s(es)h(are)h(scanned)f(to)h(\014nd)d(one)j(that)g(can)f +(digest)g(the)g(text)i(string.)54 b(The)35 b(follo)m(wing)e(list)94 +957 y(of)h(supp)s(orted)e(t)m(yp)s(es)h(is)g(sorted)g(in)g(the)g(same)h +(order)f(the)h(library)d(uses)i(when)f(auto-detecting)k(a)d(suitable)94 +1056 y(enco)s(ding)d(for)g(a)h(string.)94 1193 y Fh(EAN)282 +b Fl(The)36 b(EAN)h(fron)m(tend)f(is)g(similar)d(to)38 +b(UPC;)e(it)g(accepts)i(strings)d(of)i(digits,)g(12)g(or)g(7)f(c)m +(harac-)574 1293 y(ters)c(long.)41 b(Strings)30 b(of)h(13)g(or)g(8)g(c) +m(haracters)i(are)e(accepted)h(if)e(the)h(pro)m(vided)f(c)m(hec)m(ksum) +h(digit)574 1393 y(is)40 b(correct.)73 b(I)40 b(exp)s(ect)i(most)f +(users)e(to)j(feed)e(input)f(without)h(a)h(c)m(hec)m(ksum,)j(though.)71 +b(The)574 1492 y(add-2)36 b(and)g(add-5)g(extension)f(are)h(accepted)i +(for)d(b)s(oth)g(the)i(EAN-13)g(and)e(the)h(EAN-8)h(en-)574 +1592 y(co)s(dings.)42 b(The)30 b(follo)m(wing)f(are)j(example)e(of)h(v) +-5 b(alid)29 b(input)g(strings:)41 b(\\)p Fj(123456789012)p +Fl(")28 b(\(EAN-)574 1692 y(13\),)43 b(\\)p Fj(1234567890128)p +Fl(")37 b(\(EAN-13)k(wih)c(c)m(hec)m(ksum\),)43 b(\\)p +Fj(1234567)p Fl(")38 b(\(EAN-8\),)44 b(\\)p Fj(12345670)574 +1791 y(12345)p Fl(")23 b(\(EAN-8)h(with)e(c)m(hec)m(ksum)h(and)g +(add-5\),)i(\\)p Fj(123456789012)45 b(12)p Fl(")23 b(\(EAN-13)i(with)c +(add-)574 1891 y(2\),)32 b(\\)p Fj(123456789012)45 b(12345)p +Fl(")29 b(\(EAN-13)j(with)d(add-5\).)94 2028 y Fh(UPC)284 +b Fl(The)35 b(UPC)g(fron)m(tend)g(accepts)i(only)d(strings)g(made)i(up) +e(of)h(digits)f(\(and,)j(if)d(a)i(supplemen)m(tal)574 +2127 y(enco)s(ding)27 b(is)g(used,)g(a)h(blank)f(to)h(separate)g(it\).) +40 b(It)28 b(accepts)h(strings)d(of)i(11)g(or)g(12)g(digits)f(\(UPC-) +574 2227 y(A\))k(and)f(6)h(or)f(7)h(or)f(8)h(digits)e(\(UPC-E\).)574 +2345 y(The)c(12th)h(digit)e(of)h(UPC-A)g(is)f(the)h(c)m(hec)m(ksum)h +(and)e(is)g(added)h(b)m(y)g(the)g(library)d(if)i(not)i(sp)s(eci\014ed) +574 2445 y(in)k(the)h(input;)e(if)h(it)h(is)f(sp)s(eci\014ed,)f(it)h(m) +m(ust)h(b)s(e)f(the)h(righ)m(t)g(c)m(hec)m(ksum)g(or)g(the)g(co)s(de)g +(is)f(rejected)574 2545 y(as)38 b(in)m(v)-5 b(alid.)59 +b(F)-8 b(or)38 b(UPC-E,)f(6)h(digit)e(are)i(considered)e(to)i(b)s(e)e +(the)i(middle)d(part)i(of)g(the)g(co)s(de,)574 2644 y(a)i(leading)d(0)i +(is)f(assumed)g(and)g(the)h(c)m(hec)m(ksum)g(is)f(added;)k(7)d(digits)e +(are)i(either)f(considered)574 2744 y(the)30 b(initial)d(part)i +(\(leading)g(digit)f(0)i(or)g(1,)g(c)m(hec)m(ksum)g(missing\))e(or)i +(the)f(\014nal)g(part)g(\(c)m(hec)m(ksum)574 2844 y(sp)s(eci\014ed,)f +(leading)g(0)i(assumed\);)g(8)f(digits)f(are)i(considered)e(to)i(b)s(e) +e(the)i(complete)f(co)s(de,)h(with)574 2943 y(leading)k(0)i(or)f(1)g +(and)g(c)m(hec)m(ksum.)55 b(F)-8 b(or)36 b(b)s(oth)f(UPC-A)g(and)f +(UPC-E,)i(a)f(trailing)e(string)h(of)i(2)574 3043 y(digits)30 +b(or)h(5)g(digits)e(is)h(accepted)i(as)f(w)m(ell.)40 +b(Therefore,)31 b(the)g(follo)m(wing)e(are)i(examples)g(of)g(v)-5 +b(alid)574 3142 y(strings)41 b(that)h(can)f(b)s(e)g(enco)s(ded)g(as)h +(UPC:)f(\\)p Fj(01234567890)p Fl(")e(\(UPC-A\))j(\\)p +Fj(012345678905)p Fl(")574 3242 y(\(UPC-A)33 b(with)d(c)m(hec)m +(ksum\),)k(\\)p Fj(012345)p Fl(")d(\(UPC-E\),)i(\\)p +Fj(01234567890)45 b(12)p Fl(")32 b(\(UPC-A,)g(add-2\))574 +3342 y(and)21 b(\\)p Fj(01234567890)45 b(12345)p Fl(")20 +b(\(UPC-A,)i(add-5\),)h(\\)p Fj(0123456)47 b(12)p Fl(")20 +b(\(UPC-E,)i(add-2\).)38 b(Please)574 3441 y(note)24 +b(that)f(when)f(setting)h Fj(BARCODE_ANY)c Fl(to)24 b(auto-detect)h +(the)e(enco)s(ding)f(to)h(b)s(e)f(used,)i(12-digit)574 +3541 y(strings)32 b(and)h(7-digit)f(strings)g(will)e(alw)m(a)m(ys)k(b)s +(e)e(iden)m(ti\014ed)f(as)i(EAN.)h(This)d(b)s(ecause)i(I)f(exp)s(ect) +574 3641 y(most)h(user)f(to)h(pro)m(vide)f(input)e(without)i(a)g(c)m +(hec)m(ksum.)48 b(If)32 b(y)m(ou)h(need)f(to)h(sp)s(ecify)e(UPC-with-) +574 3740 y(c)m(hec)m(ksum)h(as)g(input)d(y)m(ou)i(m)m(ust)g(explicitly) +e(set)j Fj(BARCODE_UPC)c Fl(as)j(a)g(\015ag)h(or)f(use)g +Fj(-e)47 b(upc)30 b Fl(on)574 3840 y(the)h(command)f(line.)94 +3977 y Fh(ISBN)264 b Fl(ISBN)26 b(n)m(um)m(b)s(ers)e(are)i(enco)s(ded)f +(as)h(EAN-13)g(sym)m(b)s(ols,)g(with)e(an)h(optional)g(add-5)g +(trailer.)38 b(The)574 4076 y(ISBN)27 b(fron)m(tend)f(of)h(the)g +(library)e(accepts)j(real)e(ISBN)h(n)m(um)m(b)s(ers)e(and)h(deals)h +(with)e(an)m(y)i(h)m(yphen)574 4176 y(and,)h(if)f(presen)m(t,)h(the)g +(ISBN)f(c)m(hec)m(ksum)i(c)m(haracter)g(b)s(efore)e(enco)s(ding)f +(data.)41 b(V)-8 b(alid)26 b(represen-)574 4276 y(tations)j(for)e(ISBN) +h(strings)e(are)j(for)e(example:)40 b(\\)p Fj(1-56592-292-1)p +Fl(",)25 b(\\)p Fj(3-89721-122-X)p Fl(")h(and)574 4375 +y(\\)p Fj(3-89721-122-X)45 b(06900)p Fl(".)94 4512 y +Fh(co)s(de)31 b(128-B)574 4612 y Fl(This)37 b(enco)s(ding)g(can)h +(represen)m(t)g(all)f(of)h(the)h(prin)m(ting)c(ASCI)s(I)i(c)m +(haracters,)42 b(from)37 b(the)h(space)574 4711 y(\(32\))32 +b(to)g(DEL)e(\(127\).)43 b(The)30 b(c)m(hec)m(ksum)h(digit)e(is)g +(mandatory)i(in)e(this)g(enco)s(ding.)94 4848 y Fh(co)s(de)i(128-C)574 +4948 y Fl(The)h(\\C")g(v)-5 b(ariation)31 b(of)h(Co)s(de-128)h(uses)e +(Co)s(de-128)i(sym)m(b)s(ols)d(to)j(represen)m(t)f(t)m(w)m(o)h(digits)d +(at)j(a)574 5048 y(time)28 b(\(Co)s(de-128)g(is)f(made)g(up)f(of)i(104) +g(sym)m(b)s(ols)e(whose)i(in)m(terpretation)e(is)h(con)m(trolled)g(b)m +(y)g(the)574 5147 y(start)35 b(sym)m(b)s(ol)e(b)s(eing)g(used\).)52 +b(Co)s(de)34 b(128-C)h(is)e(th)m(us)h(the)h(most)f(compact)i(w)m(a)m(y) +f(to)g(represen)m(t)574 5247 y(an)m(y)41 b(ev)m(en)h(n)m(um)m(b)s(er)d +(of)i(digits.)70 b(The)40 b(enco)s(der)g(refuses)g(to)h(deal)f(with)g +(an)g(o)s(dd)g(n)m(um)m(b)s(er)f(of)574 5347 y(digits)24 +b(b)s(ecause)h(the)g(caller)f(is)g(exp)s(ected)h(to)h(pro)m(vide)e +(prop)s(er)f(padding)g(to)j(an)f(ev)m(en)g(n)m(um)m(b)s(er)f(of)574 +5446 y(digits.)38 b(\(Since)23 b(Co)s(de-128)i(includes)d(con)m(trol)j +(sym)m(b)s(ols)d(to)j(switc)m(h)f(c)m(harset,)j(it)c(is)g +(theoretically)574 5546 y(p)s(ossible)29 b(to)j(represen)m(t)f(the)h(o) +s(dd)e(digit)g(as)h(a)g(Co)s(de)g(128-A)i(or)e(128-B)i(sym)m(b)s(ol,)e +(but)f(this)g(to)s(ol)574 5645 y(do)s(esn't)h(curren)m(tly)e(implemen)m +(t)g(this)g(option\).)p eop +%%Page: 8 9 +8 8 bop 94 -116 a Fl(Chapter)30 b(6:)41 b(Supp)s(orted)29 +b(Enco)s(dings)2417 b(8)94 365 y Fh(co)s(de)31 b(128)h(ra)m(w)574 +465 y Fl(Co)s(de-128)24 b(output)d(represen)m(ted)h(sym)m(b)s(ol-b)m +(y-sym)m(b)s(ol)e(in)h(the)h(input)f(string.)36 b(T)-8 +b(o)23 b(o)m(v)m(erride)f(part)574 565 y(of)27 b(the)g(problems)d +(outlined)h(b)s(elo)m(w)g(in)g(sp)s(ecifying)f(co)s(de128)k(sym)m(b)s +(ols,)e(this)f(pseudo-enco)s(ding)574 664 y(allo)m(ws)42 +b(the)h(used)f(to)h(sp)s(ecify)e(a)i(list)e(of)i(co)s(de128)h(sym)m(b)s +(ols)d(separated)i(b)m(y)g(spaces.)77 b(Eac)m(h)574 764 +y(sym)m(b)s(ol)31 b(is)g(represen)m(ted)h(b)m(y)g(a)g(n)m(um)m(b)s(er)f +(in)g(the)h(range)g(0-105.)48 b(The)31 b(list)g(should)f(include)g(the) +574 863 y(leading)e(c)m(haracter.The)i(c)m(hec)m(ksum)g(and)e(the)h +(stop)g(c)m(haracter)h(are)f(automatically)g(added)f(b)m(y)574 +963 y(the)k(library)-8 b(.)42 b(Most)33 b(lik)m(ely)d(this)g +(pseudo-enco)s(ding)g(will)f(b)s(e)i(used)f(with)g Fj(BARCODE_NO_ASCII) +574 1063 y Fl(and)g(some)h(external)f(program)g(to)i(supply)27 +b(the)k(prin)m(ted)e(text.)94 1245 y Fh(co)s(de)37 b(39)180 +b Fl(The)36 b(co)s(de-39)h(standard)f(can)g(enco)s(de)g(upp)s(ercase)g +(letters,)i(digits,)e(the)g(blank)f(space,)k(plus,)574 +1345 y(min)m(us,)d(dot,)i(star,)f(dollar,)f(slash,)g(p)s(ercen)m(t.)57 +b(An)m(y)36 b(string)f(that)h(is)f(only)g(comp)s(osed)g(of)h(suc)m(h) +574 1445 y(c)m(haracters)j(is)e(accepted)h(b)m(y)g(the)f(co)s(de-39)i +(enco)s(der.)61 b(T)-8 b(o)38 b(a)m(v)m(oid)g(lo)s(osing)e +(information,)i(the)574 1544 y(enco)s(der)c(refuses)g(to)h(enco)s(de)f +(mixed-case)g(strings)f(\(a)i(lo)m(w)m(ercase)g(string)e(is)g +(nonetheless)h(ac-)574 1644 y(cepted)d(as)g(a)g(shortcut,)f(but)g(is)f +(enco)s(ded)h(as)h(upp)s(ercase\).)94 1826 y Fh(in)m(terlea)m(v)m(ed)g +(2)g(of)g(5)574 1926 y Fl(This)36 b(enco)s(ding)g(can)i(only)e +(represen)m(t)h(an)g(ev)m(en)h(n)m(um)m(b)s(er)e(of)h(digits)f(\(o)s +(dd)h(digits)f(are)h(repre-)574 2026 y(sen)m(ted)c(b)m(y)g(bars,)f(and) +g(ev)m(en)h(digits)e(b)m(y)i(the)f(in)m(terlea)m(ving)g(spaces\).)48 +b(The)32 b(name)g(stresses)h(the)574 2125 y(fact)i(that)g(t)m(w)m(o)g +(of)f(the)g(\014v)m(e)g(items)f(\(bars)h(or)f(spaces\))i(allo)s(cated)f +(to)g(eac)m(h)h(sym)m(b)s(ol)e(are)h(wide,)574 2225 y(while)41 +b(the)i(rest)g(are)g(narro)m(w.)78 b(The)42 b(c)m(hec)m(ksum)h(digit)f +(is)g(optional)f(\(can)j(b)s(e)e(disabled)e(via)574 2325 +y Fj(BARCODE_NO_CHECKSUM)p Fl(\).)f(Since)31 b(the)h(n)m(um)m(b)s(er)e +(of)h(digits,)g(including)d(the)j(c)m(hec)m(ksum,)i(m)m(ust)574 +2424 y(b)s(e)40 b(ev)m(en,)k(a)c(leading)f(zero)i(is)e(inserted)g(in)g +(the)i(string)e(b)s(eing)g(enco)s(ded)g(if)h(needed)f(\(this)h(is)574 +2524 y(sp)s(eci\014cally)29 b(stated)i(in)e(the)h(sp)s(ecs)g(I)g(ha)m +(v)m(e)i(access)g(to\).)94 2707 y Fh(co)s(de)f(128)136 +b Fl(Automatic)31 b(selection)g(b)s(et)m(w)m(een)g(alphab)s(et)f(A,)h +(B)g(and)f(C)h(of)g(the)g(Co)s(de-128)h(standard.)41 +b(This)574 2806 y(enco)s(ding)31 b(can)i(represen)m(t)f(all)f(ASCI)s(I) +f(sym)m(b)s(ols,)i(from)f(0)h(\(NUL\))h(to)g(127)g(\(DEL\),)g(as)g(w)m +(ell)e(as)574 2906 y(four)36 b(sp)s(ecial)e(sym)m(b)s(ols,)i(named)f +(F1,)j(F2,)g(F3,)g(F4.)58 b(The)35 b(set)h(of)g(sym)m(b)s(ols)f(a)m(v) +-5 b(ailable)35 b(in)f(this)574 3005 y(enco)s(ding)g(is)f(not)i(easily) +e(represen)m(ted)i(as)f(input)e(to)k(the)e Fg(b)-5 b(ar)g(c)g(o)g(de)44 +b Fl(library)-8 b(,)33 b(so)i(the)f(follo)m(wing)574 +3105 y(con)m(v)m(en)m(tion)24 b(is)e(used.)38 b(In)22 +b(the)g(input)f(string,)j(whic)m(h)d(is)h(a)h(C-language)g(n)m +(ull-terminated)e(string,)574 3205 y(the)26 b(NUL)g(c)m(har)f(is)g +(represen)m(ted)g(b)m(y)h(the)f(v)-5 b(alue)25 b(128)i(\(0x80,)h +(0200\))g(and)d(the)g(F1-F4)i(c)m(haracters)574 3304 +y(are)f(represen)m(ted)g(b)m(y)f(the)h(v)-5 b(alues)25 +b(193-196)k(\(0xc1-0xc4,)h(0301-0304\).)43 b(The)25 b(v)-5 +b(alues)25 b(ha)m(v)m(e)i(b)s(een)574 3404 y(c)m(hosen)k(to)h(ease)f +(their)e(represen)m(tation)i(as)f(escap)s(e)h(sequences.)574 +3545 y(Since)39 b(the)h(shell)d(do)s(esn't)j(seem)f(to)i(in)m(terpret)d +(escap)s(e)i(sequences)g(on)f(the)h(command)f(line,)574 +3645 y(the)e Fj(")p Fl(-b)p Fj(")e Fl(option)g(cannot)h(b)s(e)f(easily) +g(used)g(to)i(designate)f(the)g(strings)f(to)h(b)s(e)f(enco)s(ded.)57 +b(As)574 3744 y(a)44 b(w)m(ork)-5 b(around)42 b(y)m(ou)i(can)f(resort)h +(to)f(the)h(command)f Fj(echo)p Fl(,)i(either)e(within)d(bac)m(k-tic)m +(ks)45 b(or)574 3844 y(used)34 b(separately)g(to)g(create)i(a)e(\014le) +f(that)i(is)e(then)g(fed)h(to)h(the)f(standard-input)d(of)j +Fg(b)-5 b(ar)g(c)g(o)g(de)44 b Fl({)574 3944 y(assuming)34 +b(y)m(our)h Fj(echo)f Fl(command)h(pro)s(cesses)g(escap)s(e)h +(sequences.)56 b(The)34 b(newline)f(c)m(haracter)574 +4043 y(is)d(esp)s(ecially)f(though)h(to)h(enco)s(de)f(\(but)g(not)h +(imp)s(ossible)c(unless)h(y)m(ou)j(use)f(a)h Fj(csh)e +Fl(v)-5 b(arian)m(t.)574 4184 y(These)35 b(problems)f(only)g(apply)g +(to)i(the)f(command-line)f(to)s(ol;)j(the)f(use)e(of)i(library)c +(functions)574 4284 y(do)s(esn't)44 b(giv)m(e)f(an)m(y)h(problem.)78 +b(In)42 b(needed,)47 b(y)m(ou)c(can)h(use)f(the)h(\\)p +Fg(c)-5 b(o)g(de)46 b(128)f(r)-5 b(aw)10 b Fl(")45 b(pseudo-)574 +4384 y(enco)s(ding)33 b(to)h(represen)m(t)g(co)s(de128)h(sym)m(b)s(ols) +d(b)m(y)h(their)g(n)m(umerical)f(v)-5 b(alue.)50 b(This)31 +b(enco)s(ding)i(is)574 4483 y(used)28 b(late)h(in)e(the)h +(auto-selection)i(mec)m(hanism)d(b)s(ecause)h(\(almost\))i(an)m(y)e +(input)f(string)g(can)i(b)s(e)574 4583 y(represen)m(ted)i(using)e(co)s +(de128.)94 4765 y Fh(Co)s(dabar)138 b Fl(Co)s(dabar)33 +b(can)h(enco)s(de)g(the)g(ten)f(digits)g(and)g(a)h(few)f(sp)s(ecial)f +(sym)m(b)s(ols)g(\(min)m(us,)i(plus,)e(dollar,)574 4865 +y(colon,)k(bar,)g(dot\).)54 b(The)34 b(c)m(haracters)i(\\)p +Fj(A)p Fl(",)h(\\)p Fj(B)p Fl(",)f(\\)p Fj(C)p Fl(")f(and)g(\\)p +Fj(D)p Fl(")g(are)g(used)f(to)h(represen)m(t)g(four)574 +4965 y(di\013eren)m(t)30 b(start/stop)i(c)m(haracters.)42 +b(The)30 b(input)e(string)i(to)h(the)f(barco)s(de)h(library)d(can)i +(include)574 5064 y(the)d(start)g(and)f(stop)h(c)m(haracters)h(or)e +(not)h(include)d(them)j(\(in)e(whic)m(h)h(case)h(\\)p +Fj(A)p Fl(")g(is)f(used)g(as)g(start)574 5164 y(and)38 +b(\\)p Fj(B)p Fl(")g(as)g(stop\).)64 b(Start)38 b(and)f(stop)h(c)m +(haracters)h(in)e(the)h(input)e(string)g(can)j(b)s(e)e(either)g(all)574 +5264 y(lo)m(w)m(ercase)32 b(or)f(all)e(upp)s(ercase)g(and)h(are)h(alw)m +(a)m(ys)g(prin)m(ted)e(as)h(upp)s(ercase.)94 5446 y Fh(Plessey)192 +b Fl(Plessey)39 b(barco)s(des)f(can)h(enco)s(de)g(all)f(the)h +(hexadecimal)f(digits.)64 b(Alphab)s(etic)37 b(digits)g(in)h(the)574 +5546 y(input)25 b(string)g(m)m(ust)h(either)g(b)s(e)f(all)g(lo)m(w)m +(ercase)j(or)e(all)f(upp)s(ercase.)38 b(The)26 b(output)g(text)h(is)e +(alw)m(a)m(ys)574 5645 y(upp)s(ercase.)p eop +%%Page: 9 10 +9 9 bop 94 -116 a Fl(Chapter)30 b(7:)41 b(PCL)30 b(Output)2761 +b(9)94 365 y Fh(MSI)313 b Fl(MSI)39 b(can)g(only)e(enco)s(de)i(the)g +(decimal)e(digits.)64 b(While)38 b(the)h(standard)e(sp)s(eci\014es)h +(either)g(one)574 465 y(or)e(t)m(w)m(o)h(c)m(hec)m(k)g(digits,)e(the)h +(curren)m(t)f(implemen)m(tation)f(in)g(this)g(library)f(only)i +(generates)i(one)574 565 y(c)m(hec)m(k)32 b(digit.)94 +701 y Fh(co)s(de)f(93)180 b Fl(The)30 b(co)s(de-93)h(standard)f(can)g +(nativ)m(ely)g(enco)s(de)g(48)h(di\013eren)m(t)e(c)m(haracters,)j +(including)27 b(upp)s(er-)574 801 y(case)39 b(letters,)h(digits,)e(the) +g(blank)e(space,)k(plus,)e(min)m(us,)g(dot,)h(star,)h(dollar,)e(slash,) +h(p)s(ercen)m(t,)574 901 y(as)31 b(w)m(ell)f(as)g(\014v)m(e)h(sp)s +(ecial)e(c)m(haracters:)43 b(a)30 b(start/stop)i(delimiter)c(and)i +(four)g Fj(")p Fl(shift)f(c)m(haracters)p Fj(")574 1000 +y Fl(used)f(for)f(extended)h(enco)s(ding.)39 b(Using)27 +b(this)g Fj(")p Fl(extended)g(enco)s(ding)p Fj(")g Fl(metho)s(d,)h(an)m +(y)g(standard)574 1100 y(7-bit)34 b(ASCI)s(I)e(c)m(haracter)k(can)e(b)s +(e)f(enco)s(ded,)i(but)e(it)h(tak)m(es)h(up)e(t)m(w)m(o)i(sym)m(b)s(ol) +d(lengths)i(in)e(bar-)574 1200 y(co)s(de)k(if)f(the)g(c)m(haracter)j +(is)c(not)i(nativ)m(ely)f(supp)s(orted)f(\(one)i(of)g(the)f(48\).)58 +b(The)35 b(enco)s(der)g(here)574 1299 y(fully)24 b(implemen)m(ts)g(the) +i(co)s(de)g(93)g(enco)s(ding)f(standard.)38 b(An)m(y)26 +b(c)m(haracters)h(nativ)m(ely)e(supp)s(orted)574 1399 +y(\(A-Z,)35 b(0-9,)h Fj(")p Fl(.)p Fj(+)p Fl(-/$&\045)p +Fj(")p Fl(\))e(will)d(b)s(e)j(enco)s(ded)f(as)h(suc)m(h)g(-)g(for)f(an) +m(y)h(other)h(c)m(haracters)g(\(suc)m(h)f(as)574 1498 +y(lo)m(w)m(er)h(case)g(letters,)g(brac)m(k)m(ets,)h(paren)m(theses,)g +(etc.\),)h(the)d(enco)s(der)f(will)f(rev)m(ert)i(to)h(extended)574 +1598 y(enco)s(ding.)68 b(As)40 b(a)g(note,)j(the)d(option)f(to)h +(exclude)f(the)h(c)m(hec)m(ksum)g(will)d(eliminate)i(the)h(t)m(w)m(o) +574 1698 y(mo)s(dulo-47)f(c)m(hec)m(ksums)g(\(called)g(C)f(and)g(K\))h +(from)f(the)h(barco)s(de,)i(but)d(this)g(probably)f(will)574 +1797 y(mak)m(e)c(it)e(unreadable)e(b)m(y)i(99\045)h(of)g(all)e +(scanning)g(systems.)43 b(These)31 b(c)m(hec)m(ksums)h(are)g(sp)s +(eci\014ed)574 1897 y(to)f(b)s(e)e(used)g(at)i(the)f(\014rm)m(w)m(are)f +(lev)m(el,)h(and)f(their)g(absence)h(will)d(b)s(e)j(in)m(terpreted)f +(as)h(an)f(in)m(v)-5 b(alid)574 1997 y(barco)s(de.)94 +2266 y Fi(7)81 b(PCL)53 b(Output)219 2459 y Fl(While)28 +b(the)h(default)g(output)f(is)g(P)m(ostscript)i(\(p)s(ossibly)c(EPS\),) +j(and)g(P)m(ostscript)g(can)g(b)s(e)f(p)s(ost-pro)s(cessed)94 +2558 y(to)40 b(almost)e(an)m(ything,)i(it)e(is)f(sometimes)i(desirable) +d(to)j(create)h(output)e(directly)f(usable)g(b)m(y)i(the)f(sp)s +(eci\014c)94 2658 y(prin)m(ter)33 b(at)h(hand.)50 b(PCL)33 +b(is)g(curren)m(tly)f(supp)s(orted)g(as)i(an)g(output)f(format)h(for)g +(this)e(reason.)51 b(Please)34 b(note)94 2758 y(that)25 +b(the)f(Y)g(co)s(ordinate)g(for)f(PCL)h(go)s(es)g(from)f(top)i(to)f(b)s +(ottom,)i(while)c(for)h(P)m(ostscript)h(it)g(go)s(es)g(from)g(b)s +(ottom)94 2857 y(to)35 b(top.)51 b(Consisten)m(tly)-8 +b(,)34 b(while)d(in)i(P)m(ostscript)g(y)m(ou)h(sp)s(ecify)f(the)g(b)s +(ottom-left)i(corner)e(as)h(origin,)f(for)h(PCL)94 2957 +y(y)m(ou)d(sp)s(ecify)e(the)i(top-left)f(corner.)219 +3075 y(Barco)s(de)c(output)e(for)h(PCL)f(Prin)m(ters)g(\(HP)h(LaserJet) +g(and)g(compatibles\),)g(w)m(as)h(dev)m(elop)s(ed)e(using)f(PCL5)94 +3175 y(Reference)32 b(man)m(uals)d(from)h(HP)-8 b(.)31 +b(that)g(really)e(refers)h(to)h(these)g(prin)m(ters:)169 +3293 y Fb(\017)60 b Fl(LaserJet)31 b(I)s(I)s(I,)f(I)s(I)s(I)e(P)-8 +b(,)31 b(I)s(I)s(I)e(D,)i(I)s(I)s(I)e(Si,)169 3411 y +Fb(\017)60 b Fl(LaserJet)31 b(4)g(family)169 3529 y Fb(\017)60 +b Fl(LaserJet)31 b(5)g(family)169 3648 y Fb(\017)60 b +Fl(LaserJet)31 b(6)g(family)169 3766 y Fb(\017)60 b Fl(Color)30 +b(LaserJet)169 3884 y Fb(\017)60 b Fl(DeskJet)32 b(1200)g(and)e(1600.) +219 4021 y(Ho)m(w)m(ev)m(er,)g(barco)s(de)e(prin)m(ting)d(uses)i(a)h(v) +m(ery)g(small)e(subset)h(of)g(PCL,)g(probably)f(also)h(LaserJet)h(I)s +(I)f(should)94 4121 y(prin)m(t)i(it)h(without)g(problem,)f(but)g(the)i +(resulting)e(text)i(ma)m(y)g(b)s(e)f(horrible.)219 4239 +y(The)22 b(only)g(real)h(di\013erence)f(from)h(one)g(prin)m(ter)e(to)j +(another)f(really)f(dep)s(ends)f(on)h(whic)m(h)g(fon)m(t)h(are)h(a)m(v) +-5 b(ailable)94 4338 y(in)30 b(the)g(prin)m(ter,)f(used)h(in)f(prin)m +(ting)f(the)j(lab)s(el)d(asso)s(ciated)j(to)g(the)g(bars)f(\(if)f +(requested\).)219 4457 y(Earlier)j(LaserJet)j(supp)s(orts)d(only)h +(bitmaps)f(fon)m(ts,)k(so)e(these)g(are)h(not)f Fj(")p +Fl(scalable)p Fj(")p Fl(.)50 b(\(Ljet)35 b(I)s(I)e(?\),)i(Also)94 +4556 y(these)c(fon)m(ts,)f(when)f(a)m(v)-5 b(ailable,)29 +b(ha)m(v)m(e)i(a)f(sp)s(eci\014ed)e(direction,)h(and)g(not)h(all)f(of)g +(them)h(are)g(a)m(v)-5 b(ailable)29 b(in)g(b)s(oth)94 +4656 y(P)m(ortrait)i(and)f(Landscap)s(e)g(mo)s(de.)219 +4774 y(F)-8 b(rom)23 b(LaserJet)g(4)f(series,)i(\(except)g(4L/5L)f +(that)g(are)g(en)m(try-lev)m(el)f(prin)m(ters\),)h(Arial)e(scalable)h +(fon)m(t)h(should)94 4874 y(b)s(e)30 b(a)m(v)-5 b(ailable,)30 +b(so)h(it's)f(the)g Fj(")p Fl(default)g(fon)m(t)p Fj(")g +Fl(used)g(b)m(y)g(this)f(program.)219 4992 y(LaserJet)41 +b(I)s(I)s(I)d(series)i(prin)m(ters)e(\(and)i(4L,)g(5L\),)h(don't)f +(feature)h Fj(")p Fl(Arial)p Fj(")d Fl(as)i(a)h(residen)m(t)e(fon)m(t,) +k(so)e(y)m(ou)94 5092 y(should)27 b(use)i Fj(BARCODE_OUT_PCL_III)23 +b Fl(instead)28 b(of)h Fj(BARCODE_OUT_PCL.)p Fl(,)c(and)j(fon)m(t)h +(the)g(fon)m(t)h(used)d(will)g(b)s(e)94 5191 y Fj(")p +Fl(Univ)m(ers)p Fj(")j Fl(instead)f(of)i Fj(")p Fl(Arial)p +Fj(")p Fl(.)219 5309 y(Results)26 b(on)i(compatible)e(prin)m(ters,)h +(ma)m(y)h(dep)s(end)d(on)i(consistency)g(of)h(PCL5)f(compatibilit)m(y) +-8 b(,)26 b(in)g(doubt,)94 5409 y(try)31 b(BAR)m(CODE)p +713 5409 28 4 v 33 w(OUT)p 951 5409 V 32 w(PCL)p 1168 +5409 V 32 w(I)s(I)s(I)219 5527 y(PJL)f(commands)g(are)g(not)h(used)f +(here,)g(as)h(it's)f(not)g(v)m(ery)h(compatible.)219 +5645 y(T)-8 b(ested)31 b(Prin)m(ters:)p eop +%%Page: 10 11 +10 10 bop 94 -116 a Fl(Chapter)30 b(8:)41 b(Bugs)31 b(and)f(P)m(ending) +f(Issues.)2211 b(10)169 365 y Fb(\017)60 b Fl(Hp)30 b(LaserJet)h(4050) +169 490 y Fb(\017)60 b Fl(Hp)30 b(LaserJet)h(2100)169 +614 y Fb(\017)60 b Fl(Epson)30 b(N-1200)j(em)m(ul)c(PCL)169 +739 y Fb(\017)60 b Fl(T)-8 b(oshiba)30 b(DP2570)i(\(copier\))f +Fj(+)f Fl(PCL)g(option)169 863 y Fb(\017)60 b Fl(Epson)30 +b(EPL-7100)i(em)m(ul.)40 b(HP)30 b(LaserJet)h(I)s(I:)f(bars)g(prin)m(t) +f(\014ne)g(but)h(text)i(is)d(bad.)94 1146 y Fi(8)81 b(Bugs)52 +b(and)i(P)l(ending)f(Issues.)219 1370 y Fl(The)42 b(curren)m(t)g +(managemen)m(t)h(of)g(b)s(orders/margins)d(is)h(far)h(from)g(optimal.) +75 b(The)42 b(\\default")g(margin)94 1469 y(applied)d(b)m(y)h(the)h +(library)d(in)m(terferes)i(with)f(the)i(external)g(represen)m(tation,)i +(but)d(I)g(feel)g(it)g(is)g(mandatory)94 1569 y(to)f(a)m(v)m(oid)f +(creating)g(barco)s(de)f(output)h(with)e(no)i(surrounding)c(white)j +(space)h(\(the)g(problem)e(is)h(esp)s(ecially)94 1669 +y(relev)-5 b(an)m(t)31 b(for)f(EPS)g(output\).)219 1793 +y(EAN-128)44 b(is)d(not)h(\(y)m(et\))i(supp)s(orted.)73 +b(I)42 b(plan)e(to)j(implemen)m(t)e(it)g(prett)m(y)h(so)s(on)g(and)f +(then)h(bless)f(the)94 1893 y(pac)m(k)-5 b(age)33 b(as)d(v)m(ersion)g +(1.0.)p eop +%%Page: -1 12 +-1 11 bop 3849 -116 a Fl(i)94 365 y Fi(T)-13 b(able)55 +b(of)e(Con)l(ten)l(ts)94 697 y Fk(Barco)t(de)45 b(to)t(ols)16 +b Fa(.)k(.)g(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.) +f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g +(.)h(.)60 b Fk(1)94 955 y(1)135 b(Ov)l(erview)12 b Fa(.)21 +b(.)f(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h +(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.) +f(.)57 b Fk(1)94 1212 y(2)135 b(The)45 b(Underlying)g(Data)h(Structure) +41 b Fa(.)20 b(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)86 +b Fk(1)393 1337 y Fl(2.1)92 b(The)30 b(Fields)19 b Fg(.)14 +b(.)h(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)49 +b Fl(1)692 1436 y(Use)31 b(of)g(the)f Fg(width)39 b Fl(and)30 +b Fg(sc)-5 b(alef)50 b Fl(\014elds.)25 b Fg(.)15 b(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)56 b Fl(2)393 1536 y(2.2)92 b(The)30 b(In)m(termediate)h +(Represen)m(tation)24 b Fg(.)15 b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)54 b Fl(3)94 1768 y Fk(3)135 b(The)45 b(Flags)28 +b Fa(.)20 b(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f +(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.) +f(.)g(.)73 b Fk(3)94 2026 y(4)135 b(F)-11 b(unctions)44 +b(Exp)t(orted)h(b)l(y)g(the)g(Library)37 b Fa(.)19 b(.)h(.)f(.)g(.)h(.) +f(.)h(.)f(.)h(.)f(.)g(.)81 b Fk(4)94 2283 y(5)135 b(The)45 +b Fa(b)-7 b(ar)g(c)g(o)g(de)52 b Fk(fron)l(tend)46 b(program)11 +b Fa(.)19 b(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h +(.)55 b Fk(5)393 2408 y Fl(5.1)92 b(The)30 b(Command)g(Line)24 +b Fg(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g +(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.) +g(.)g(.)g(.)g(.)g(.)g(.)g(.)55 b Fl(5)94 2640 y Fk(6)135 +b(Supp)t(orted)44 b(Enco)t(dings)33 b Fa(.)20 b(.)f(.)g(.)h(.)f(.)h(.)f +(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.) +78 b Fk(7)94 2897 y(7)135 b(PCL)45 b(Output)40 b Fa(.)20 +b(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f +(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)85 +b Fk(9)94 3155 y(8)135 b(Bugs)45 b(and)f(P)l(ending)h(Issues.)36 +b Fa(.)19 b(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h +(.)f(.)g(.)h(.)79 b Fk(10)p eop +%%Trailer +end +userdict /end-hook known{end-hook}if +%%EOF diff --git a/glabels2/barcode-0.98/doc/barcodedoc.txt b/glabels2/barcode-0.98/doc/barcodedoc.txt new file mode 100644 index 0000000..08eadee --- /dev/null +++ b/glabels2/barcode-0.98/doc/barcodedoc.txt @@ -0,0 +1,734 @@ + + +This is barcode.info, produced by makeinfo version 4.0 from +barcode.texinfo. + + This file is the User's Manual for the barcode library (version +0.98). + + + + +*Node: Overview + Overview + ******** + + The "barcode" package is mainly a C library for creating bar-code +output files. It also includes a command line front-end and (in a +foreseeable future) a graphic frontend. + + The package is designed as a library because we think the main use +for barcode-generation tools is inside more featured applications. The +library addresses bar code printing as two distinct problems: creation +of bar information and actual conversion to an output format. To this +aim we use an intermediate representation for bar codes, which is +currently documented in the `ps.c' source file (not in this document). + + Note that the library and the accompanying material is released +according to the GPL license, not the LGPL one. A copy of the GPL is +included in the distribution tarball. + + + + +*Node: The Barcode Object + The Underlying Data Structure + ***************************** + + Every barcode-related function acts on a data structure defined in +the `barcode.h' header, which must be included by any C source file +that uses the library. The header is installed by make install. + + The definition of the data structure is included here for reference: + + struct Barcode_Item { + int flags; /* type of encoding and other flags */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text placement */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ + }; + + The exact meaning of each field and the various flags implemented are +described in the following sections. + + Even though you won't usually need to act on the contents of this +structure, some of the functions in the library receive arguments that +are directly related to one or more of these fields. + + + + +*Node: The Field List + The Fields + ========== + +`int flags;' + The flags are, as you may suspect, meant to specify the exact + behaviour of the library. They are often passed as an argument to + barcode functions and are discussed in the next section. + +`char *ascii;' +`char *partial;' +`char *textinfo;' +`char *encoding;' + These fields are internally managed by the library, and you are + not expected to touch them if you use the provided API. All of + them are allocated with malloc. + +`int width;' +`int height;' + They specify the width and height of the active barcode region + (i.e., excluding the white margin), in the units used to create + output data (for postscript they are points, 1/72th of an inch, + 0.352 mm). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. If either value or + both are left to their default value of zero, the output engine + will assign default values according to the specified scaling + factor. If the specified width is bigger than needed (according to + the scaling factor), the output barcode will be centered in its + requested region. If either the width of the height are too small + for the specified scale factor, the output bar code will expand + symmetrically around the requested region. + +`int xoff;' +`int yoff;' + The fields specify offset from the coordinate origin of the output + engine (for postscript, position 0,0 is the lower left corner of + the page). The fields can be either assigned to in the structure + or via Barcode_Position(), at your choice. The offset specifies + where the white margin begins, not where the first bar will be + printed. To print real ink to the specified position you should + set margin to 0. + +`int margin;' + The white margin that will be left around the printed area of the + bar code. The same margin is applied to all sides of the printed + area. The default value for the margin is defined in `barcode.h' + as BARCODE_DEFAULT_MARGIN (10). + +`double scalef;' + The enlarge or shrink value for the bar code over its default + dimension. The width and scalef fields interact deeply in the + creation of the output, and a complete description of the issues + appears later in this section. + +`int error;' + The field is used when a barcode function fails to host an + errno-like integer value. + +Use of the width and scalef fields. +----------------------------------- + + A width unit is the width of the thinnest bar and/or space in the +chosen code; it defaults to 1 point if the output is postscript or +encapsulated postscript. + + Either or both the code width and the scale factor can be left +unspecified (i.e., zero). The library deals with defaults in the +following way: + +Both unspecified + If both the width and the scale factor are unspecified, the scale + factor will default to 1.0 and the width is calculated according + to the actual width of the bar code being printed. + +Width unspecified + If the width is not specified, it is calculated according to the + values of scalef. + +Scale factor unspecified + If the scale factor is not specified, it will be chosen so that + the generated bar code exactly fits the specified width. + +Both specified + The code will be printed inside the specified region according to + the specified scale factor. It will be aligned to the left. If, + however, the chosen width is too small for the specific bar code + and scaling factor, then the code will extend symmetrically to the + left and to the right of the chosen region. + + + + +*Node: The Intermediate Representation + The Intermediate Representation + =============================== + + The encoding functions print their output into the partial and +texinfo fields of the barcode data structure. Those fields, together +with position information, are then used to generate actual output. +This is an informal description of the intermediate format. + + The first char in partial tells how much extra space to add to the +left of the bars. For EAN-13, it is used to leave space to print the +first digit, other codes may have '0' for no-extra-space-needed. + + The next characters are alternating bars and spaces, as multiples of +the base dimension which is 1 unless the code is rescaled. Rescaling is +calculated as the ratio from the requested width and the calculated +width. Digits represent bar/space dimensions. Lower-case letters +represent those bars that should extend lower than the others: 'a' is +equivalent to '1', 'b' is '2' and so on up to 'i' which is equivalent to +'9'. Other letters will be used for encoding-specific meanings, as soon +as I implement them. + + The textinfo string is made up of fields %lf:%lf:%c separated by +blank space. The first integer is the x position of the character, the +second is the font size (before rescaling) and the char item is the +character to be printed. + + Both the partial and textinfo strings may include "-" or "+" as +special characters (in textinfo the char should be a stand-alone word). +They state where the text should be printed: below the bars ("-", +default) or above the bars. This is used, for example, to print the +add-5 and add-2 codes to the right of UPC or EAN codes (the add-5 +extension is mostly used in ISBN codes). + + + + +*Node: Supported Flags + The Flags + ********* + + The following flags are supported by version 0.98 of the library: + +`BARCODE_ENCODING_MASK' + The mask is used to extract the encoding-type identifier from the + flags field. + +`BARCODE_EAN' +`BARCODE_UPC' +`BARCODE_ISBN' +`BARCODE_128B' +`BARCODE_128C' +`BARCODE_128' +`BARCODE_128RAW' +`BARCODE_39' +`BARCODE_I25' +`BARCODE_CBR' +`BARCODE_MSI' +`BARCODE_PLS' +`BARCODE_93' + The currently supported encoding types: EAN (13 digits, 8 digits, + 13 + 2 add-on and 13 + 5 add-on), UPC (UPC-A, UPC-E, UPC-A with 2 + or 5 digit add-on), ISBN (with or without the 5-digit add-on), + CODE128-B (the whole set of printable ASCII characters), CODE128-C + (two digits encoded by each barcode symbol), CODE128 (all ASCII + values), a "raw-input" pseudo-code that generates CODE128 output, + CODE39 (alphanumeric), "interleaved 2 of 5" (numeric), Codabar + (numeric plus a few symbols), MSI (numeric) and Plessey (hex + digits). *Note Supported Encodings::. + +`BARCODE_ANY' + This special encoding type (represented by a value of zero, so it + will be the default) tells the encoding procedure to look for the + first encoding type that can deal with a textual string. + Therefore, a 11-digit code will be printed as UPC (as well as + 6-digit, 11+2 and 11+5), a 12-digit (or 7-digit, or 12+2 or 12+5) + as EAN13, an ISBN code (with or without hyphens, with or without + add-5) will be encoded in its EAN13 representation, an even number + of digits is encoded using CODE128C and a generic string is + encoded using CODE128B. Since code-39 offers a much larger + representation for the same text string, code128-b is preferred + over code39 for alphanumeric strings. + +`BARCODE_NO_ASCII' + Instructs the engine not to print the ascii string on output. By + default the bar code is accompanied with an ascii version of the + text it encodes. + +`BARCODE_NO_CHECKSUM' + Instructs the engine not to add the checksum character to the + output. Not all the encoding types can drop the checksum; those + where the checksum is mandatory (like EAN and UPC) just ignore the + flag. + +`BARCODE_OUTPUT_MASK' + The mask is used to extract the output-type identifier from the + flags field. + +`BARCODE_OUT_PS' +`BARCODE_OUT_EPS' +`BARCODE_OUT_PCL' +`BARCODE_OUT_PCL_III' + The currently supported encoding types: full-page postscript and + encapsulated postscript; PCL (print command language, for HP + printers) and PCL-III (same as PCL, but uses a font not available + on older printers). + +`BARCODE_OUT_NOHEADERS' + The flag instructs the printing engine not to print the header and + footer part of the file. This makes sense for the postscript + engine but might not make sense for other engines; such other + engines will silently ignore the flag just like the PCL back-end + does. + + + + +*Node: The API + Functions Exported by the Library + ********************************* + + The functions included in the barcode library are declared in the +header file barcode.h. They perform the following tasks: + +`struct Barcode_Item *Barcode_Create(char *text);' + The function creates a new barcode object to deal with a specified + text string. It returns NULL in case of failure and a pointer to + a barcode data structure in case of success. + +`int Barcode_Delete(struct Barcode_Item *bc);' + Destroy a barcode object. Always returns 0 (success) + +`int Barcode_Encode(struct Barcode_Item *bc, int flags);' + Encode the text included in the bc object. Valid flags are the + encoding type (other flags are ignored) and BARCODE_NO_CHECKSUM + (other flags are silently ignored); if the flag argument is zero, + bc->flags will apply. The function returns 0 on success and -1 in + case of error. After successful termination the data structure + will host the description of the bar code and its textual + representation, after a failure the error field will include the + reason of the failure. + +`int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags);' + Print the bar code described by bc to the specified file. Valid + flags are the output type, BARCODE_NO_ASCII and + BARCODE_OUT_NOHEADERS, other flags are ignored. If any of these + flags is zero, it will be inherited from bc->flags which therefore + takes precedence. The function returns 0 on success and -1 in case + of error (with bc->error set accordingly). In case of success, the + bar code is printed to the specified file, which won't be closed + after use. + +`int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, int xoff, int yoff, double scalef);' + The function is a shortcut to assign values to the data structure. + +`int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags);' + The function deals with the whole life of the barcode object by + calling the other functions; it uses all the specified flags. + +`int Barcode_Version(char *versionname);' + Returns the current version as an integer number of the form major + * 10000 + minor * 100 + release. Therefore, version 1.03.5 will be + returned as 10305 and version 0.53 as 5300. If the argument is + non-null, it will be used to return the version number as a + string. Note that the same information is available from two + preprocessor macros: BARCODE_VERSION (the string) and + BARCODE_VERSION_INT (the integer number). + + + + +*Node: The barcode Executable + The barcode frontend program + **************************** + + The barcode program is a front-end to access some features of the +library from the command line. It is able to read user supplied +strings from the command line or a data file (standard input by default) +and encode all of them. + + + + +*Node: The Command Line + The Command Line + ================ + + barcode accepts the following options: + +`--help or -h' + Print a usage summary and exit. + +`-i filename' + Identify a file where strings to be encoded are read from. If + missing (and if -b is not used) it defaults to standard input. + Each data line of the input file will be used to create one + barcode output. + +`-o filename' + Output file. It defaults to standard output. + +`-b string' + Specify a single "barcode" string to be encoded. The option can + be used multiple times in order to encode multiple strings (this + will result in multi-page postscript output or a table of barcodes + if -t is specified). The strings must match the encoding chosen; + if it doesn't match the program will print a warning to stderr and + generate "blank" output (although not zero-length). Please note + that a string including spaces or other special characters must be + properly quoted. + +`-e encoding' + encoding is the name of the chosen encoding format being used. It + defaults to the value of the environment variable BARCODE_ENCODING + or to auto detection if the environment is also unset. + +`-g geometry' + The geometry argument is of the form "[<width> x <height>] [+ + <xmargin> + <ymargin>]" (with no intervening spaces). Unspecified + margin values will result in no margin; unspecified size results + in default size. The specified values represent print points by + default, and can be inches, millimeters or other units according + to the -u option or the BARCODE_UNIT environment variable. The + argument is used to place the printout code on the page. Note that + an additional white margin of 10 points is added to the printout. + If the option is unspecified, BARCODE_GEOMETRY is looked up in the + environment, if missing a default size and no margin (but the + default 10 points) are used. + +`-t table-geometry' + Used to print several barcodes to a single page, this option is + meant to be used to print stickers. The argument is of the form + "<columns> x <lines> [+ <leftmargin> + <bottommargin> [- + <rightmargin> [- <topmargin>]]]" (with no intervening spaces); if + missing, the top and right margin will default to be the same as + the bottom and left margin. The margins are specified in print + points or in the chosen unit (see -u below). If the option is not + specified, BARCODE_TABLE is looked up in the environment, + otherwise no table is printed and each barcode will get its own + page. The size (but not the position) of a barcode item within a + table can also be selected using -g (see "geometry" above), + without struggling with external and internal margins. I still + think management of geometries in a table is suboptimal, but I + can't make it better without introducing incompatibilities. + +`-m margin(s)' + Specifies an internal margin for each sticker in the table. The + argument is of the form "<xmargin>,<ymargin>" and the margin is + applied symmetrically to the sticker. If unspecified, the + environment variable BARCODE_MARGIN is used or a default internal + margin of 10 points is used. + +`-n' + "Numeric" output: don't print the ASCII form of the code, only the + bars. + +`-c' + No checksum character (for encodings that allow it, like code 39, + other codes, like UPC or EAN, ignore this option). + +`-E' + Encapsulated postscript (default is normal postscript). When the + output is generated as EPS only one barcode is encoded. + +`-P' + PCL output. Please note that the Y direction goes from top to + bottom for PCL, and the origin for an image is the top-left corner + instead of the bottom-left + +`-p pagesize' + Specify a non-default page size. The page size can be specified in + millimeters, inches or plain numbers (for example: "210x297mm", + "8.5x11in", "595x842"). A page specification as numbers will be + interpreted according to the current unit specification (see -u + below). If libpaper is available, you can also specify the page + size with its name, like "A3" or "letter" (libpaper is a standard + component of Debian GNU/Linux, but may be missing elsewhere). The + default page size is your system-wide default if libpaper is + there, A4 otherwise. + +`-u unit' + Choose the unit used in size specifications. Accepted values are + "mm", "cm", "in" and "pt". By default, the program will check + BARCODE_UNIT in the environment, and assume points otherwise (this + behaviour is compatible with 0.92 and previous versions. If -u + appears more than once, each instance will modified the behaviour + for the arguments at its right, as the command line is processes + left to right. The program internally works with points, and any + size is approximated to the nearest multiple of one point. The -u + option affect -g (geometry), -t (table) and -p (page size). + + + + +*Node: Supported Encodings + Supported Encodings + ******************* + + The program encodes text strings passed either on the command line +(with -b) or retrieved from standard input. The text representation is +interpreted according to the following rules. When auto-detection of +the encoding is enabled (i.e, no explicit encoding type is specified), +the encoding types are scanned to find one that can digest the text +string. The following list of supported types is sorted in the same +order the library uses when auto-detecting a suitable encoding for a +string. + +EAN + The EAN frontend is similar to UPC; it accepts strings of digits, + 12 or 7 characters long. Strings of 13 or 8 characters are + accepted if the provided checksum digit is correct. I expect most + users to feed input without a checksum, though. The add-2 and + add-5 extension are accepted for both the EAN-13 and the EAN-8 + encodings. The following are example of valid input strings: + "123456789012" (EAN-13), "1234567890128" (EAN-13 wih checksum), + "1234567" (EAN-8), "12345670 12345" (EAN-8 with checksum and + add-5), "123456789012 12" (EAN-13 with add-2), "123456789012 + 12345" (EAN-13 with add-5). + +UPC + The UPC frontend accepts only strings made up of digits (and, if a + supplemental encoding is used, a blank to separate it). It + accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8 digits + (UPC-E). + + The 12th digit of UPC-A is the checksum and is added by the + library if not specified in the input; if it is specified, it must + be the right checksum or the code is rejected as invalid. For + UPC-E, 6 digit are considered to be the middle part of the code, a + leading 0 is assumed and the checksum is added; 7 digits are + either considered the initial part (leading digit 0 or 1, checksum + missing) or the final part (checksum specified, leading 0 + assumed); 8 digits are considered to be the complete code, with + leading 0 or 1 and checksum. For both UPC-A and UPC-E, a trailing + string of 2 digits or 5 digits is accepted as well. Therefore, the + following are examples of valid strings that can be encoded as UPC: + "01234567890" (UPC-A) "012345678905" (UPC-A with checksum), + "012345" (UPC-E), "01234567890 12" (UPC-A, add-2) and "01234567890 + 12345" (UPC-A, add-5), "0123456 12" (UPC-E, add-2). Please note + that when setting BARCODE_ANY to auto-detect the encoding to be + used, 12-digit strings and 7-digit strings will always be + identified as EAN. This because I expect most user to provide + input without a checksum. If you need to specify UPC-with-checksum + as input you must explicitly set BARCODE_UPC as a flag or use -e + upc on the command line. + +ISBN + 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". + +CODE 128-B + This encoding can represent all of the printing ASCII characters, + from the space (32) to DEL (127). The checksum digit is mandatory + in this encoding. + +CODE 128-C + 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). + +CODE 128 RAW + 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. + +CODE 39 + 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). + +INTERLEAVED 2 OF 5 + 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). + +CODE 128 + 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. + +CODABAR + 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. + +PLESSEY + 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. + +MSI + 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. + +CODE 93 + The 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. + + + + +*Node: PCL Output + PCL Output + ********** + + While the default output is Postscript (possibly EPS), and Postscript +can be post-processed to almost anything, it is sometimes desirable to +create output directly usable by the specific printer at hand. PCL is +currently supported as an output format for this reason. Please note +that the Y coordinate for PCL goes from top to bottom, while for +Postscript it goes from bottom to top. Consistently, while in +Postscript you specify the bottom-left corner as origin, for PCL you +specify the top-left corner. + + Barcode output for PCL Printers (HP LaserJet and compatibles), was +developed using PCL5 Reference manuals from HP. that really refers to +these printers: + * LaserJet III, III P, III D, III Si, + + * LaserJet 4 family + + * LaserJet 5 family + + * LaserJet 6 family + + * Color LaserJet + + * DeskJet 1200 and 1600. + + + However, barcode printing uses a very small subset of PCL, probably +also LaserJet II should print it without problem, but the resulting +text may be horrible. + + The only real difference from one printer to another really depends +on which font are available in the printer, used in printing the label +associated to the bars (if requested). + + Earlier LaserJet supports only bitmaps fonts, so these are not +"scalable". (Ljet II ?), Also these fonts, when available, have a +specified direction, and not all of them are available in both Portrait +and Landscape mode. + + From LaserJet 4 series, (except 4L/5L that are entry-level printers), +Arial scalable font should be available, so it's the "default font" +used by this program. + + LaserJet III series printers (and 4L, 5L), don't feature "Arial" as a +resident font, so you should use BARCODE_OUT_PCL_III instead of +BARCODE_OUT_PCL., and font the font used will be "Univers" instead of +"Arial". + + Results on compatible printers, may depend on consistency of PCL5 +compatibility, in doubt, try BARCODE_OUT_PCL_III + + PJL commands are not used here, as it's not very compatible. + + Tested Printers: + * Hp LaserJet 4050 + + * Hp LaserJet 2100 + + * Epson N-1200 emul PCL + + * Toshiba DP2570 (copier) + PCL option + + * Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is + bad. + + + + +*Node: Bugs and Pending Issues + Bugs and Pending Issues. + ************************ + + The current management of borders/margins is far from optimal. The +"default" margin applied by the library interferes with the external +representation, but I feel it is mandatory to avoid creating barcode +output with no surrounding white space (the problem is especially +relevant for EPS output). + + EAN-128 is not (yet) supported. I plan to implement it pretty soon +and then bless the package as version 1.0. + + + + + +Tag Table:Node: Top153 + Node: Overview525 + Node: The Barcode Object1403 +Node: The Field List2820 +Node: The Intermediate Representation6585 +Node: Supported Flags8358 +Node: The API11342 +Node: The barcode Executable14028 +Node: The Command Line14457 +Node: Supported Encodings19556 +Node: PCL Output28996 +Node: Bugs and Pending Issues31315 + + + +End Tag Table
\ No newline at end of file diff --git a/glabels2/barcode-0.98/doc/doc.barcode b/glabels2/barcode-0.98/doc/doc.barcode new file mode 100644 index 0000000..7b46055 --- /dev/null +++ b/glabels2/barcode-0.98/doc/doc.barcode @@ -0,0 +1,939 @@ +\input texinfo @c -*-texinfo-*- +% +% doc.barcode - main file for the documentation +% +%%%% + +%------------------------------------------------------------------------------ +% +% NOTE FOR THE UNAWARE USER +% ========================= +% +% This file is a texinfo source. It isn't the binary file of some strange +% editor of mine. If you want ascii, you should "make barcodedoc.txt". +% +%------------------------------------------------------------------------------ + +% +% This is not a conventional info file... +% I use two extra features: +% - The '%' as a comment marker, if at beg. of line ("\%" -> "%") +% - leading blanks are allowed +% + +@comment %**start of header +@setfilename barcode.info +@settitle Barcode @value{version} +@iftex +@afourpaper +@end iftex +@comment %**end of header + +@setchapternewpage off + +@set version 0.98 +@set update-month March 2002 + +@finalout + +@ifinfo + +This file is the User's Manual for the barcode library (version +@value{version}). + +@end ifinfo + +@setchapternewpage odd +@titlepage +@c use the new format for titles +@title barcode @value{version} +@subtitle A library for drawing bar codes +@subtitle @value{update-month} + +@author by Alessandro Rubini (@code{rubini@@gnu.org}) + +@end titlepage +@setchapternewpage off +@headings single + + +@node Top, Overview, (dir), (dir) +@top Barcode tools + +This file documents version @value{version} of the barcode +library and sample programs (@value{update-month}). + +@menu +* Overview:: +* The Barcode Object:: +* Supported Flags:: +* The API:: +* The barcode Executable:: +* Supported Encodings:: +* PCL Output:: +* Bugs and Pending Issues:: +@end menu + + +%########################################################################## +%########################################################################## + +@node Overview, The Barcode Object, Top, Top +@chapter Overview + +The @dfn{barcode} package is mainly a C library for creating bar-code +output files. It also includes a command line front-end and (in a +foreseeable future) a graphic frontend. + +The package is designed as a library because we think the main use for +barcode-generation tools is inside more featured applications. The +library addresses bar code printing as two distinct problems: creation +of bar information and actual conversion to an output format. To this +aim we use an intermediate representation for bar codes, which is +currently documented in the @file{ps.c} source file (not in this +document). + +Note that the library and the accompanying material is released +according to the GPL license, not the LGPL one. A copy of the GPL is +included in the distribution tarball. + +%########################################################################## + +@node The Barcode Object, Supported Flags, Overview, Top +@chapter The Underlying Data Structure + +Every barcode-related function acts on a data structure defined in the +@file{barcode.h} header, which must be included by any C source file +that uses the library. The header is installed by @t{make install}. + +The definition of the data structure is included here for reference: + +@lisp +struct Barcode_Item @{ + int flags; /* type of encoding and other flags */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text placement */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ +@}; +@end lisp + +The exact meaning of each field and the various flags implemented are +described in the following sections. + +Even though you won't usually need to act on the contents of this +structure, some of the functions in the library receive arguments that +are directly related to one or more of these fields. + +%========================================================================== + +@menu +* The Field List:: +* The Intermediate Representation:: +@end menu + +%-------------------------------------------------------------------------- +@node The Field List, The Intermediate Representation, The Barcode Object, The Barcode Object +@section The Fields + +@table @code + +@item int flags; + + The flags are, as you may suspect, meant to specify the exact + behaviour of the library. They are often passed as an argument + to @i{barcode} functions and are discussed in the next section. + +@item char *ascii; +@itemx char *partial; +@itemx char *textinfo; +@itemx char *encoding; + + These fields are internally managed by the library, and you are + not expected to touch them if you use the provided API. All + of them are allocated with @i{malloc}. + +@item int width; +@itemx int height; + + They specify the width and height of the @i{active} barcode + region (i.e., excluding the white margin), in the units used + to create output data (for postscript they are points, 1/72th + of an inch, 0.352 mm). The fields can be either assigned to + in the structure or via @i{Barcode_Position()}, at your + choice. If either value or both are left to their default + value of zero, the output engine will assign default values + according to the specified scaling factor. If the specified + width is bigger than needed (according to the scaling factor), + the output barcode will be centered in its requested + region. If either the width of the height are too small for + the specified scale factor, the output bar code will expand + symmetrically around the requested region. + +@item int xoff; +@itemx int yoff; + + The fields specify offset from the coordinate origin of the + output engine (for postscript, position 0,0 is the lower left + corner of the page). The fields can be either assigned to in + the structure or via @i{Barcode_Position()}, at your choice. + The offset specifies where the white margin begins, not where + the first bar will be printed. To print real ink to the + specified position you should set @i{margin} to 0. + +@item int margin; + + The white margin that will be left around the printed area of + the bar code. The same margin is applied to all sides of the + printed area. The default value for the margin is defined in + @file{barcode.h} as @t{BARCODE_DEFAULT_MARGIN} (10). + +@item double scalef; + + The enlarge or shrink value for the bar code over its default + dimension. The @i{width} and @i{scalef} fields interact deeply + in the creation of the output, and a complete description of + the issues appears later in this section. + +@item int error; + + The field is used when a @i{barcode} function fails to host + an @t{errno}-like integer value. + +@end table + + +@unnumberedsubsec Use of the @i{width} and @i{scalef} fields. + +A width unit is the width of the thinnest bar and/or space in the +chosen code; it defaults to 1 point if the output is postscript or +encapsulated postscript. + +Either or both the code width and the scale factor can be left +unspecified (i.e., zero). The library deals with defaults in the +following way: + +@table @i + +@item Both unspecified + + If both the width and the scale factor are unspecified, the + scale factor will default to 1.0 and the width is calculated + according to the actual width of the bar code being printed. + +@item Width unspecified + + If the width is not specified, it is calculated according to + the values of @i{scalef}. + +@item Scale factor unspecified + + If the scale factor is not specified, it will be chosen so + that the generated bar code exactly fits the specified width. + +@item Both specified + + The code will be printed inside the specified region according + to the specified scale factor. It will be aligned to the left. + If, however, the chosen width is too small for the specific + bar code and scaling factor, then the code will extend + symmetrically to the left and to the right of the chosen + region. + +@end table + +%-------------------------------------------------------------------------- +@node The Intermediate Representation, , The Field List, The Barcode Object +@section The Intermediate Representation + +The encoding functions print their output into the @t{partial} and +@t{texinfo} fields of the barcode data structure. Those fields, together +with position information, are then used to generate actual output. +This is an informal description of the intermediate format. + +The first char in @t{partial} tells how much extra space to add to the +left of the bars. For EAN-13, it is used to leave space to print the +first digit, other codes may have '0' for no-extra-space-needed. + +The next characters are alternating bars and spaces, as multiples of the +base dimension which is 1 unless the code is rescaled. Rescaling is +calculated as the ratio from the requested width and the calculated +width. Digits represent bar/space dimensions. Lower-case letters +represent those bars that should extend lower than the others: 'a' is +equivalent to '1', 'b' is '2' and so on up to 'i' which is equivalent to +'9'. Other letters will be used for encoding-specific meanings, as soon +as I implement them. + +The @t{textinfo} string is made up of fields @t{%lf:%lf:%c} separated by +blank space. The first integer is the x position of the character, +the second is the font size (before rescaling) and the char item is +the character to be printed. + +Both the @t{partial} and @t{textinfo} strings may include ``@t{-}'' or +``@t{+}'' as special characters (in @t{textinfo} the char should be a +stand-alone word). They state where the text should be printed: below +the bars (``@t{-}'', default) or above the bars. This is used, for +example, to print the add-5 and add-2 codes to the right of UPC or EAN +codes (the add-5 extension is mostly used in ISBN codes). + + + + +%========================================================================== + +@node Supported Flags, The API, The Barcode Object, Top +@chapter The Flags + +The following flags are supported by version @value{version} of the +library: + +@table @code + +@item BARCODE_ENCODING_MASK + + The mask is used to extract the encoding-type identifier from + the @i{flags} field. + +@item BARCODE_EAN +@itemx BARCODE_UPC +@itemx BARCODE_ISBN +@itemx BARCODE_128B +@itemx BARCODE_128C +@itemx BARCODE_128 +@itemx BARCODE_128RAW +@itemx BARCODE_39 +@itemx BARCODE_I25 +@itemx BARCODE_CBR +@itemx BARCODE_MSI +@itemx BARCODE_PLS +@itemx BARCODE_93 + + The currently supported encoding types: EAN (13 digits, 8 + digits, 13 + 2 add-on and 13 + 5 add-on), UPC (UPC-A, UPC-E, + UPC-A with 2 or 5 digit add-on), ISBN (with or without the + 5-digit add-on), CODE128-B (the whole set of printable + ASCII characters), CODE128-C (two digits encoded by each barcode + symbol), CODE128 (all ASCII values), a ``raw-input'' pseudo-code + that generates CODE128 output, CODE39 (alphanumeric), + "interleaved 2 of 5" (numeric), Codabar (numeric plus a few + symbols), MSI (numeric) and Plessey (hex digits). + @xref{Supported Encodings}. + +@item BARCODE_ANY + + This special encoding type (represented by a value of zero, so + it will be the default) tells the encoding procedure to look + for the first encoding type that can deal with a textual + string. Therefore, a 11-digit code will be printed as UPC (as + well as 6-digit, 11+2 and 11+5), a 12-digit (or 7-digit, or + 12+2 or 12+5) as EAN13, an ISBN code (with or without hyphens, + with or without add-5) will be encoded in its EAN13 + representation, an even number of digits is encoded using + CODE128C and a generic string is encoded using CODE128B. Since + code-39 offers a much larger representation for the same + text string, code128-b is preferred over code39 for + alphanumeric strings. + +@item BARCODE_NO_ASCII + + Instructs the engine not to print the ascii string on + output. By default the bar code is accompanied with an ascii + version of the text it encodes. + +@item BARCODE_NO_CHECKSUM + + Instructs the engine not to add the checksum character to the + output. Not all the encoding types can drop the checksum; + those where the checksum is mandatory (like EAN and UPC) + just ignore the flag. + +@item BARCODE_OUTPUT_MASK + + The mask is used to extract the output-type identifier from + the @i{flags} field. + +@item BARCODE_OUT_PS +@itemx BARCODE_OUT_EPS +@itemx BARCODE_OUT_PCL +@itemx BARCODE_OUT_PCL_III + + The currently supported encoding types: full-page postscript + and encapsulated postscript; PCL (print command language, for + HP printers) and PCL-III (same as PCL, but uses a font not + available on older printers). + +@item BARCODE_OUT_NOHEADERS + + The flag instructs the printing engine not to print the header + and footer part of the file. This makes sense for the + postscript engine but might not make sense for other engines; + such other engines will silently ignore the flag just like + the PCL back-end does. + +@end table + +%########################################################################## + +@node The API, The barcode Executable, Supported Flags, Top +@chapter Functions Exported by the Library + +%MANPAGE barcode.3 +%M .TH BARCODE 3 "October 1999" "GNU" "GNU barcode" +%M .UC 4 +%M .SH NAME +%M barcode \- a library to create and print bar codes +%M .SH SYNOPSIS +%M .B #include <barcode.h> +%M .sp +%M .BI "struct Barcode_Item *Barcode_Create(char *" text ");" +%M .br +%M .BI "int Barcode_Delete(struct Barcode_Item *" bc ");" +%M .br +%M .BI "int Barcode_Encode(struct Barcode_Item *" bc ", int " flags ");" +%M .br +%M .BI "int Barcode_Print(struct Barcode_Item *" bc ", FILE *" f ", int " flags ");" +%M .br +%M .BI "int Barcode_Position(struct Barcode_Item *" bc ", int " wid ", int " hei ", int " xoff ", int " yoff " , double " scalef ");" +%M .br +%M .BI "int Barcode_Encode_and_Print(char *" text ", FILE *" f ", int " wid ", int " hei ", int " xoff ", int " yoff ", int " flags ");" +%M .br +%M .BI "int Barcode_Version(char *" versionname ");" +%M +%M .SH DESCRIPTION +%M +%M The barcode family of library functions is meant to ease +%M creation of bar-code printouts. +%M +%M The information below is extracted from the texinfo file, which is the +%M preferred source of information. + +The functions included in the barcode library are declared in the +header file @t{barcode.h}. They perform the following tasks: + +@table @code + +@item struct Barcode_Item *Barcode_Create(char *text); + The function creates a new barcode object to deal with a + specified text string. It returns NULL in case of failure and + a pointer to a barcode data structure in case of success. + +@item int Barcode_Delete(struct Barcode_Item *bc); + Destroy a barcode object. Always returns 0 (success) + +@item int Barcode_Encode(struct Barcode_Item *bc, int flags); + Encode the text included in the @i{bc} object. Valid flags are + the encoding type (other flags are ignored) and + BARCODE_NO_CHECKSUM (other flags are silently ignored); if the + flag argument is zero, @t{bc->flags} will apply. The function + returns 0 on success and -1 in case of error. After + successful termination the data structure will host the + description of the bar code and its textual representation, + after a failure the @t{error} field will include the reason of + the failure. + +@item int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); + Print the bar code described by @t{bc} to the specified file. + Valid flags are the output type, @t{BARCODE_NO_ASCII} and + @t{BARCODE_OUT_NOHEADERS}, other flags are ignored. If any of + these flags is zero, it will be inherited from @t{bc->flags} + which therefore takes precedence. The function returns 0 on + success and -1 in case of error (with @t{bc->error} set + accordingly). In case of success, the bar code is printed to + the specified file, which won't be closed after use. + +@item int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, int xoff, int yoff, double scalef); + The function is a shortcut to assign values to the data + structure. + +@item int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, int xoff, int yoff, int flags); + The function deals with the whole life of the barcode + object by calling the other functions; it uses all the specified + flags. + +@item int Barcode_Version(char *versionname); + Returns the current version as an integer number of the form + major * 10000 + minor * 100 + release. Therefore, version + 1.03.5 will be returned as 10305 and version 0.53 as 5300. If + the argument is non-null, it will be used to return the version + number as a string. Note that the same information is available from + two preprocessor macros: @t{BARCODE_VERSION} (the string) and + @t{BARCODE_VERSION_INT} (the integer number). + +@end table + +%MANPAGE END + +%########################################################################## + +@node The barcode Executable, Supported Encodings, The API, Top +@chapter The @i{barcode} frontend program + +%MANPAGE barcode.1 +%M .TH BARCODE 1 "October 2001" "GNU" "GNU barcode" +%M .UC 4 +%M .SH NAME +%M barcode \- a stand alone program to run the barcode library +%M .SH SYNOPSIS +%M .B barcode +%M [\-b - | string] [\-e encoding] [\-o - | outfile] [ +%M .I other-flags +%M ] +%M .SH DESCRIPTION +%M +%M The information below is extracted from the texinfo file, which is the +%M preferred source of information. +%M .PP +The @b{barcode} program is a front-end to access some features of the +library from the command line. It is able to read user supplied +strings from the command line or a data file (standard input by default) +and encode all of them. + +%M .SH OPTIONS +%M .PP + +@menu +* The Command Line:: +@end menu + +%-------------------------------------------------------------------------- +@node The Command Line, , The barcode Executable, The barcode Executable +@section The Command Line + + +@b{barcode} accepts the following options: + +@table @code + +@item --help or -h + Print a usage summary and exit. + +@item -i filename + Identify a file where strings to be encoded are read from. If + missing (and if @t{-b} is not used) it defaults to standard + input. Each data line of the input file will be used to create + one barcode output. + +@item -o filename + Output file. It defaults to standard output. + +@item -b string + Specify a single ``barcode'' string to be encoded. + The option can be used multiple times in order to encode + multiple strings (this will result in multi-page postscript + output or a table of barcodes if @t{-t} is specified). The + strings must match the encoding chosen; if it doesn't + match the program will print a warning to @t{stderr} and + generate ``blank'' output (although not zero-length). + Please note that a string including spaces or + other special characters must be properly quoted. + +@item -e encoding + @b{encoding} is the name of the chosen encoding format being + used. It defaults to the value of the environment variable + @t{BARCODE_ENCODING} or to auto detection if the environment is + also unset. + +@item -g geometry + The geometry argument is of the form ``[@i{<width>} @t{x} + @i{<height>}] [@t{+} @i{<xmargin>} @t{+} @i{<ymargin>}]'' (with + no intervening spaces). Unspecified margin values will result in + no margin; unspecified size results in default size. + The specified values represent print points by + default, and can be inches, millimeters or other units + according to the @t{-u} option or the @t{BARCODE_UNIT} + environment variable. The argument is used to place the + printout code on the page. Note that an additional white + margin of 10 points is added to the printout. If the option is + unspecified, @t{BARCODE_GEOMETRY} is looked up in the + environment, if missing a default size and no margin (but the + default 10 points) are used. + +@item -t table-geometry + Used to print several barcodes to a single page, this option + is meant to be used to print stickers. The argument is of the + form ``@i{<columns>} @t{x} @i{<lines>} [@t{+} @i{<leftmargin>} + @t{+} @i{<bottommargin>} [@t{-} @i{<rightmargin>} [@t{-} + @i{<topmargin>}]]]'' (with no intervening spaces); if missing, + the top and right margin will default to be the same as the + bottom and left margin. The margins are specified in print + points or in the chosen unit (see @t{-u} below). If the + option is not specified, @t{BARCODE_TABLE} is looked up in the + environment, otherwise no table is printed and each barcode + will get its own page. The size (but not the position) + of a barcode item within a table can also be selected using + @t{-g} (see "geometry" above), without struggling with + external and internal margins. I still think management of + geometries in a table is suboptimal, but I can't make it + better without introducing incompatibilities. + + +@item -m margin(s) + Specifies an internal margin for each sticker in the + table. The argument is of the form + ``@i{<xmargin>}@t{,}@i{<ymargin>}'' and the margin is applied + symmetrically to the sticker. If unspecified, the environment + variable @t{BARCODE_MARGIN} is used or a default internal + margin of 10 points is used. + +@item -n + ``Numeric'' output: don't print the ASCII form of the code, + only the bars. + +@item -c + No checksum character (for encodings that allow it, like code 39, + other codes, like UPC or EAN, ignore this option). + +@item -E + Encapsulated postscript (default is normal postscript). When + the output is generated as EPS only one barcode is encoded. + +@item -P + PCL output. Please note that the Y direction goes from top + to bottom for PCL, and the origin for an image is the top-left + corner instead of the bottom-left + +@item -p pagesize + Specify a non-default page size. The page size can be specified + in millimeters, inches or plain numbers (for example: "@t{210x297mm}", + "@t{8.5x11in}", "@t{595x842}"). A page specification as numbers + will be interpreted according to the current unit specification + (see @t{-u} below). If libpaper is available, + you can also specify the page size with its name, like "@t{A3}" + or "@t{letter}" (libpaper is a standard component of Debian + GNU/Linux, but may be missing elsewhere). The default page + size is your system-wide default if libpaper is there, A4 otherwise. + +@item -u unit + Choose the unit used in size specifications. Accepted values + are ``mm'', ``cm'', ``in'' and ``pt''. By default, the program + will check @t{BARCODE_UNIT} in the environment, and assume + points otherwise (this behaviour is compatible with 0.92 and + previous versions. If @t{-u} appears more than once, each + instance will modified the behaviour for the arguments at its + right, as the command line is processes left to right. The + program internally works with points, and any size is + approximated to the nearest multiple of one point. The @t{-u} + option affect @t{-g} (geometry), @t{-t} (table) and @t{-p} + (page size). + +@end table + +%M .SH ENCODING TYPES +%M .PP + +%########################################################################## +@node Supported Encodings, PCL Output, The barcode Executable, Top +@chapter Supported Encodings + +The program encodes text strings passed either on the command line +(with -b) or retrieved from standard input. The text representation is +interpreted according to the following rules. When auto-detection +of the encoding is enabled (i.e, no explicit encoding type is specified), +the encoding types are scanned to find one that can digest the text string. +The following list of supported types is sorted in the same order +the library uses when auto-detecting a suitable encoding for a string. + +@table @var + +@item EAN + The EAN frontend is similar to UPC; it accepts strings of + digits, 12 or 7 characters long. Strings of 13 or 8 characters + are accepted if the provided checksum digit is correct. + I expect most users to feed input without a + checksum, though. The add-2 and add-5 extension are accepted for both + the EAN-13 and the EAN-8 encodings. + The following are example of valid input strings: + ``@t{123456789012}'' (EAN-13), ``@t{1234567890128}'' (EAN-13 wih + checksum), ``@t{1234567}'' (EAN-8), ``@t{12345670 12345}'' (EAN-8 + with checksum and add-5), + ``@t{123456789012 12}'' (EAN-13 with add-2), + ``@t{123456789012 12345}'' (EAN-13 with add-5). + +@item UPC + The UPC frontend accepts only strings made up of digits (and, + if a supplemental encoding is used, a blank to separate it). + It accepts strings of 11 or 12 digits (UPC-A) and 6 or 7 or 8 + digits (UPC-E). + + The 12th digit of UPC-A is the checksum and is added by the + library if not specified in the input; if it is specified, it + must be the right checksum or the code is rejected as invalid. + For UPC-E, 6 digit are considered to be the middle part of the + code, a leading 0 is assumed and the checksum is added; + 7 digits are either considered the initial part (leading digit + 0 or 1, checksum missing) or the final part (checksum specified, + leading 0 assumed); 8 digits are considered to be the complete code, + with leading 0 or 1 and checksum. + For both UPC-A and UPC-E, a trailing string of 2 digits or 5 digits + is accepted as well. Therefore, the following are examples + of valid strings that can be encoded as UPC: + ``@t{01234567890}'' (UPC-A) + ``@t{012345678905}'' (UPC-A with checksum), ``@t{012345}'' + (UPC-E), ``@t{01234567890 12}'' (UPC-A, add-2) and + ``@t{01234567890 12345}'' (UPC-A, add-5), ``@t{0123456 12}'' + (UPC-E, add-2). + Please note that when setting @t{BARCODE_ANY} to auto-detect + the encoding to be used, 12-digit strings and 7-digit strings + will always be identified as EAN. This because I expect most + user to provide input without a checksum. If you need to + specify UPC-with-checksum as input you must explicitly set + @t{BARCODE_UPC} as a flag or use @t{-e upc} on the command line. + +@item ISBN + 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: + ``@t{1-56592-292-1}'', ``@t{3-89721-122-X}'' and ``@t{3-89721-122-X + 06900}''. + +@item code 128-B + This encoding can represent all of the printing ASCII + characters, from the space (32) to DEL (127). The checksum + digit is mandatory in this encoding. + +@item code 128-C + 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). + +@item code 128 raw + 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 + @t{BARCODE_NO_ASCII} and some external program to supply the + printed text. + +@item code 39 + 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). + +@item interleaved 2 of 5 + 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 @t{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). + +@item code 128 + 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 @i{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 @t{echo}, either within back-ticks or used + separately to create a file that is then fed to the standard-input + of @i{barcode} -- assuming your @t{echo} command processes escape + sequences. The newline character is especially though to encode + (but not impossible unless you use a @t{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 ``@i{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. + +@item Codabar + Codabar can encode the ten digits and a few special symbols + (minus, plus, dollar, colon, bar, dot). The characters + ``@t{A}'', ``@t{B}'', ``@t{C}'' and ``@t{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 ``@t{A}'' is + used as start and ``@t{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. + +@item Plessey + 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. + +@item MSI + 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. + +@item code 93 + The 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. + + +@end table + +%M .SH PCL OUTPUT + +%########################################################################## +@node PCL Output, Bugs and Pending Issues, Supported Encodings, Top +@chapter PCL Output + +While the default output is Postscript (possibly EPS), and Postscript +can be post-processed to almost anything, it is sometimes desirable to +create output directly usable by the specific printer at hand. +PCL is currently supported as an output format for this reason. +Please note that the Y coordinate for PCL goes from top to bottom, while +for Postscript it goes from bottom to top. Consistently, while in +Postscript you specify the bottom-left corner as origin, for PCL +you specify the top-left corner. + +Barcode output for PCL Printers (HP LaserJet and compatibles), +was developed using PCL5 Reference manuals from HP. +that really refers to these printers: +@itemize @bullet + +@item +LaserJet III, III P, III D, III Si, + +@item +LaserJet 4 family + +@item +LaserJet 5 family + +@item +LaserJet 6 family + +@item +Color LaserJet + +@item +DeskJet 1200 and 1600. + +@end itemize + +However, barcode printing uses a very small subset of PCL, probably also +LaserJet II should print it without problem, but the resulting text may +be horrible. + +The only real difference from one printer to another really depends on +which font are available in the printer, used in printing the label +associated to the bars (if requested). + +Earlier LaserJet supports only bitmaps fonts, so these are not +"scalable". (Ljet II ?), Also these fonts, when available, have a +specified direction, and not all of them are available in +both Portrait and Landscape mode. + +From LaserJet 4 series, (except 4L/5L that are entry-level printers), +Arial scalable font should be available, so it's the "default font" +used by this program. + +LaserJet III series printers (and 4L, 5L), don't feature "Arial" as a +resident font, so you should use @t{BARCODE_OUT_PCL_III} instead of +@t{BARCODE_OUT_PCL.}, and font the font used will be "Univers" instead +of "Arial". + +Results on compatible printers, may depend on consistency of +PCL5 compatibility, in doubt, try BARCODE_OUT_PCL_III + +PJL commands are not used here, as it's not very compatible. + + +Tested Printers: +@itemize @bullet +@item +Hp LaserJet 4050 +@item +Hp LaserJet 2100 +@item +Epson N-1200 emul PCL +@item +Toshiba DP2570 (copier) + PCL option +@item +Epson EPL-7100 emul. HP LaserJet II: bars print fine but text is bad. +@end itemize + + +%M .SH BUGS + +%########################################################################## +@node Bugs and Pending Issues, , PCL Output, Top +@chapter Bugs and Pending Issues. + +The current management of borders/margins is far from optimal. The +``default'' margin applied by the library interferes with the external +representation, but I feel it is mandatory to avoid creating barcode +output with no surrounding white space (the problem is especially +relevant for EPS output). + +EAN-128 is not (yet) supported. I plan to implement it pretty soon and +then bless the package as version 1.0. + +%M .SH "SEE ALSO" +%M \fBbarcode(3)\fP +%M +%M .SH AUTHORS +%M Alessandro Rubini <rubini@gnu.org> (maintainer) +%M .PP +%M Leonid A. Broukhis <leob@mailcom.com> (several encodings) +%M .PP +%M Andrea Scopece <a.scopece@tin.it> (PCL output) +%MANPAGE END + +@iftex +@contents +@end iftex + +@bye +@c LocalWords: barcode ifinfo titlepage iftex texinfo ascii frontend LGPL +@c LocalWords: tarball malloced textinfo scalef isbn Plessey codabar GPL Ljet +@c LocalWords: LocalWords LaserJet Univers Arial Debian libpaper pagesize +@c LocalWords: Epson MANPAGE stderr barcodes emul DeskJet xmargin ymargin +@c LocalWords: leftmargin rightmargin topmargin bottommargin unset struct +@c LocalWords: NOHEADERS yoff xoff versionname errno malloc behaviour charset diff --git a/glabels2/barcode-0.98/doc/infofilter b/glabels2/barcode-0.98/doc/infofilter new file mode 100755 index 0000000..92bc8b7 --- /dev/null +++ b/glabels2/barcode-0.98/doc/infofilter @@ -0,0 +1,16 @@ +#! /usr/bin/sed -f + + +# allow "%" as a comment char, but only at the beginning of the line +s/^%/@c / +#s/[^\\]%.*$// +s/^\\%/%/ + +#preserve blanks in @lisp blocks +/@lisp/,/@end lisp/ p +/@lisp/,/@end lisp/ d + +# remove leading blanks +s/^[ ]*// + +#s/\\t/@code/g diff --git a/glabels2/barcode-0.98/doc/manpager b/glabels2/barcode-0.98/doc/manpager new file mode 100755 index 0000000..46de5be --- /dev/null +++ b/glabels2/barcode-0.98/doc/manpager @@ -0,0 +1,120 @@ +#! /usr/bin/awk -f +# Copyright (c) 1998-2001 Alessandro Rubini + +BEGIN {IN=0} + +/^%MANPAGE END/ {IN=0; next} +/^%MANPAGE/ {IN=1; USELP=NEEDLP=INTABLE=0; NAME=$2; next} +IN==0 {next} + +/^%MSKIP/ {SKIP=1;next} +/^%M/ {SKIP=0} + +/^@menu/ {SKIP=1;next} +/^@end menu/ {SKIP=0;next} + +SKIP==1 {next} +/^%M$/ {next} +/^@ignore/ {next} +/^@end ign/ {next} + +#now perform all the substitutions needed + + { gsub("^%M ?",""); } + +# Use gensub for converting tags: itz Sep 30 1998 +# +# However, the gensub function is gawk-specific, and we want things +# to work with original-awk too (for portability). +# Therefore, use a normal gsub, even though it's a subobptimal solution +# as it may step in extra braces. The good solution will be piping to sed, +# or match, extract subesxpression, replace, reinsert -- bleah... +# (ARub, Oct 10 2000) +/@b\{/ { + #$0 = gensub(/@b\{([^}]+)\}/, "\\\\fB\\1\\\\fP","g"); + gsub("@b\{","\\fB"); + gsub("\}","\\fP"); +} + +/@var\{/ { + #$0 = gensub(/@var\{([^}]+)\}/, "\\\\fI\\1\\\\fP","g"); + gsub("@var\{","\\fB"); + gsub("\}","\\fP"); +} + +/@(samp|code|file)\{/ { + #$0 = gensub(/@(samp|code|file)\{([^}]+)\}/, "`\\2'","g"); + gsub("@(samp|code|file)\{",""); + gsub("\}",""); +} + + +/@xref\{.*\}\./ { + gsub(/@xref\{.*\}\./,""); +} + +/@ref\{.*\}/ { + gsub("@ref\{",""); + gsub("\}",""); +} + +/@\*/ { + gsub(/@\* */,"\n.br\n"); +} + +/@[a-z]+\{/ { + gsub("@[a-z]+\\{",""); + gsub("}",""); + } + +/^@table/ { TABLE=1; } +/^@itemize/ { TABLE=1; next} + +/^@item/ { + gsub("^@item *",""); + printf ".TP\n%s\n",$0 > NAME; + NEEDLP=0; next; + } + +/^@end table/ {TABLE=0} +/^@end itemize/ {TABLE=0} + +# discard other texinfo commands + +/^@/ {next} + +# manage comments and '%' + +/^%/ {next} + + + { + gsub("[^\\\\]%.*$",""); + gsub("\\%","%"); + } + +# remove leading blanks + +/^[ \t]/ {gsub("^[ \t]*","");} + +# put a .LP at blank lines + +/^.nf/ {USELP=0} +/^.fi/ {USELP=1} + +/^$/ {if (USELP) {NEEDLP++; next;} } + + +/./ { if (NEEDLP) { printf "\n.LP\n" > NAME; NEEDLP=0; } } + +/^.TH/ {USELP=1} + +# Escape single slashes (e.g. in documentation for `-l' command line option) + + {gsub("\\\\ ", "\\\\ ");} + + {gsub("~", "~~");} + + {print > NAME} + + diff --git a/glabels2/barcode-0.98/doc/mktxt b/glabels2/barcode-0.98/doc/mktxt new file mode 100755 index 0000000..bd3f88b --- /dev/null +++ b/glabels2/barcode-0.98/doc/mktxt @@ -0,0 +1,38 @@ +#! /usr/bin/awk -f + +# Warning: this may use gnu-awk features + +# Program to create ascii from info; +# Missing: table of contents + +# skip + +BEGIN {NODELINE=0; NODE=0; KEEP=1; printf "\n\n"} + + +/^\037$/ { NODELINE=1; NODE=NODE+1; KEEP=1; next} + +NODE==1 { next } + +NODELINE==1 { + NODELINE=2; + sub("^.*Node: ","*Node: "); + sub(",.*$",""); + printf "\n\n\n%s",$0; +#print + next; + } + +NODELINE { NODELINE=NODELINE+1 } + +NODELINE==4 { printf "\t\t\t\t"; } +NODELINE==5 { printf "\t\t\t\t"; NODELINE=0} + + +/^\* Menu:$/ { KEEP=0 } + + + +KEEP==0 { next } + +{ print } diff --git a/glabels2/barcode-0.98/doc/texi2html b/glabels2/barcode-0.98/doc/texi2html new file mode 100755 index 0000000..2c61aa9 --- /dev/null +++ b/glabels2/barcode-0.98/doc/texi2html @@ -0,0 +1,2021 @@ +#!/usr/local/bin/perl +'di '; +'ig 00 '; +#+############################################################################## +# # +# File: texi2html # +# # +# Description: Program to transform most Texinfo documents to HTML # +# # +#-############################################################################## + +# @(#)texi2html 1.51 09/10/96 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch + +# The man page for this program is included at the end of this file and can be +# viewed using the command 'nroff -man texi2html'. +# Please read the copyright at the end of the man page. + +#+++############################################################################ +# # +# Constants # +# # +#---############################################################################ + +$DEBUG_TOC = 1; +$DEBUG_INDEX = 2; +$DEBUG_BIB = 4; +$DEBUG_GLOSS = 8; +$DEBUG_DEF = 16; +$DEBUG_HTML = 32; +$DEBUG_USER = 64; + +$BIBRE = '\[[\w\/]+\]'; # RE for a bibliography reference +$FILERE = '[\/\w.+-]+'; # RE for a file name +$VARRE = '[^\s\{\}]+'; # RE for a variable name +$NODERE = '[^@{}:\'`",]+'; # RE for a node name +$NODESRE = '[^@{}:\'`"]+'; # RE for a list of node names +$XREFRE = '[^@{}]+'; # RE for a xref (should use NODERE) + +$ERROR = "***"; # prefix for errors and warnings +$THISPROG = "texi2html 1.51"; # program name and version +$HOMEPAGE = "http://wwwcn.cern.ch/dci/texi2html/"; # program home page +$TODAY = &pretty_date; # like "20 September 1993" +$SPLITTAG = "<!-- SPLIT HERE -->\n"; # tag to know where to split +$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections +$html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//EN">'; + +# +# language dependent constants +# +#$LDC_SEE = 'see'; +#$LDC_SECTION = 'section'; +#$LDC_IN = 'in'; +#$LDC_TOC = 'Table of Contents'; +#$LDC_GOTO = 'Go to the'; +#$LDC_FOOT = 'Footnotes'; +# TODO: @def* shortcuts + +# +# pre-defined indices +# +%predefined_index = ( + 'cp', 'c', + 'fn', 'f', + 'vr', 'v', + 'ky', 'k', + 'pg', 'p', + 'tp', 't', + ); + +# +# valid indices +# +%valid_index = ( + 'c', 1, + 'f', 1, + 'v', 1, + 'k', 1, + 'p', 1, + 't', 1, + ); + +# +# texinfo section names to level +# +%sec2level = ( + 'top', 0, + 'chapter', 1, + 'unnumbered', 1, + 'majorheading', 1, + 'chapheading', 1, + 'appendix', 1, + 'section', 2, + 'unnumberedsec', 2, + 'heading', 2, + 'appendixsec', 2, + 'appendixsection', 2, + 'subsection', 3, + 'unnumberedsubsec', 3, + 'subheading', 3, + 'appendixsubsec', 3, + 'subsubsection', 4, + 'unnumberedsubsubsec', 4, + 'subsubheading', 4, + 'appendixsubsubsec', 4, + ); + +# +# accent map, TeX command to ISO name +# +%accent_map = ( + '"', 'uml', + '~', 'tilde', + '^', 'circ', + '`', 'grave', + '\'', 'acute', + ); + +# +# texinfo "simple things" (@foo) to HTML ones +# +%simple_map = ( + # cf. makeinfo.c + "*", "<BR>", # HTML+ + " ", " ", + "\n", "\n", + "|", "", + # spacing commands + ":", "", + "!", "!", + "?", "?", + ".", ".", + ); + +# +# texinfo "things" (@foo{}) to HTML ones +# +%things_map = ( + 'TeX', 'TeX', + 'br', '<P>', # paragraph break + 'bullet', '*', + 'copyright', '(C)', + 'dots', '...', + 'equiv', '==', + 'error', 'error-->', + 'expansion', '==>', + 'minus', '-', + 'point', '-!-', + 'print', '-|', + 'result', '=>', + 'today', $TODAY, + ); + +# +# texinfo styles (@foo{bar}) to HTML ones +# +%style_map = ( + 'asis', '', + 'b', 'B', + 'cite', 'CITE', + 'code', 'CODE', + 'ctrl', '&do_ctrl', # special case + 'dfn', 'STRONG', # DFN tag is illegal in the standard + 'dmn', '', # useless + 'emph', 'EM', + 'file', '"TT', # will put quotes, cf. &apply_style + 'i', 'I', + 'kbd', 'KBD', + 'key', 'KBD', + 'r', '', # unsupported + 'samp', '"SAMP', # will put quotes, cf. &apply_style + 'sc', '&do_sc', # special case + 'strong', 'STRONG', + 't', 'TT', + 'titlefont', '', # useless + 'var', 'VAR', + 'w', '', # unsupported + ); + +# +# texinfo format (@foo/@end foo) to HTML ones +# +%format_map = ( + 'display', 'PRE', + 'example', 'PRE', + 'format', 'PRE', + 'lisp', 'PRE', + 'quotation', 'BLOCKQUOTE', + 'smallexample', 'PRE', + 'smalllisp', 'PRE', + # lists + 'itemize', 'UL', + 'enumerate', 'OL', + # poorly supported + 'flushleft', 'PRE', + 'flushright', 'PRE', + ); + +# +# texinfo definition shortcuts to real ones +# +%def_map = ( + # basic commands + 'deffn', 0, + 'defvr', 0, + 'deftypefn', 0, + 'deftypevr', 0, + 'defcv', 0, + 'defop', 0, + 'deftp', 0, + # basic x commands + 'deffnx', 0, + 'defvrx', 0, + 'deftypefnx', 0, + 'deftypevrx', 0, + 'defcvx', 0, + 'defopx', 0, + 'deftpx', 0, + # shortcuts + 'defun', 'deffn Function', + 'defmac', 'deffn Macro', + 'defspec', 'deffn {Special Form}', + 'defvar', 'defvr Variable', + 'defopt', 'defvr {User Option}', + 'deftypefun', 'deftypefn Function', + 'deftypevar', 'deftypevr Variable', + 'defivar', 'defcv {Instance Variable}', + 'defmethod', 'defop Method', + # x shortcuts + 'defunx', 'deffnx Function', + 'defmacx', 'deffnx Macro', + 'defspecx', 'deffnx {Special Form}', + 'defvarx', 'defvrx Variable', + 'defoptx', 'defvrx {User Option}', + 'deftypefunx', 'deftypefnx Function', + 'deftypevarx', 'deftypevrx Variable', + 'defivarx', 'defcvx {Instance Variable}', + 'defmethodx', 'defopx Method', + ); + +# +# things to skip +# +%to_skip = ( + # comments + 'c', 1, + 'comment', 1, + # useless + 'contents', 1, + 'shortcontents', 1, + 'summarycontents', 1, + 'footnotestyle', 1, + 'end ifclear', 1, + 'end ifset', 1, + 'titlepage', 1, + 'end titlepage', 1, + # unsupported commands (formatting) + 'afourpaper', 1, + 'cropmarks', 1, + 'finalout', 1, + 'headings', 1, + 'need', 1, + 'page', 1, + 'setchapternewpage', 1, + 'everyheading', 1, + 'everyfooting', 1, + 'evenheading', 1, + 'evenfooting', 1, + 'oddheading', 1, + 'oddfooting', 1, + 'smallbook', 1, + 'vskip', 1, + 'filbreak', 1, + # unsupported formats + 'cartouche', 1, + 'end cartouche', 1, + 'group', 1, + 'end group', 1, + ); + +#+++############################################################################ +# # +# Argument parsing, initialisation # +# # +#---############################################################################ + +$use_bibliography = 1; +$use_acc = 0; +$debug = 0; +$doctype = ''; +$check = 0; +$expandinfo = 0; +$use_glossary = 0; +$invisible_mark = ''; +$use_iso = 0; +@include_dirs = (); +$show_menu = 0; +$number_sections = 0; +$split_node = 0; +$split_chapter = 0; +$monolithic = 0; +$verbose = 0; +$usage = <<EOT; +This is $THISPROG +To convert a Texinfo file to HMTL: $0 [options] file + where options can be: + -expandinfo : use \@ifinfo sections, not \@iftex + -glossary : handle a glossary + -invisible name: use 'name' as an invisible anchor + -I dir : search also for files in 'dir' + -menu : handle menus + -monolithic : output only one file including ToC + -number : number sections + -split_chapter : split on main sections + -split_node : split on nodes + -usage : print usage instructions + -verbose : verbose output +To check converted files: $0 -check [-verbose] files +EOT + +while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) { + $_ = shift(@ARGV); + if (/^-acc$/) { $use_acc = 1; next; } + if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; } + if (/^-doctype$/) { $doctype = shift(@ARGV); next; } + if (/^-c(heck)?$/) { $check = 1; next; } + if (/^-e(xpandinfo)?$/) { $expandinfo = 1; next; } + if (/^-g(lossary)?$/) { $use_glossary = 1; next; } + if (/^-i(nvisible)?$/) { $invisible_mark = shift(@ARGV); next; } + if (/^-iso$/) { $use_iso = 1; next; } + if (/^-I(.+)?$/) { push(@include_dirs, $1 || shift(@ARGV)); next; } + if (/^-m(enu)?$/) { $show_menu = 1; next; } + if (/^-mono(lithic)?$/) { $monolithic = 1; next; } + if (/^-n(umber)?$/) { $number_sections = 1; next; } + if (/^-s(plit)?_?(n(ode)?|c(hapter)?)?$/) { + if ($2 =~ /^n/) { + $split_node = 1; + } else { + $split_chapter = 1; + } + next; + } + if (/^-v(erbose)?$/) { $verbose = 1; next; } + die $usage; +} +if ($check) { + die $usage unless @ARGV > 0; + ✓ + exit; +} + +if (($split_node || $split_chapter) && $monolithic) { + warn "Can't use -monolithic with -split, -monolithic ignored.\n"; + $monolithic = 0; +} +if ($expandinfo) { + $to_skip{'ifinfo'}++; + $to_skip{'end ifinfo'}++; +} else { + $to_skip{'iftex'}++; + $to_skip{'end iftex'}++; +} +$invisible_mark = '<IMG SRC="invisible.xbm">' if $invisible_mark eq 'xbm'; +die $usage unless @ARGV == 1; +$docu = shift(@ARGV); +if ($docu =~ /.*\//) { + chop($docu_dir = $&); + $docu_name = $'; +} else { + $docu_dir = '.'; + $docu_name = $docu; +} +unshift(@include_dirs, $docu_dir); +$docu_name =~ s/\.te?x(i|info)?$//; # basename of the document + +$docu_doc = "$docu_name.html"; # document's contents +if ($monolithic) { + $docu_toc = $docu_foot = $docu_doc; +} else { + $docu_toc = "${docu_name}_toc.html"; # document's table of contents + $docu_foot = "${docu_name}_foot.html"; # document's footnotes +} + +# +# variables +# +%value = (); # hold texinfo variables +$value{'html'} = 1; # predefine html (the output format) +$value{'texi2html'} = '1.51'; # predefine texi2html (the translator) +# _foo: internal to track @foo +foreach ('_author', '_title', '_subtitle', + '_settitle', '_setfilename') { + $value{$_} = ''; # prevent -w warnings +} +%node2sec = (); # node to section name +%node2href = (); # node to HREF +%bib2href = (); # bibliography reference to HREF +%gloss2href = (); # glossary term to HREF +@sections = (); # list of sections +%tag2pro = (); # protected sections + +# +# initial indexes +# +$bib_num = 0; +$foot_num = 0; +$gloss_num = 0; +$idx_num = 0; +$sec_num = 0; +$doc_num = 0; +$html_num = 0; + +# +# can I use ISO8879 characters? (HTML+) +# +if ($use_iso) { + $things_map{'bullet'} = "•"; + $things_map{'copyright'} = "©"; + $things_map{'dots'} = "…"; + $things_map{'equiv'} = "≡"; + $things_map{'expansion'} = "→"; + $things_map{'point'} = "∗"; + $things_map{'result'} = "⇒"; +} + +# +# read texi2html extensions (if any) +# +$extensions = 'texi2html.ext'; # extensions in working directory +if (-f $extensions) { + print "# reading extensions from $extensions\n" if $verbose; + require($extensions); +} +($progdir = $0) =~ s/[^\/]+$//; +if ($progdir && ($progdir ne './')) { + $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory + if (-f $extensions) { + print "# reading extensions from $extensions\n" if $verbose; + require($extensions); + } +} + +print "# reading from $docu\n" if $verbose; + +#+++############################################################################ +# # +# Pass 1: read source, handle command, variable, simple substitution # +# # +#---############################################################################ + +@lines = (); # whole document +@toc_lines = (); # table of contents +$toplevel = 0; # top level seen in hierarchy +$curlevel = 0; # current level in TOC +$node = ''; # current node name +$in_table = 0; # am I inside a table +$table_type = ''; # type of table ('', 'f', 'v') +@tables = (); # nested table support +$in_bibliography = 0; # am I inside a bibliography +$in_glossary = 0; # am I inside a glossary +$in_top = 0; # am I inside the top node +$in_pre = 0; # am I inside a preformatted section +$in_list = 0; # am I inside a list +$in_html = 0; # am I inside an HTML section +$first_line = 1; # is it the first line +$dont_html = 0; # don't protect HTML on this line +$split_num = 0; # split index +$deferred_ref = ''; # deferred reference for indexes +@html_stack = (); # HTML elements stack +$html_element = ''; # current HTML element +&html_reset; + +# build code for simple substitutions +# the maps used (%simple_map and %things_map) MUST be aware of this +# watch out for regexps, / and escaped characters! +$subst_code = ''; +foreach (keys(%simple_map)) { + ($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars + $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n"; +} +foreach (keys(%things_map)) { + $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n"; +} +if ($use_acc) { + # accentuated characters + foreach (keys(%accent_map)) { + if ($_ eq "`") { + $subst_code .= "s/$;3"; + } elsif ($_ eq "'") { + $subst_code .= "s/$;4"; + } else { + $subst_code .= "s/\\\@\\$_"; + } + $subst_code .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n"; + } +} +eval("sub simple_substitutions { $subst_code }"); + +&init_input; +while ($_ = &next_line) { + # + # remove \input on the first lines only + # + if ($first_line) { + next if /^\\input/; + $first_line = 0; + } + # + # parse texinfo tags + # + $tag = ''; + $end_tag = ''; + if (/^\@end\s+(\w+)\b/) { + $end_tag = $1; + } elsif (/^\@(\w+)\b/) { + $tag = $1; + } + # + # handle @ifhtml / @end ifhtml + # + if ($in_html) { + if ($end_tag eq 'ifhtml') { + $in_html = 0; + } else { + $tag2pro{$in_html} .= $_; + } + next; + } elsif ($tag eq 'ifhtml') { + $in_html = $PROTECTTAG . ++$html_num; + push(@lines, $in_html); + next; + } + # + # try to skip the line + # + if ($end_tag) { + next if $to_skip{"end $end_tag"}; + } elsif ($tag) { + next if $to_skip{$tag}; + last if $tag eq 'bye'; + } + if ($in_top) { + # parsing the top node + if ($tag eq 'node' || $tag eq 'include' || $sec2level{$tag}) { + # no more in top + $in_top = 0; + } else { + # skip it + next; + } + } + # + # try to remove inlined comments + # syntax from tex-mode.el comment-start-skip + # + s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/; + # non-@ substitutions cf. texinfmt.el + s/``/\"/g; + s/''/\"/g; + s/([\w ])---([\w ])/$1--$2/g; + # + # analyze the tag + # + if ($tag) { + # skip lines + &skip_until($tag), next if $tag eq 'ignore'; + if ($expandinfo) { + &skip_until($tag), next if $tag eq 'iftex'; + } else { + &skip_until($tag), next if $tag eq 'ifinfo'; + } + &skip_until($tag), next if $tag eq 'tex'; + # handle special tables + if ($tag eq 'table') { + $table_type = ''; + } elsif ($tag eq 'ftable') { + $tag = 'table'; + $table_type = 'f'; + } elsif ($tag eq 'vtable') { + $tag = 'table'; + $table_type = 'v'; + } + # special cases + if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) { + $in_top = 1; + @lines = (); # ignore all lines before top (title page garbage) + next; + } elsif ($tag eq 'node') { + $in_top = 0; + warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o; + $_ = &protect_html($_); # if node contains '&' for instance + s/^\@node\s+//; + ($node) = split(/,/); + &normalise_node($node); + if ($split_node) { + &next_doc; + push(@lines, $SPLITTAG) if $split_num++; + push(@sections, $node); + } + next; + } elsif ($tag eq 'include') { + if (/^\@include\s+($FILERE)\s*$/o) { + $file = $1; + unless (-e $file) { + foreach $dir (@include_dirs) { + $file = "$dir/$1"; + last if -e $file; + } + } + if (-e $file) { + &open($file); + print "# including $file\n" if $verbose; + } else { + warn "$ERROR Can't find $file, skipping"; + } + } else { + warn "$ERROR Bad include line: $_"; + } + next; + } elsif ($tag eq 'ifclear') { + if (/^\@ifclear\s+($VARRE)\s*$/o) { + next unless defined($value{$1}); + &skip_until($tag); + } else { + warn "$ERROR Bad ifclear line: $_"; + } + next; + } elsif ($tag eq 'ifset') { + if (/^\@ifset\s+($VARRE)\s*$/o) { + next if defined($value{$1}); + &skip_until($tag); + } else { + warn "$ERROR Bad ifset line: $_"; + } + next; + } elsif ($tag eq 'menu') { + unless ($show_menu) { + &skip_until($tag); + next; + } + &html_push_if($tag); + push(@lines, &html_debug("\n", __LINE__)); + } elsif ($format_map{$tag}) { + $in_pre = 1 if $format_map{$tag} eq 'PRE'; + &html_push_if($format_map{$tag}); + push(@lines, &html_debug("\n", __LINE__)); + $in_list++ if $format_map{$tag} eq 'UL' || $format_map{$tag} eq 'OL' ; + push(@lines, &debug("<$format_map{$tag}>\n", __LINE__)); + next; + } elsif ($tag eq 'table') { + if (/^\@[fv]?table\s+\@(\w+)\s*$/) { + $in_table = $1; + unshift(@tables, join($;, $table_type, $in_table)); + push(@lines, &debug("<DL COMPACT>\n", __LINE__)); + &html_push_if('DL'); + push(@lines, &html_debug("\n", __LINE__)); + } else { + warn "$ERROR Bad table line: $_"; + } + next; + } elsif ($tag eq 'synindex' || $tag eq 'syncodeindex') { + if (/^\@$tag\s+(\w)\w\s+(\w)\w\s*$/) { + eval("*${1}index = *${2}index"); + } else { + warn "$ERROR Bad syn*index line: $_"; + } + next; + } elsif ($tag eq 'sp') { + push(@lines, &debug("<P>\n", __LINE__)); + next; + } elsif ($tag eq 'setref') { + &protect_html; # if setref contains '&' for instance + if (/^\@$tag\s*{($NODERE)}\s*$/) { + $setref = $1; + $setref =~ s/\s+/ /g; # normalize + $setref =~ s/ $//; + $node2sec{$setref} = $name; + $node2href{$setref} = "$docu_doc#$docid"; + } else { + warn "$ERROR Bad setref line: $_"; + } + next; + } elsif ($tag eq 'defindex' || $tag eq 'defcodeindex') { + if (/^\@$tag\s+(\w\w)\s*$/) { + $valid_index{$1} = 1; + } else { + warn "$ERROR Bad defindex line: $_"; + } + next; + } elsif (defined($def_map{$tag})) { + if ($def_map{$tag}) { + s/^\@$tag\s+//; + $tag = $def_map{$tag}; + $_ = "\@$tag $_"; + $tag =~ s/\s.*//; + } + } elsif (defined($user_sub{$tag})) { + s/^\@$tag\s+//; + $sub = $user_sub{$tag}; + print "# user $tag = $sub, arg: $_" if $debug & $DEBUG_USER; + if (defined(&$sub)) { + chop($_); + &$sub($_); + } else { + warn "$ERROR Bad user sub for $tag: $sub\n"; + } + next; + } + if (defined($def_map{$tag})) { + s/^\@$tag\s+//; + if ($tag =~ /x$/) { + # extra definition line + $tag = $`; + $is_extra = 1; + } else { + $is_extra = 0; + } + while (/\{([^\{\}]*)\}/) { + # this is a {} construct + ($before, $contents, $after) = ($`, $1, $'); + # protect spaces + $contents =~ s/\s+/$;9/g; + # restore $_ protecting {} + $_ = "$before$;7$contents$;8$after"; + } + @args = split(/\s+/, &protect_html($_)); + foreach (@args) { + s/$;9/ /g; # unprotect spaces + s/$;7/\{/g; # ... { + s/$;8/\}/g; # ... } + } + $type = shift(@args); + $type =~ s/^\{(.*)\}$/$1/; + print "# def ($tag): {$type} ", join(', ', @args), "\n" + if $debug & $DEBUG_DEF; + $type .= ':'; # it's nicer like this + $name = shift(@args); + $name =~ s/^\{(.*)\}$/$1/; + if ($is_extra) { + $_ = &debug("<DT>", __LINE__); + } else { + $_ = &debug("<DL>\n<DT>", __LINE__); + } + if ($tag eq 'deffn' || $tag eq 'defvr' || $tag eq 'deftp') { + $_ .= "<U>$type</U> <B>$name</B>"; + $_ .= " <I>@args</I>" if @args; + } elsif ($tag eq 'deftypefn' || $tag eq 'deftypevr' + || $tag eq 'defcv' || $tag eq 'defop') { + $ftype = $name; + $name = shift(@args); + $name =~ s/^\{(.*)\}$/$1/; + $_ .= "<U>$type</U> $ftype <B>$name</B>"; + $_ .= " <I>@args</I>" if @args; + } else { + warn "$ERROR Unknown definition type: $tag\n"; + $_ .= "<U>$type</U> <B>$name</B>"; + $_ .= " <I>@args</I>" if @args; + } + $_ .= &debug("\n<DD>", __LINE__); + $name = &unprotect_html($name); + if ($tag eq 'deffn' || $tag eq 'deftypefn') { + unshift(@input_spool, "\@findex $name\n"); + } elsif ($tag eq 'defop') { + unshift(@input_spool, "\@findex $name on $ftype\n"); + } elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv') { + unshift(@input_spool, "\@vindex $name\n"); + } else { + unshift(@input_spool, "\@tindex $name\n"); + } + $dont_html = 1; + } + } elsif ($end_tag) { + if ($format_map{$end_tag}) { + $in_pre = 0 if $format_map{$end_tag} eq 'PRE'; + $in_list-- if $format_map{$end_tag} eq 'UL' || $format_map{$end_tag} eq 'OL' ; + &html_pop_if('LI', 'P'); + &html_pop_if(); + push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__)); + push(@lines, &html_debug("\n", __LINE__)); + } elsif ($end_tag eq 'table' || + $end_tag eq 'ftable' || + $end_tag eq 'vtable') { + shift(@tables); + if (@tables) { + ($table_type, $in_table) = split($;, $tables[0]); + } else { + $in_table = 0; + } + push(@lines, "</DL>\n"); + &html_pop_if('DD'); + &html_pop_if(); + } elsif (defined($def_map{$end_tag})) { + push(@lines, &debug("</DL>\n", __LINE__)); + } elsif ($end_tag eq 'menu') { + &html_pop_if(); + push(@lines, $_); # must keep it for pass 2 + } + next; + } + # + # misc things + # + # protect texi and HTML things + &protect_texi; + $_ = &protect_html($_) unless $dont_html; + $dont_html = 0; + # substitution (unsupported things) + s/^\@center\s+//g; + s/^\@exdent\s+//g; + s/\@noindent\s+//g; + s/\@refill\s+//g; + # other substitutions + &simple_substitutions; + s/\@value{($VARRE)}/$value{$1}/eg; + s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4 + # + # analyze the tag again + # + if ($tag) { + if (defined($sec2level{$tag}) && $sec2level{$tag} > 0) { + if (/^\@$tag\s+(.+)$/) { + $name = $1; + $name =~ s/\s+$//; + $level = $sec2level{$tag}; + $name = &update_sec_num($tag, $level) . " $name" + if $number_sections && $tag !~ /^unnumbered/; + if ($tag =~ /heading$/) { + push(@lines, &html_debug("\n", __LINE__)); + if ($html_element ne 'body') { + # We are in a nice pickle here. We are trying to get a H? heading + # even though we are not in the body level. So, we convert it to a + # nice, bold, line by itself. + $_ = &debug("\n\n<P><STRONG>$name</STRONG></P>\n\n", __LINE__); + } else { + $_ = &debug("<H$level>$name</H$level>\n", __LINE__); + &html_push_if('body'); + } + print "# heading, section $name, level $level\n" + if $debug & $DEBUG_TOC; + } else { + if ($split_chapter) { + unless ($toplevel) { + # first time we see a "section" + unless ($level == 1) { + warn "$ERROR The first section found is not of level 1: $_"; + warn "$ERROR I'll split on sections of level $level...\n"; + } + $toplevel = $level; + } + if ($level == $toplevel) { + &next_doc; + push(@lines, $SPLITTAG) if $split_num++; + push(@sections, $name); + } + } + $sec_num++; + $docid = "SEC$sec_num"; + $tocid = "TOC$sec_num"; + # check biblio and glossary + $in_bibliography = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*bibliography$/i); + $in_glossary = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*glossary$/i); + # check node + if ($node) { + if ($node2sec{$node}) { + warn "$ERROR Duplicate node found: $node\n"; + } else { + $node2sec{$node} = $name; + $node2href{$node} = "$docu_doc#$docid"; + print "# node $node, section $name, level $level\n" + if $debug & $DEBUG_TOC; + } + $node = ''; + } else { + print "# no node, section $name, level $level\n" + if $debug & $DEBUG_TOC; + } + # update TOC + while ($level > $curlevel) { + $curlevel++; + push(@toc_lines, "<UL>\n"); + } + while ($level < $curlevel) { + $curlevel--; + push(@toc_lines, "</UL>\n"); + } + $_ = "<LI>" . &anchor($tocid, "$docu_doc#$docid", $name, 1); + push(@toc_lines, &substitute_style($_)); + # update DOC + push(@lines, &html_debug("\n", __LINE__)); + &html_reset; + $_ = "<H$level>".&anchor($docid, "$docu_toc#$tocid", $name)."</H$level>\n"; + $_ = &debug($_, __LINE__); + push(@lines, &html_debug("\n", __LINE__)); + } + # update DOC + foreach $line (split(/\n+/, $_)) { + push(@lines, "$line\n"); + } + next; + } else { + warn "$ERROR Bad section line: $_"; + } + } else { + # track variables + $value{$1} = $2, next if /^\@set\s+($VARRE)\s+(.*)$/o; + delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o; + # store things + $value{'_setfilename'} = $1, next if /^\@setfilename\s+(.*)$/; + $value{'_settitle'} = $1, next if /^\@settitle\s+(.*)$/; + $value{'_author'} .= "$1\n", next if /^\@author\s+(.*)$/; + $value{'_subtitle'} .= "$1\n", next if /^\@subtitle\s+(.*)$/; + $value{'_title'} .= "$1\n", next if /^\@title\s+(.*)$/; + # index + if (/^\@(..?)index\s+/) { + unless ($valid_index{$1}) { + warn "$ERROR Undefined index command: $_"; + next; + } + $id = 'IDX' . ++$idx_num; + $index = $1 . 'index'; + $what = &substitute_style($'); + $what =~ s/\s+$//; + print "# found $index for '$what' id $id\n" + if $debug & $DEBUG_INDEX; + eval(<<EOC); + if (defined(\$$index\{\$what\})) { + \$$index\{\$what\} .= "$;$docu_doc#$id"; + } else { + \$$index\{\$what\} = "$docu_doc#$id"; + } +EOC + # + # dirty hack to see if I can put an invisible anchor... + # + if ($html_element eq 'P' || + $html_element eq 'LI' || + $html_element eq 'DT' || + $html_element eq 'DD' || + $html_element eq 'ADDRESS' || + $html_element eq 'B' || + $html_element eq 'BLOCKQUOTE' || + $html_element eq 'PRE' || + $html_element eq 'SAMP') { + push(@lines, &anchor($id, '', $invisible_mark, !$in_pre)); + } elsif ($html_element eq 'body') { + push(@lines, &debug("<P>\n", __LINE__)); + push(@lines, &anchor($id, '', $invisible_mark, !$in_pre)); + &html_push('P'); + } elsif ($html_element eq 'DL' || + $html_element eq 'UL' || + $html_element eq 'OL' ) { + $deferred_ref .= &anchor($id, '', $invisible_mark, !$in_pre) . " "; + } + next; + } + # list item + if (/^\@itemx?\s+/) { + $what = $'; + $what =~ s/\s+$//; + if ($in_bibliography && $use_bibliography) { + if ($what =~ /^$BIBRE$/o) { + $id = 'BIB' . ++$bib_num; + $bib2href{$what} = "$docu_doc#$id"; + print "# found bibliography for '$what' id $id\n" + if $debug & $DEBUG_BIB; + $what = &anchor($id, '', $what); + } + } elsif ($in_glossary && $use_glossary) { + $id = 'GLOSS' . ++$gloss_num; + $entry = $what; + $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/; + $gloss2href{$entry} = "$docu_doc#$id"; + print "# found glossary for '$entry' id $id\n" + if $debug & $DEBUG_GLOSS; + $what = &anchor($id, '', $what); + } + &html_pop_if('P'); + if ($html_element eq 'DL' || $html_element eq 'DD') { + if ($things_map{$in_table} && !$what) { + # special case to allow @table @bullet for instance + push(@lines, &debug("<DT>$things_map{$in_table}\n", __LINE__)); + } else { + push(@lines, &debug("<DT>\@$in_table\{$what\}\n", __LINE__)); + } + push(@lines, "<DD>"); + &html_push('DD') unless $html_element eq 'DD'; + if ($table_type) { # add also an index + unshift(@input_spool, "\@${table_type}index $what\n"); + } + } else { + push(@lines, &debug("<LI>$what\n", __LINE__)); + &html_push('LI') unless $html_element eq 'LI'; + } + push(@lines, &html_debug("\n", __LINE__)); + if ($deferred_ref) { + push(@lines, &debug("$deferred_ref\n", __LINE__)); + $deferred_ref = ''; + } + next; + } + } + } + # paragraph separator + if ($_ eq "\n") { + next if $#lines >= 0 && $lines[$#lines] eq "\n"; + if ($html_element eq 'P') { + push(@lines, "\n"); + $_ = &debug("</P>\n", __LINE__); + &html_pop; + } + } elsif ($html_element eq 'body' || $html_element eq 'BLOCKQUOTE') { + push(@lines, "<P>\n"); + &html_push('P'); + $_ = &debug($_, __LINE__); + } + # otherwise + push(@lines, $_); +} + +# finish TOC +$level = 0; +while ($level < $curlevel) { + $curlevel--; + push(@toc_lines, "</UL>\n"); +} + +print "# end of pass 1\n" if $verbose; + +#+++############################################################################ +# # +# Pass 2/3: handle style, menu, index, cross-reference # +# # +#---############################################################################ + +@lines2 = (); # whole document (2nd pass) +@lines3 = (); # whole document (3rd pass) +$in_menu = 0; # am I inside a menu + +while (@lines) { + $_ = shift(@lines); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@lines2, $_); + next; + } + # + # menu + # + $in_menu = 1, push(@lines2, &debug("<UL>\n", __LINE__)), next if /^\@menu\b/; + $in_menu = 0, push(@lines2, &debug("</UL>\n", __LINE__)), next if /^\@end\s+menu\b/; + if ($in_menu) { + if (/^\*\s+($NODERE)::/o) { + $descr = $'; + chop($descr); + &menu_entry($1, $1, $descr); + } elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/) { + $descr = $'; + chop($descr); + &menu_entry($1, $2, $descr); + } elsif (/^\*/) { + warn "$ERROR Bad menu line: $_"; + } else { # description continued? + push(@lines2, $_); + } + next; + } + # + # printindex + # + if (/^\@printindex\s+(\w\w)\b/) { + local($index, *ary, @keys, $key, $letter, $last_letter, @refs); + if ($predefined_index{$1}) { + $index = $predefined_index{$1} . 'index'; + } else { + $index = $1 . 'index'; + } + eval("*ary = *$index"); + @keys = keys(%ary); + foreach $key (@keys) { + $_ = $key; + 1 while s/<(\w+)>\`(.*)\'<\/\1>/$2/; # remove HTML tags with quotes + 1 while s/<(\w+)>(.*)<\/\1>/$2/; # remove HTML tags + $_ = &unprotect_html($_); + &unprotect_texi; + tr/A-Z/a-z/; # lowercase + $key2alpha{$key} = $_; + print "# index $key sorted as $_\n" + if $key ne $_ && $debug & $DEBUG_INDEX; + } + $last_letter = undef; + foreach $key (sort byalpha @keys) { + $letter = substr($key2alpha{$key}, 0, 1); + $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;; + if (!defined($last_letter) || $letter ne $last_letter) { + push(@lines2, "</DIR>\n") if defined($last_letter); + push(@lines2, "<H2>" . &protect_html($letter) . "</H2>\n"); + push(@lines2, "<DIR>\n"); + $last_letter = $letter; + } + @refs = (); + foreach (split(/$;/, $ary{$key})) { + push(@refs, &anchor('', $_, $key, 0)); + } + push(@lines2, "<LI>" . join(", ", @refs) . "\n"); + } + push(@lines2, "</DIR>\n") if defined($last_letter); + next; + } + # + # simple style substitutions + # + $_ = &substitute_style($_); + # + # xref + # + while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) { + # note: Texinfo may accept other characters + ($type, $nodes, $full) = ($1, $2, $3); + ($before, $after) = ($`, $'); + if (! $full && $after) { + warn "$ERROR Bad xref (no ending } on line): $_"; + $_ = "$before$;0${type}ref\{$nodes$after"; + next; # while xref + } + if ($type eq 'x') { + $type = 'See '; + } elsif ($type eq 'px') { + $type = 'see '; + } elsif ($type eq 'info') { + $type = 'See Info'; + } else { + $type = ''; + } + unless ($full) { + $next = shift(@lines); + $next = &substitute_style($next); + chop($nodes); # remove final newline + if ($next =~ /\}/) { # split on 2 lines + $nodes .= " $`"; + $after = $'; + } else { + $nodes .= " $next"; + $next = shift(@lines); + $next = &substitute_style($next); + chop($nodes); + if ($next =~ /\}/) { # split on 3 lines + $nodes .= " $`"; + $after = $'; + } else { + warn "$ERROR Bad xref (no ending }): $_"; + $_ = "$before$;0xref\{$nodes$after"; + unshift(@lines, $next); + next; # while xref + } + } + } + $nodes =~ s/\s+/ /g; # remove useless spaces + @args = split(/\s*,\s*/, $nodes); + $node = $args[0]; # the node is always the first arg + &normalise_node($node); + $sec = $node2sec{$node}; + if (@args == 5) { # reference to another manual + $sec = $args[2] || $node; + $man = $args[4] || $args[3]; + $_ = "${before}${type}section `$sec' in \@cite{$man}$after"; + } elsif ($type =~ /Info/) { # inforef + warn "$ERROR Wrong number of arguments: $_" unless @args == 3; + ($nn, $_, $in) = @args; + $_ = "${before}${type} file `$in', node `$nn'$after"; + } elsif ($sec) { + $href = $node2href{$node}; + $_ = "${before}${type}section " . &anchor('', $href, $sec) . $after; + } else { + warn "$ERROR Undefined node ($node): $_"; + $_ = "$before$;0xref{$nodes}$after"; + } + } + # + # try to guess bibliography references or glossary terms + # + unless (/^<H\d><A NAME=\"SEC\d/) { + if ($use_bibliography) { + $done = ''; + while (/$BIBRE/o) { + ($pre, $what, $post) = ($`, $&, $'); + $href = $bib2href{$what}; + if (defined($href) && $post !~ /^[^<]*<\/A>/) { + $done .= $pre . &anchor('', $href, $what); + } else { + $done .= "$pre$what"; + } + $_ = $post; + } + $_ = $done . $_; + } + if ($use_glossary) { + $done = ''; + while (/\b\w+\b/) { + ($pre, $what, $post) = ($`, $&, $'); + $entry = $what; + $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/; + $href = $gloss2href{$entry}; + if (defined($href) && $post !~ /^[^<]*<\/A>/) { + $done .= $pre . &anchor('', $href, $what); + } else { + $done .= "$pre$what"; + } + $_ = $post; + } + $_ = $done . $_; + } + } + # otherwise + push(@lines2, $_); +} +print "# end of pass 2\n" if $verbose; + +# +# split style substitutions +# +while (@lines2) { + $_ = shift(@lines2); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@lines3, $_); + next; + } + # + # split style substitutions + # + $old = ''; + while ($old ne $_) { + $old = $_; + if (/\@(\w+)\{/) { + ($before, $style, $after) = ($`, $1, $'); + if (defined($style_map{$style})) { + $_ = $after; + $text = ''; + $after = ''; + $failed = 1; + while (@lines2) { + if (/\}/) { + $text .= $`; + $after = $'; + $failed = 0; + last; + } else { + $text .= $_; + $_ = shift(@lines2); + } + } + if ($failed) { + die "* Bad syntax (\@$style) after: $before\n"; + } else { + $text = &apply_style($style, $text); + $_ = "$before$text$after"; + } + } + } + } + # otherwise + push(@lines3, $_); +} +print "# end of pass 3\n" if $verbose; + +#+++############################################################################ +# # +# Pass 4: foot notes, final cleanup # +# # +#---############################################################################ + +@foot_lines = (); # footnotes +@doc_lines = (); # final document +$end_of_para = 0; # true if last line is <P> + +while (@lines3) { + $_ = shift(@lines3); + # + # special case (protected sections) + # + if (/^$PROTECTTAG/o) { + push(@doc_lines, $_); + $end_of_para = 0; + next; + } + # + # footnotes + # + while (/\@footnote([^\{\s]+)\{/) { + ($before, $d, $after) = ($`, $1, $'); + $_ = $after; + $text = ''; + $after = ''; + $failed = 1; + while (@lines3) { + if (/\}/) { + $text .= $`; + $after = $'; + $failed = 0; + last; + } else { + $text .= $_; + $_ = shift(@lines3); + } + } + if ($failed) { + die "* Bad syntax (\@footnote) after: $before\n"; + } else { + $foot_num++; + $docid = "DOCF$foot_num"; + $footid = "FOOT$foot_num"; + $foot = "($foot_num)"; + push(@foot_lines, "<H3>" . &anchor($footid, "$d#$docid", $foot) . "</H3>\n"); + $text = "<P>$text" unless $text =~ /^\s*<P>/; + push(@foot_lines, "$text\n"); + $_ = $before . &anchor($docid, "$docu_foot#$footid", $foot) . $after; + } + } + # + # remove unnecessary <P> + # + if (/^\s*<P>\s*$/) { + next if $end_of_para++; + } else { + $end_of_para = 0; + } + # otherwise + push(@doc_lines, $_); +} +print "# end of pass 4\n" if $verbose; + +#+++############################################################################ +# # +# Pass 5: print things # +# # +#---############################################################################ + +$header = <<EOT; +<!-- This HTML file has been created by $THISPROG + from $docu on $TODAY --> +EOT + +$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document"; +$title = $value{'_settitle'} || $full_title; +$_ = &substitute_style($full_title); +&unprotect_texi; +s/\n$//; # rmv last \n (if any) +$full_title = "<H1>" . join("</H1>\n<H1>", split(/\n/, $_)) . "</H1>\n"; + +# +# print ToC +# +if (!$monolithic && @toc_lines) { + if (open(FILE, "> $docu_toc")) { + print "# creating $docu_toc...\n" if $verbose; + &print_toplevel_header("$title - Table of Contents"); + &print_ruler; + &print(*toc_lines, FILE); + &print_toplevel_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_toc: $!\n"; + } +} + +# +# print footnotes +# +if (!$monolithic && @foot_lines) { + if (open(FILE, "> $docu_foot")) { + print "# creating $docu_foot...\n" if $verbose; + &print_toplevel_header("$title - Footnotes"); + &print_ruler; + &print(*foot_lines, FILE); + &print_toplevel_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_foot: $!\n"; + } +} + +# +# print document +# +if ($split_chapter || $split_node) { # split + $doc_num = 0; + $last_num = scalar(@sections); + $first_doc = &doc_name(1); + $last_doc = &doc_name($last_num); + while (@sections) { + $section = shift(@sections); + &next_doc; + if (open(FILE, "> $docu_doc")) { + print "# creating $docu_doc...\n" if $verbose; + &print_header("$title - $section"); + $prev_doc = ($doc_num == 1 ? undef : &doc_name($doc_num - 1)); + $next_doc = ($doc_num == $last_num ? undef : &doc_name($doc_num + 1)); + $navigation = "Go to the "; + $navigation .= ($prev_doc ? &anchor('', $first_doc, "first") : "first"); + $navigation .= ", "; + $navigation .= ($prev_doc ? &anchor('', $prev_doc, "previous") : "previous"); + $navigation .= ", "; + $navigation .= ($next_doc ? &anchor('', $next_doc, "next") : "next"); + $navigation .= ", "; + $navigation .= ($next_doc ? &anchor('', $last_doc, "last") : "last"); + $navigation .= " section, " . &anchor('', $docu_toc, "table of contents") . ".\n"; + print FILE $navigation; + &print_ruler; + # find corresponding lines + @tmp_lines = (); + while (@doc_lines) { + $_ = shift(@doc_lines); + last if ($_ eq $SPLITTAG); + push(@tmp_lines, $_); + } + &print(*tmp_lines, FILE); + &print_ruler; + print FILE $navigation; + &print_footer; + close(FILE); + } else { + warn "$ERROR Can't write to $docu_doc: $!\n"; + } + } +} else { # not split + if (open(FILE, "> $docu_doc")) { + print "# creating $docu_doc...\n" if $verbose; + if ($monolithic || !@toc_lines) { + &print_toplevel_header($title); + } else { + &print_header($title); + print FILE $full_title; + } + if ($monolithic && @toc_lines) { + &print_ruler; + print FILE "<H1>Table of Contents</H1>\n"; + &print(*toc_lines, FILE); + } + &print_ruler; + &print(*doc_lines, FILE); + if ($monolithic && @foot_lines) { + &print_ruler; + print FILE "<H1>Footnotes</H1>\n"; + &print(*foot_lines, FILE); + } + if ($monolithic || !@toc_lines) { + &print_toplevel_footer; + } else { + &print_footer; + } + close(FILE); + } else { + warn "$ERROR Can't write to $docu_doc: $!\n"; + } +} + +print "# that's all folks\n" if $verbose; + +#+++############################################################################ +# # +# Low level functions # +# # +#---############################################################################ + +sub update_sec_num { + local($name, $level) = @_; + + $level--; # here we start at 0 + if ($name =~ /^appendix/) { + # appendix style + if (defined(@appendix_sec_num)) { + &incr_sec_num($level, @appendix_sec_num); + } else { + @appendix_sec_num = ('A', 0, 0, 0); + } + return(join('.', @appendix_sec_num[0..$level])); + } else { + # normal style + if (defined(@normal_sec_num)) { + &incr_sec_num($level, @normal_sec_num); + } else { + @normal_sec_num = (1, 0, 0, 0); + } + return(join('.', @normal_sec_num[0..$level])); + } +} + +sub incr_sec_num { + local($level, $l); + $level = shift(@_); + $_[$level]++; + foreach $l ($level+1 .. 3) { + $_[$l] = 0; + } +} + +sub check { + local($_, %seen, %context, $before, $match, $after); + + while (<>) { + if (/\@(\*|\.|\:|\@|\{|\})/) { + $seen{$&}++; + $context{$&} .= "> $_" if $verbose; + $_ = "$`XX$'"; + redo; + } + if (/\@(\w+)/) { + ($before, $match, $after) = ($`, $&, $'); + if ($before =~ /\b[\w-]+$/ && $after =~ /^[\w-.]*\b/) { # e-mail address + $seen{'e-mail address'}++; + $context{'e-mail address'} .= "> $_" if $verbose; + } else { + $seen{$match}++; + $context{$match} .= "> $_" if $verbose; + } + $match =~ s/^\@/X/; + $_ = "$before$match$after"; + redo; + } + } + + foreach (sort(keys(%seen))) { + if ($verbose) { + print "$_\n"; + print $context{$_}; + } else { + print "$_ ($seen{$_})\n"; + } + } +} + +sub open { + local($name) = @_; + + ++$fh_name; + if (open($fh_name, $name)) { + unshift(@fhs, $fh_name); + } else { + warn "$ERROR Can't read file $name: $!\n"; + } +} + +sub init_input { + @fhs = (); # hold the file handles to read + @input_spool = (); # spooled lines to read + $fh_name = 'FH000'; + &open($docu); +} + +sub next_line { + local($fh, $line); + + if (@input_spool) { + $line = shift(@input_spool); + return($line); + } + while (@fhs) { + $fh = $fhs[0]; + $line = <$fh>; + return($line) if $line; + close($fh); + shift(@fhs); + } + return(undef); +} + +# used in pass 1, use &next_line +sub skip_until { + local($tag) = @_; + local($_); + + while ($_ = &next_line) { + return if /^\@end\s+$tag\s*$/; + } + die "* Failed to find '$tag' after: " . $lines[$#lines]; +} + +# +# HTML stacking to have a better HTML output +# + +sub html_reset { + @html_stack = ('html'); + $html_element = 'body'; +} + +sub html_push { + local($what) = @_; + push(@html_stack, $html_element); + $html_element = $what; +} + +sub html_push_if { + local($what) = @_; + push(@html_stack, $html_element) + if ($html_element && $html_element ne 'P'); + $html_element = $what; +} + +sub html_pop { + $html_element = pop(@html_stack); +} + +sub html_pop_if { + local($elt); + + if (@_) { + foreach $elt (@_) { + if ($elt eq $html_element) { + $html_element = pop(@html_stack) if @html_stack; + last; + } + } + } else { + $html_element = pop(@html_stack) if @html_stack; + } +} + +sub html_debug { + local($what, $line) = @_; + return("<!-- $line @html_stack, $html_element -->$what") + if $debug & $DEBUG_HTML; + return($what); +} + +# to debug the output... +sub debug { + local($what, $line) = @_; + return("<!-- $line -->$what") + if $debug & $DEBUG_HTML; + return($what); +} + +sub normalise_node { + $_[0] =~ s/\s+/ /g; + $_[0] =~ s/ $//; + $_[0] =~ s/^ //; +} + +sub menu_entry { + local($entry, $node, $descr) = @_; + local($href); + + &normalise_node($node); + $href = $node2href{$node}; + if ($href) { + $descr =~ s/^\s+//; + $descr = ": $descr" if $descr; + push(@lines2, "<LI>" . &anchor('', $href, $entry) . "$descr\n"); + } else { + warn "$ERROR Undefined node ($node): $_"; + } +} + +sub do_ctrl { "^$_[0]" } + +sub do_sc { "\U$_[0]\E" } + +sub apply_style { + local($texi_style, $text) = @_; + local($style); + + $style = $style_map{$texi_style}; + if (defined($style)) { # known style + if ($style =~ /^\"/) { # add quotes + $style = $'; + $text = "\`$text\'"; + } + if ($style =~ /^\&/) { # custom + $style = $'; + $text = &$style($text); + } elsif ($style) { # good style + $text = "<$style>$text</$style>"; + } else { # no style + } + } else { # unknown style + $text = undef; + } + return($text); +} + +# remove Texinfo styles +sub remove_style { + local($_) = @_; + s/\@\w+{([^\{\}]+)}/$1/g; + return($_); +} + +sub substitute_style { + local($_) = @_; + local($changed, $done, $style, $text); + + $changed = 1; + while ($changed) { + $changed = 0; + $done = ''; + while (/\@(\w+){([^\{\}]+)}/) { + $text = &apply_style($1, $2); + if ($text) { + $_ = "$`$text$'"; + $changed = 1; + } else { + $done .= "$`\@$1"; + $_ = "{$2}$'"; + } + } + $_ = $done . $_; + } + return($_); +} + +sub anchor { + local($name, $href, $text, $newline) = @_; + local($result); + + $result = "<A"; + $result .= " NAME=\"$name\"" if $name; + $result .= " HREF=\"$href\"" if $href; + $result .= ">$text</A>"; + $result .= "\n" if $newline; + return($result); +} + +sub pretty_date { + local(@MoY, $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); + + @MoY = ('January', 'Febuary', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December'); + ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); + $year += ($year < 70) ? 2000 : 1900; + return("$mday $MoY[$mon] $year"); +} + +sub doc_name { + local($num) = @_; + + return("${docu_name}_$num.html"); +} + +sub next_doc { + $docu_doc = &doc_name(++$doc_num); +} + +sub print { + local(*lines, $fh) = @_; + local($_); + + while (@lines) { + $_ = shift(@lines); + if (/^$PROTECTTAG/o) { + $_ = $tag2pro{$_}; + } else { + &unprotect_texi; + } + print $fh $_; + } +} + +sub print_ruler { + print FILE "<P><HR><P>\n"; +} + +sub print_header { + local($_); + + # clean the title + $_ = &remove_style($_[0]); + &unprotect_texi; + # print the header + if ($doctype eq 'html2') { + print FILE $html2_doctype; + } elsif ($doctype) { + print FILE $doctype; + } + print FILE <<EOT; +<HTML> +<HEAD> +$header +<TITLE>$_</TITLE> +</HEAD> +<BODY> +EOT +} + +sub print_toplevel_header { + local($_); + + &print_header; # pass given arg... + print FILE $full_title; + if ($value{'_subtitle'}) { + $value{'_subtitle'} =~ s/\n+$//; + foreach (split(/\n/, $value{'_subtitle'})) { + $_ = &substitute_style($_); + &unprotect_texi; + print FILE "<H2>$_</H2>\n"; + } + } + if ($value{'_author'}) { + $value{'_author'} =~ s/\n+$//; + foreach (split(/\n/, $value{'_author'})) { + $_ = &substitute_style($_); + &unprotect_texi; + s/[\w.-]+\@[\w.-]+/<A HREF="mailto:$&">$&<\/A>/g; + print FILE "<ADDRESS>$_</ADDRESS>\n"; + } + } + print FILE "<P>\n"; +} + +sub print_footer { + print FILE <<EOT; +</BODY> +</HTML> +EOT +} + +sub print_toplevel_footer { + &print_ruler; + print FILE <<EOT; +This document was generated on $TODAY using the +<A HREF=\"$HOMEPAGE\">texi2html</A> +translator version 1.51.</P> +EOT + &print_footer; +} + +sub protect_texi { + # protect @ { } ` ' + s/\@\@/$;0/go; + s/\@\{/$;1/go; + s/\@\}/$;2/go; + s/\@\`/$;3/go; + s/\@\'/$;4/go; +} + +sub protect_html { + local($what) = @_; + # protect & < > + $what =~ s/\&/\&\#38;/g; + $what =~ s/\</\&\#60;/g; + $what =~ s/\>/\&\#62;/g; + # but recognize some HTML things + $what =~ s/\&\#60;\/A\&\#62;/<\/A>/g; # </A> + $what =~ s/\&\#60;A ([^\&]+)\&\#62;/<A $1>/g; # <A [^&]+> + $what =~ s/\&\#60;IMG ([^\&]+)\&\#62;/<IMG $1>/g; # <IMG [^&]+> + return($what); +} + +sub unprotect_texi { + s/$;0/\@/go; + s/$;1/\{/go; + s/$;2/\}/go; + s/$;3/\`/go; + s/$;4/\'/go; +} + +sub unprotect_html { + local($what) = @_; + $what =~ s/\&\#38;/\&/g; + $what =~ s/\&\#60;/\</g; + $what =~ s/\&\#62;/\>/g; + return($what); +} + +sub byalpha { + $key2alpha{$a} cmp $key2alpha{$b}; +} + +############################################################################## + + # These next few lines are legal in both Perl and nroff. + +.00 ; # finish .ig + +'di \" finish diversion--previous line must be blank +.nr nl 0-1 \" fake up transition to first page again +.nr % 0 \" start at page 1 +'; __END__ ############# From here on it's a standard manual page ############ +.TH TEXI2HTML 1 "09/10/96" +.AT 3 +.SH NAME +texi2html \- a Texinfo to HTML converter +.SH SYNOPSIS +.B texi2html [options] file +.PP +.B texi2html -check [-verbose] files +.SH DESCRIPTION +.I Texi2html +converts the given Texinfo file to a set of HTML files. It tries to handle +most of the Texinfo commands. It creates hypertext links for cross-references, +footnotes... +.PP +It also tries to add links from a reference to its corresponding entry in the +bibliography (if any). It may also handle a glossary (see the +.B \-glossary +option). +.PP +.I Texi2html +creates several files depending on the contents of the Texinfo file and on +the chosen options (see FILES). +.PP +The HTML files created by +.I texi2html +are closer to TeX than to Info, that's why +.I texi2html +converts @iftex sections and not @ifinfo ones by default. You can reverse +this with the \-expandinfo option. +.SH OPTIONS +.TP 12 +.B \-check +Check the given file and give the list of all things that may be Texinfo commands. +This may be used to check the output of +.I texi2html +to find the Texinfo commands that have been left in the HTML file. +.TP +.B \-expandinfo +Expand @ifinfo sections, not @iftex ones. +.TP +.B \-glossary +Use the section named 'Glossary' to build a list of terms and put links in the HTML +document from each term toward its definition. +.TP +.B \-invisible \fIname\fP +Use \fIname\fP to create invisible destination anchors for index links. This is a workaround +for a known bug of many WWW browsers, including xmosaic. +.TP +.B \-I \fIdir\fP +Look also in \fIdir\fP to find included files. +.TP +.B \-menu +Show the Texinfo menus; by default they are ignored. +.TP +.B \-monolithic +Output only one file, including the table of contents and footnotes. +.TP +.B \-number +Number the sections. +.TP +.B \-split_chapter +Split the output into several HTML files (one per main section: +chapter, appendix...). +.TP +.B \-split_node +Split the output into several HTML files (one per node). +.TP +.B \-usage +Print usage instructions, listing the current available command-line options. +.TP +.B \-verbose +Give a verbose output. Can be used with the +.B \-check +option. +.PP +.SH FILES +By default +.I texi2html +creates the following files (foo being the name of the Texinfo file): +.TP 16 +.B foo_toc.html +The table of contents. +.TP +.B foo.html +The document's contents. +.TP +.B foo_foot.html +The footnotes (if any). +.PP +When used with the +.B \-split +option, it creates several files (one per chapter or node), named +.B foo_n.html +(n being the indice of the chapter or node), instead of the single +.B foo.html +file. +.PP +When used with the +.B \-monolithic +option, it creates only one file: +.B foo.html +.SH VARIABLES +.I texi2html +predefines the following variables: \fBhtml\fP, \fBtexi2html\fP. +.SH ADDITIONAL COMMANDS +.I texi2html +implements the following non-Texinfo commands: +.TP 16 +.B @ifhtml +This indicates the start of an HTML section, this section will passed through +without any modofication. +.TP +.B @end ifhtml +This indcates the end of an HTML section. +.SH VERSION +This is \fItexi2html\fP version 1.51, 09/10/96. +.PP +The latest version of \fItexi2html\fP can be found in WWW, cf. URL +http://wwwcn.cern.ch/dci/texi2html/ +.SH AUTHOR +The main author is Lionel Cons, CERN CN/DCI/UWS, Lionel.Cons@cern.ch. +Many other people around the net contributed to this program. +.SH COPYRIGHT +This program is the intellectual property of the European +Laboratory for Particle Physics (known as CERN). No guarantee whatsoever is +provided by CERN. No liability whatsoever is accepted for any loss or damage +of any kind resulting from any defect or inaccuracy in this information or +code. +.PP +CERN, 1211 Geneva 23, Switzerland +.SH "SEE ALSO" +GNU Texinfo Documentation Format, +HyperText Markup Language (HTML), +World Wide Web (WWW). +.SH BUGS +This program does not understand all Texinfo commands (yet). +.PP +TeX specific commands (normally enclosed in @iftex) will be +passed unmodified. +.ex diff --git a/glabels2/barcode-0.98/ean.c b/glabels2/barcode-0.98/ean.c new file mode 100644 index 0000000..0801a0e --- /dev/null +++ b/glabels2/barcode-0.98/ean.c @@ -0,0 +1,774 @@ +/* + * ean.c -- encoding for ean, upc and isbn + * + * Copyright (c) 1999 Alessandro Rubini <rubini@gnu.org> + * Copyright (c) 1999 Prosa Srl. <prosa@prosa.it> + * Copyright (c) 2001 Boszormenyi Zoltan <zboszor@mail.externet.hu> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + +/* + * IMPORTANT NOTE: if you are reading this file to learn how to add a + * new encoding type, this is the wrong place as there are too many + * special cases. Please refer to code39.c instead. If you want to + * learn how UPC, EAN, ISBN work, on the other hand, I did my best to + * commend things and hope you enjoy it. + */ + +/* + * These following static arrays are used to describe the barcode. + * + * The various forms of UPC and EAN are documented as using three + * different alphabets to encode the ten digits. However, each digit + * has exactly one encoding; only, it is sometimes mirrored. Moreover, + * if you represent the width of each symbol (bar/space) instead of + * the sequence of 1's and 0's, you find that even-parity and odd-parity + * encoding are exactly the same. So, here are the digits: */ +static char *digits[] = { + "3211","2221","2122","1411","1132", + "1231","1114","1312","1213","3112"}; + +/* + * What EAN encoding does is adding a leading digit (the 13th digit). + * Such an extra digit is encoded by mirroring three of the six digits that + * appear in the left half of the UPC code. Here how mirroring works: + */ +static char *ean_mirrortab[] = { + "------","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E (the 6-digit one), instead, encodes the check character as + * a mirroring of the symbols. This is similar, but the encoding for "0" is + * different (EAN uses no mirroring for "0" to be compatible with UPC). + * The same rule is used for UPC-5 (the supplemental digits for ISBN) + */ +static char *upc_mirrortab[] = { + "---111","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E mirroring for encoding "1" + */ +static char *upc_mirrortab1[] = { + "111---","11-1--","11--1-","11---1","1-11--", + "1--11-","1---11","1-1-1-","1-1--1","1--1-1" +}; + +/* UPC-2 has just two digits to mirror */ +static char *upc_mirrortab2[] = { + "11","1-","-1","--" +}; + +/* + * initial, middle, final guard bars (first symbol is a a space). + * EAN-13 overwrites the first "0" with "9" to make space for the extra digit. + */ +static char *guard[] = {"0a1a","1a1a1","a1a"}; + +/* initial, final guard bars for UPC-E*/ +static char *guardE[] = {"0a1a","1a1a1a"}; + +/* initial and inter-char guard bars for supplementals (first is space) */ +static char *guardS[] = {"9112","11"}; + +/* + * These functions are shortcuts I use in the encoding engine + */ +static int ean_make_checksum(char *text, int mode) +{ + int esum = 0, osum = 0, i; + int even=1; /* last char is even */ + + if (strchr(text, ' ')) + i = strchr(text, ' ') - text; /* end of first part */ + else + i = strlen(text); /* end of all */ + + while (i-- > 0) { + if (even) esum += text[i]-'0'; + else osum += text[i]-'0'; + even = !even; + } + if (!mode) { /* standard upc/ean checksum */ + i = (3*esum + osum) % 10; + return (10-i) % 10; /* complement to 10 */ + } else { /* add-5 checksum */ + i = (3*esum + 9*osum); + return i%10; + } +} + +/* + * Check that the text can be encoded. Returns 0 or -1. + * Accept: + * 13 or 12 digits: EAN-13 w/ or w/o checksum + * or + * 8 or 7 digits: EAN-8 w/ or w/o checksum. + * For both EAN-13 and EAN-8, accept an addon of 2 or 5 digits, + * separated by ' ' + */ +int Barcode_ean_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; i<len; i++) + if (!isdigit(text[i])) + return -1; + } else + len0 = len; + + for (i=0; i<len0; i++) + if (!isdigit(text[i])) + return -1; + + switch (len0) { + case 8: + strncpy(tmp, text, 7); + tmp[7] = '\0'; + if (text[7] != (ean_make_checksum(tmp, 0) + '0')) + return -1; + case 7: + break; + case 13: + strncpy(tmp, text, 12); + tmp[12] = '\0'; + if (text[12] != (ean_make_checksum(tmp, 0) + '0')) + return -1; + case 12: + break; + default: + return -1; + } + return 0; +} + +/* Expand the middle part of UPC-E to UPC-A */ +static char *upc_e_to_a0(unsigned char *text) +{ + static char result[16]; + strcpy(result, "00000000000"); /* 11 0's */ + + switch(text[5]) { /* last char */ + case '0': case '1': case '2': + strncpy(result+1, text, 2); result[3]=text[5]; /* Manuf. */ + memcpy(result+8, text+2, 3); /* Product */ + break; + case '3': + memcpy(result+1, text, 3); /* Manufacturer */ + memcpy(result+9, text+3, 2); /* Product */ + break; + case '4': + memcpy(result+1, text, 4); /* Manufacturer */ + memcpy(result+10, text+4, 1); /* Product */ + break; + default: + memcpy(result+1, text, 5); /* Manufacturer */ + memcpy(result+10, text+5, 1); /* Product */ + break; + } + return result; +} + +/* Try to expand an UPC-E barcode to its UPC-A equivalent. + * Accept 6, 7 or 8-digit sequence (not counting the addon): + * 6: only the middle part, encoding "0", w/o checksum. + * 7: the middle part, encoding "0" with a correct checksum + * or + * the middle part, encoding "0" or "1" prepended + * 8: fully qualified UPC-E with checksum. + * + * Returns a 11 digit UPC-A (w/o checksum) for valid EPC-E barcode + * or an empty string for an invalid one. + * + * The checksum for UPC-E is calculated using its UPC-A equivalent. + */ +static char *upc_e_to_a(unsigned char *text) +{ + static unsigned char result[16], *spc; + int len, chk; + + spc = strchr(text, ' '); + if (spc) + len = spc - text; + else + len = strlen(text); + + switch (len) { + case 6: + strcpy(result, upc_e_to_a0(text)); + return result; + case 7: + /* the first char is '0' or '1': + * valid number system for UPC-E and no checksum + */ + if (text[0] == '0' || text[0] == '1') { + strcpy(result, upc_e_to_a0(text+1)); + result[0] = text[0]; + return result; + } + + /* Find out whether the 7th char is correct checksum */ + strcpy(result, upc_e_to_a0(text)); + chk = ean_make_checksum(result, 0); + + if (chk == (text[len-1] - '0')) + return result; + /* Invalid 7 digit representation for UPC-E. */ + return NULL; + case 8: + if (text[0] == '0' || text[0] == '1') { + strcpy(result, upc_e_to_a0(text+1)); + result[0] = text[0]; + chk = ean_make_checksum(result, 0); + if (chk == (text[len-1] - '0')) + return result; + } + default: + /* Invalid representation for UPC-E. */ + return NULL; + } +} + +/* + * Accept a 11 or 12 digit UPC-A barcode and + * shrink it into an 8-digit UPC-E equivalent if possible. + * Return NULL if impossible, the UPC-E barcode if possible. + */ +static unsigned char *upc_a_to_e(unsigned char *text) +{ + static unsigned char result[16]; + int len, chksum; + + len = strlen(text); + switch (len) { + case 12: + strcpy(result, text); + result[11] = '\0'; + chksum = ean_make_checksum(result, 0); + if (text[11] != (chksum - '0')) + return NULL; + break; + case 11: + chksum = ean_make_checksum(text, 0); + break; + default: + return NULL; + } + + strcpy(result, "00000000"); /* 8 0's*/ + + /* UPC-E can only be used with number system 0 or 1 */ + if (text[0] != '0' && text[0] != '1') + return NULL; + + result[0] = text[0]; + + if ((text[3] == '0' || text[3] == '1' || text[3] == '2') + && !strncmp(text+4, "0000", 4)) { + memcpy(&result[1], text+1, 2); + memcpy(&result[3], text+8, 3); + result[6] = text[3]; + } else if (!strncmp(text+4, "00000", 5)) { + memcpy(&result[1], text+1, 3); + memcpy(&result[4], text+9, 2); + result[6] = '3'; + } else if (!strncmp(text+5, "00000", 5)) { + memcpy(&result[1], text+1, 4); + result[5] = text[10]; + result[6] = '4'; + } else if ((text[5] != '0') && !strncmp(text+6, "0000", 4) + && text[10] >= '5' && text[10] <= '9') { + memcpy(&result[1], text+1, 5); + result[6] = text[10]; + } else { + return NULL; + } + result[7] = chksum + '0'; + + return result; +} + +/* + * UPC-A is the same as EAN, but accept + * 12 or 11 digits (UPC-A w/ or w/o checksum) + * or accept UPC-E as: + * 6 digits (w/o number system and checksum): number system '0' assumed, + * 7 digits (either w/o number system or checksum), + * 8 digits (w/ number system and checksum) + * plus the 2 or 5-digit add-on + */ +int Barcode_upc_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; i<len; i++) + if (!isdigit(text[i])) + return -1; + } else + len0 = len; + + for (i=0; i<len0; i++) + if (!isdigit(text[i])) + return -1; + + switch (len0) { + case 6: case 7: case 8: + strncpy(tmp, text, len0); + tmp[len0] = '\0'; + if (!upc_e_to_a(tmp)) + return -1; + break; + case 12: + strncpy(tmp, text, 11); + tmp[11] = '\0'; + if (text[11] != (ean_make_checksum(tmp, 0) + '0')) + return -1; + case 11: + break; + default: + return -1; + } + return 0; +} + +/* + * Isbn is the same as EAN, just shorter. Dashes are accepted, the + * check character (if specified) is skipped, the extra 5 digits are + * accepted after a blank. + */ +int Barcode_isbn_verify(unsigned char *text) +{ + int i, ndigit=0; + + for (i=0; text[i]; i++) { + if (text[i] == '-') + continue; + if (isdigit(text[i])) { + ndigit++; + if (ndigit == 9) { /* got it all */ + i++; break; + } + continue; + } + return -1; /* found non-digit */ + } + if (ndigit!=9) return -1; /* too short */ + + /* skip an hyphen, if any */ + if (text[i] == '-') + i++; + /* accept one more char if any (the checksum) */ + if (isdigit(text[i]) || toupper(text[i])=='X') + i++; + if (text[i] == '\0') + return 0; /* Ok */ + + /* and accept the extra price tag (blank + 5 digits), if any */ + if (strlen(text+i) != 6) + return -1; + if (text[i] != ' ') + return -1; + i++; /* skip the blank */ + while (text[i]) { + if (!isdigit(text[i])) + return -1; + i++; + } + return 0; /* Ok: isbn + 5-digit addon */ +} + +static int width_of_partial(unsigned char *partial) +{ + int i=0; + while (*partial) { + if (isdigit(*partial)) + i += *partial - '0'; + else if (islower(*partial)) + i += *partial - 'a' + 1; + partial++; + } + return i; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * This one deals with both upc (-A and -E) and ean (13 and 8). + */ +int Barcode_ean_encode(struct Barcode_Item *bc) +{ + static char text[24]; + static char partial[256]; + static char textinfo[256]; + char *mirror, *ptr1, *ptr2, *tptr = textinfo; /* where text is written */ + char *spc; + + enum {UPCA, UPCE, EAN13, EAN8, ISBN} encoding = ISBN; + int i, xpos, checksum, len, len0, addon; + + if (!bc->ascii) { + bc->error = EINVAL; + return -1; + } + + /* Find out whether the barcode has addon and + * the length of the barcode w/o the addon. + */ + len = strlen(bc->ascii); + spc = strchr(bc->ascii, ' '); + if (spc) { + len0 = spc - bc->ascii; + addon = strlen(spc + 1); + if (addon != 2 && addon != 5) { + bc->error = EINVAL; /* impossible, actually */ + return -1; + } + } else { + len0 = len; + addon = 0; + } + + if (!bc->encoding) { + /* ISBN already wrote what it is; if unknown, find it out */ + + /* + * Do not decide only by barcode length, it may be ambiguous. + * Anyway, either the user specified the barcode type or + * we already found a fitting one. + */ + switch(bc->flags & BARCODE_ENCODING_MASK) { + case BARCODE_EAN: + switch (len0) { + case 7: case 8: + bc->encoding = strdup("EAN-8"); + encoding = EAN8; + break; + case 12: case 13: + bc->encoding = strdup("EAN-13"); + encoding = EAN13; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + + case BARCODE_UPC: + switch (len0) { + case 6: case 7: case 8: + bc->encoding = strdup("UPC-E"); + encoding = UPCE; + break; + case 11: case 12: + bc->encoding = strdup("UPC-A"); + encoding = UPCA; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + default: + /* else, it's wrong (impossible, as the text is checked) */ + bc->error = -EINVAL; + return -1; + } + } + + /* better safe than sorry */ + if (bc->partial) free(bc->partial); bc->partial = NULL; + if (bc->textinfo) free(bc->textinfo); bc->textinfo = NULL; + + if (encoding == UPCA) { /* add the leading 0 (not printed) */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else if (encoding == UPCE) { + strcpy(text, upc_a_to_e(upc_e_to_a(bc->ascii))); + } else { + strcpy(text, bc->ascii); + } + + /* + * build the checksum and the bars: any encoding is slightly different + */ + if (encoding == UPCA || encoding == EAN13 || encoding == ISBN) { + if (!(encoding == UPCA && len0 == 12) && + !(encoding == EAN13 && len0 == 13)) { + checksum = ean_make_checksum(text, 0); + text[12] = '0' + checksum; /* add it to the text */ + text[13] = '\0'; + } + + strcpy(partial, guard[0]); + if (encoding == EAN13 || encoding == ISBN) { /* The first digit */ + sprintf(tptr,"0:12:%c ",text[0]); + tptr += strlen(tptr); + partial[0] = '9'; /* extra space for the digit */ + } else if (encoding == UPCA) + partial[0] = '9'; /* UPC has one digit before the symbol, too */ + xpos = width_of_partial(partial); + mirror = ean_mirrortab[text[0]-'0']; + + /* left part */ + for (i=1;i<7;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i-1] == '1') { + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + /* + * Write the ascii digit. UPC has a special case + * for the first digit, which is out of the bars + */ + if (encoding == UPCA && i==1) { + sprintf(tptr, "0:10:%c ", text[i]); + tptr += strlen(tptr); + ptr1[1] += 'a'-'1'; /* bars are long */ + ptr1[3] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + /* count the width of the symbol */ + xpos += 7; /* width_of_partial(ptr2) */ + } + + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=7;i<13;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + /* + * Ascii digit. Once again, UPC has a special + * case for the last digit + */ + if (encoding == UPCA && i==12) { + sprintf(tptr, "%i:10:%c ", xpos+13, text[i]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + xpos += 7; /* width_of_partial(ptr2) */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + xpos += width_of_partial(guard[2]); + + } else if (encoding == UPCE) { + checksum = text[7] - '0'; + + strcpy(partial, guardE[0]); + partial[0] = '9'; /* UPC-A has one digit before the symbol, too */ + xpos = width_of_partial(partial); + + /* UPC-E has the number system written before the bars. */ + sprintf(tptr, "0:10:%c ", text[0]); + tptr += strlen(tptr); + + if (text[0] == '0') + mirror = upc_mirrortab[checksum]; + else + mirror = upc_mirrortab1[checksum]; + + for (i=0;i<6;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i+1]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i] != '1') { /* negated wrt EAN13 */ + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + sprintf(tptr, "%i:12:%c ", xpos, text[i+1]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(ptr2) */ + } + + sprintf(tptr, "%i:10:%c ", xpos+10, text[7]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guardE[1]); /* end */ + + } else { /* EAN-8 almost identical to EAN-13 but no mirroring */ + + if (len0 != 8) { + checksum = ean_make_checksum(text, 0); + text[7] = '0' + checksum; /* add it to the text */ + text[8] = '\0'; + } + + strcpy(partial, guard[0]); + xpos = width_of_partial(partial); + + /* left part */ + for (i=0;i<4;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=4;i<8;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + } + + /* + * And that's it. Now, in case some add-on is specified it + * must be encoded too. Look for it. + */ + if ( (ptr1 = spc) ) { + ptr1++; + strcpy(text, ptr1); + if (strlen(ptr1)==5) { + checksum = ean_make_checksum(text, 1 /* special way */); + mirror = upc_mirrortab[checksum]+1; /* only last 5 digits */ + } else { + checksum = atoi(text)%4; + mirror = upc_mirrortab2[checksum]; + } + strcat(textinfo, " +"); strcat(partial, "+"); + tptr = textinfo + strlen(textinfo); + for (i=0; i<strlen(text); i++) { + if (!i) { + strcat(partial, guardS[0]); /* separation and head */ + xpos += width_of_partial(guardS[0]); + } else { + strcat(partial, guardS[1]); + xpos += width_of_partial(guardS[1]); + } + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i] != '1') { /* negated wrt EAN13 */ + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + /* and the text */ + sprintf(tptr, " %i:12:%c", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(ptr2) */ + } + } + + /* all done, copy results to the data structure */ + bc->partial = strdup(partial); + if (!bc->partial) { + bc->error = errno; + return -1; + } + bc->textinfo = strdup(textinfo); + if (!bc->textinfo) { + bc->error = errno; + free(bc->partial); + bc->partial = NULL; + return -1; + } + if (!bc->width) + bc->width = width_of_partial(partial); + + return 0; /* success */ +} + +int Barcode_upc_encode(struct Barcode_Item *bc) +{ + return Barcode_ean_encode(bc); /* UPC is folded into EAN */ +} + +int Barcode_isbn_encode(struct Barcode_Item *bc) +{ + /* For ISBN we must normalize the string and prefix "978" */ + unsigned char *text = malloc(24); /* 13 + ' ' + 5 plus some slack */ + unsigned char *otext; + int i, j, retval; + + if (!text) { + bc->error = ENOMEM; + return -1; + } + strcpy(text, "978"); j=3; + + otext = bc->ascii; + for (i=0; otext[i]; i++) { + if (isdigit(otext[i])) + text[j++] = otext[i]; + if (j == 12) /* checksum added later */ + break; + } + text[j]='\0'; + if (strchr(otext, ' ')) + strcat(text, strchr(otext, ' ')); + bc->ascii = text; + bc->encoding = strdup("ISBN"); + retval = Barcode_ean_encode(bc); + bc->ascii = otext; /* restore ascii for the ps comments */ + free(text); + return retval; +} + diff --git a/glabels2/barcode-0.98/i25.c b/glabels2/barcode-0.98/i25.c new file mode 100644 index 0000000..72bd035 --- /dev/null +++ b/glabels2/barcode-0.98/i25.c @@ -0,0 +1,164 @@ +/* + * i25.c -- "interleaved 2 of 5" + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + +static char *codes[] = { + "11331", "31113", "13113", "33111", "11313", + "31311", "13311", "11133", "31131", "13131" +}; + +static char *guard[] = {"a1a1", "c1a"}; /* begin end */ + +int Barcode_i25_verify(unsigned char *text) +{ + if (!text[0]) + return -1; + while (*text && isdigit(*text)) + text++; + if (*text) + return -1; /* a non-digit char */ + return 0; /* ok */ +} + +int Barcode_i25_encode(struct Barcode_Item *bc) +{ + unsigned char *text; + unsigned char *partial; /* dynamic */ + unsigned char *textinfo; /* dynamic */ + unsigned char *textptr, *p1, *p2, *pd; + int i, len, sum[2], textpos, usesum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("interleaved 2 of 5"); + + text = bc->ascii; + if (!bc->ascii) { + bc->error = EINVAL; + return -1; + } + + if ((bc->flags & BARCODE_NO_CHECKSUM)) usesum = 0; else usesum = 1; + + /* create the real text string, padded to an even number of digits */ + text = malloc(strlen(bc->ascii) + 3); /* leading 0, checksum, term. */ + if (!text) { + bc->error = errno; + return -1; + } + /* add the leading 0 if needed */ + i = strlen(bc->ascii) + usesum; + if (i % 2) { + /* add a leading 0 */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else { + strcpy(text, bc->ascii); + } + /* add the trailing checksum if needed, the leading 0 is ignored */ + if (usesum) { + sum[0] = sum[1] = 0; + for (i=0; text[i]; i++) + sum[i%2] += text[i]-'0'; + /* + * The "even" sum must be multiplied by three, and the * + * rightmost digit is defined as "even". The digits' position + * is already correct, whether or not we added a leading zero. + * (e.g., they are in pos. 0..4 or 1..4 of the string) + */ + i = sum[0] * 3 + sum[1]; + strcat(text, "0"); + text[strlen(text)-1] += (10 - (i%10)) % 10; + } + + /* the partial code is 5 * (text + check) + 4(head) + 3(tail) + term. */ + partial = malloc( (strlen(text) + 3) * 5 +2); /* be large... */ + if (!partial) { + bc->error = errno; + free(text); + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen+1) +term */ + textinfo = malloc(10*(strlen(text)+1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(text); + return -1; + } + + + strcpy(partial, "0"); /* the first space */ + strcat(partial, guard[0]); /* start */ + textpos = 4; /* width of initial guard */ + textptr = textinfo; + + len = strlen(text); + for (i=0; i<len; i+=2) { + if (!isdigit(text[i]) || !isdigit(text[i+1])) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + free(text); + return -1; + } + /* interleave two digits */ + p1 = codes[text[i]-'0']; + p2 = codes[text[i+1]-'0']; + pd = partial + strlen(partial); /* destination */ + while (*p1) { + *(pd++) = *(p1++); + *(pd++) = *(p2++); + } + *pd = '\0'; + /* and print the ascii text (but don't print the checksum, if any */ + if (usesum && strlen(text+i)==2) { + /* print only one digit, discard the checksum */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + } else { + sprintf(textptr, "%i:12:%c %i:12:%c ", textpos, text[i], + textpos+9, text[i+1]); + } + textpos += 18; /* width of two codes */ + textptr += strlen(textptr); + } + strcat(partial, guard[1]); + + bc->partial = partial; + bc->textinfo = textinfo; + free(text); + + return 0; +} + diff --git a/glabels2/barcode-0.98/install-sh b/glabels2/barcode-0.98/install-sh new file mode 100644 index 0000000..ab74c88 --- /dev/null +++ b/glabels2/barcode-0.98/install-sh @@ -0,0 +1,238 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/glabels2/barcode-0.98/library.c b/glabels2/barcode-0.98/library.c new file mode 100644 index 0000000..a878702 --- /dev/null +++ b/glabels2/barcode-0.98/library.c @@ -0,0 +1,244 @@ +/* + * library.c -- external functions of libbarcode + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#ifdef HAVE_UNISTD_H /* sometimes (windows, for instance) it's missing */ +# include <unistd.h> +#endif +#include <errno.h> + +#include "barcode.h" + +/* + * This function allocates a barcode structure and strdup()s the + * text string. It returns NULL in case of error + */ +struct Barcode_Item *Barcode_Create(char *text) +{ + struct Barcode_Item *bc; + + bc = malloc(sizeof(*bc)); + if (!bc) return NULL; + + memset(bc, 0, sizeof(*bc)); + bc->ascii = strdup(text); + bc->margin = BARCODE_DEFAULT_MARGIN; /* default margin */ + return bc; +} + + +/* + * Free a barcode structure + */ +int Barcode_Delete(struct Barcode_Item *bc) +{ + if (bc->ascii) + free(bc->ascii); + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + if (bc->encoding) + free(bc->encoding); + free(bc); + return 0; /* always success */ +} + + +/* + * The various supported encodings. This might be extended to support + * dynamic addition of extra encodings + */ +extern int Barcode_ean_verify(unsigned char *text); +extern int Barcode_ean_encode(struct Barcode_Item *bc); +extern int Barcode_upc_verify(unsigned char *text); +extern int Barcode_upc_encode(struct Barcode_Item *bc); +extern int Barcode_isbn_verify(unsigned char *text); +extern int Barcode_isbn_encode(struct Barcode_Item *bc); +extern int Barcode_39_verify(unsigned char *text); +extern int Barcode_39_encode(struct Barcode_Item *bc); +extern int Barcode_128b_verify(unsigned char *text); +extern int Barcode_128b_encode(struct Barcode_Item *bc); +extern int Barcode_128c_verify(unsigned char *text); +extern int Barcode_128c_encode(struct Barcode_Item *bc); +extern int Barcode_128_verify(unsigned char *text); +extern int Barcode_128_encode(struct Barcode_Item *bc); +extern int Barcode_128raw_verify(unsigned char *text); +extern int Barcode_128raw_encode(struct Barcode_Item *bc); +extern int Barcode_i25_verify(unsigned char *text); +extern int Barcode_i25_encode(struct Barcode_Item *bc); +extern int Barcode_cbr_verify(unsigned char *text); +extern int Barcode_cbr_encode(struct Barcode_Item *bc); +extern int Barcode_msi_verify(unsigned char *text); +extern int Barcode_msi_encode(struct Barcode_Item *bc); +extern int Barcode_pls_verify(unsigned char *text); +extern int Barcode_pls_encode(struct Barcode_Item *bc); +extern int Barcode_93_verify(unsigned char *text); +extern int Barcode_93_encode(struct Barcode_Item *bc); + + +struct encoding { + int type; + int (*verify)(unsigned char *text); + int (*encode)(struct Barcode_Item *bc); +}; + +struct encoding encodings[] = { + {BARCODE_EAN, Barcode_ean_verify, Barcode_ean_encode}, + {BARCODE_UPC, Barcode_upc_verify, Barcode_upc_encode}, + {BARCODE_ISBN, Barcode_isbn_verify, Barcode_isbn_encode}, + {BARCODE_128B, Barcode_128b_verify, Barcode_128b_encode}, + {BARCODE_128C, Barcode_128c_verify, Barcode_128c_encode}, + {BARCODE_128RAW, Barcode_128raw_verify, Barcode_128raw_encode}, + {BARCODE_39, Barcode_39_verify, Barcode_39_encode}, + {BARCODE_I25, Barcode_i25_verify, Barcode_i25_encode}, + {BARCODE_128, Barcode_128_verify, Barcode_128_encode}, + {BARCODE_CBR, Barcode_cbr_verify, Barcode_cbr_encode}, + {BARCODE_PLS, Barcode_pls_verify, Barcode_pls_encode}, + {BARCODE_MSI, Barcode_msi_verify, Barcode_msi_encode}, + {BARCODE_93, Barcode_93_verify, Barcode_93_encode}, + {0, NULL, NULL} +}; + +/* + * A function to encode a string into bc->partial, ready for + * postprocessing to the output file. Meaningful bits for "flags" are + * the encoding mask and the no-checksum flag. These bits + * get saved in the data structure. + */ +int Barcode_Encode(struct Barcode_Item *bc, int flags) +{ + int validbits = BARCODE_ENCODING_MASK | BARCODE_NO_CHECKSUM; + struct encoding *cptr; + + /* If any flag is cleared in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_ENCODING_MASK)) + flags |= bc->flags & BARCODE_ENCODING_MASK; + if (!(flags & BARCODE_NO_CHECKSUM)) + flags |= bc->flags & BARCODE_NO_CHECKSUM; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (!(flags & BARCODE_ENCODING_MASK)) { + /* get the first code able to handle the text */ + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->verify((unsigned char *)bc->ascii)==0) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* no code can handle this text */ + return -1; + } + flags |= cptr->type; /* this works */ + bc->flags |= cptr->type; + } + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->type == (flags & BARCODE_ENCODING_MASK)) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* invalid barcode type */ + return -1; + } + if (cptr->verify(bc->ascii) != 0) { + bc->error = EINVAL; + return -1; + } + return cptr->encode(bc); +} + + +/* + * When multiple output formats are supported, there will + * be a jumpt table like the one for the types. Now we don't need it + */ +extern int Barcode_ps_print(struct Barcode_Item *bc, FILE *f); +extern int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f); + +/* + * A function to print a partially decoded string. Meaningful bits for + * "flags" are the output mask etc. These bits get saved in the data + * structure. + */ +int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags) +{ + int validbits = BARCODE_OUTPUT_MASK | BARCODE_NO_ASCII + | BARCODE_OUT_NOHEADERS; + + /* If any flag is clear in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_OUTPUT_MASK)) + flags |= bc->flags & BARCODE_OUTPUT_MASK; + if (!(flags & BARCODE_NO_ASCII)) + flags |= bc->flags & BARCODE_NO_ASCII; + if (!(flags & BARCODE_OUT_NOHEADERS)) + flags |= bc->flags & BARCODE_OUT_NOHEADERS; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (bc->flags & BARCODE_OUT_PCL) + return Barcode_pcl_print(bc, f); + return Barcode_ps_print(bc, f); +} + +/* + * Choose the position + */ +int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef) +{ + bc->width = wid; bc->height = hei; + bc->xoff = xoff; bc->yoff = yoff; + bc->scalef = scalef; + return 0; +} + +/* + * Do it all in one step + */ +int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags) +{ + struct Barcode_Item * bc; + + if (!(bc=Barcode_Create(text))) { + errno = -ENOMEM; + return -1; + } + if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 + || Barcode_Encode(bc, flags) < 0 + || Barcode_Print(bc, f, flags) < 0) { + errno = bc->error; + Barcode_Delete(bc); + return -1; + } + Barcode_Delete(bc); + return 0; +} + +/* + * Return the version + */ + +int Barcode_Version(char *vptr) +{ + if (vptr) + strcpy(vptr, BARCODE_VERSION); + return BARCODE_VERSION_INT; +} diff --git a/glabels2/barcode-0.98/main.c b/glabels2/barcode-0.98/main.c new file mode 100644 index 0000000..e07e4d3 --- /dev/null +++ b/glabels2/barcode-0.98/main.c @@ -0,0 +1,604 @@ +/* + * main.c - a commandline frontend for the barcode library + * + * Copyright (c) 1999 Michele Comitini (mcm@glisco.it) + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include "cmdline.h" +#include "barcode.h" + +#ifndef NO_LIBPAPER +#include <paper.h> +#endif + +/* + * Most of this file deals with command line options, by exploiting + * the cmdline.[ch] engine to offer defaults via environment variables + * and handling functions for complex options. + * + * In order to offer a friendly interface (for those who feel the + * cmdline *is* friendly, like me), we have to convert names to enums... + */ + +struct { + char *name; + int type; +} encode_tab[] = { + {"ean", BARCODE_EAN}, + {"ean13", BARCODE_EAN}, + {"ean-13", BARCODE_EAN}, + {"ean8", BARCODE_EAN}, + {"ean-8", BARCODE_EAN}, + {"upc", BARCODE_UPC}, + {"upc-a", BARCODE_UPC}, + {"upc-e", BARCODE_UPC}, + {"isbn", BARCODE_ISBN}, + {"39", BARCODE_39}, + {"code39", BARCODE_39}, + {"128c", BARCODE_128C}, + {"code128c", BARCODE_128C}, + {"128b", BARCODE_128B}, + {"code128b", BARCODE_128B}, + {"128", BARCODE_128}, + {"code128", BARCODE_128}, + {"128raw", BARCODE_128RAW}, + {"i25", BARCODE_I25}, + {"interleaved 2 of 5", BARCODE_I25}, + {"cbr", BARCODE_CBR}, + {"codabar", BARCODE_CBR}, + {"msi", BARCODE_MSI}, + {"pls", BARCODE_PLS}, + {"plessey", BARCODE_PLS}, + {"code93", BARCODE_93}, + {"93", BARCODE_93}, + + {NULL, 0} +}; + +/* + * Get encoding type from string rapresentation. + * Returns -1 on error. + */ +#ifndef HAVE_STRCASECMP /* some libs (windows, for example) have stricmp */ +# define strcasecmp stricmp +#endif + +int encode_id(char *encode_name) +{ + int i; + for (i = 0; encode_tab[i].name; i++) + if (!strcasecmp(encode_tab[i].name, encode_name)) + return encode_tab[i].type; + return -1; +} + +int list_encodes(FILE *f) /* used in the help message */ +{ + int prev = -1; + int i; + + fprintf(f, "Known encodings are (synonyms appear on the same line):"); + for (i = 0; encode_tab[i].name; i++) { + if (encode_tab[i].type != prev) + fprintf(f, "\n\t"); + else + fprintf(f, ", "); + fprintf(f, "\"%s\"", encode_tab[i].name); + prev = encode_tab[i].type; + } + fprintf(f, "\n"); + return 0; +} + + +/* + * Variables to hold cmdline arguments (or defaults) + */ + +char *ifilename, *ofilename; +int encoding_type; /* filled by get_encoding() */ +int code_width, code_height; /* "-g" for standalone codes */ +int lines, columns; /* "-t" for tables */ +int xmargin0, ymargin0; /* both for "-g" and "-t" */ +int xmargin1, ymargin1; /* same, but right and top */ +int ximargin, yimargin; /* "-m": internal margins */ +int eps, pcl, ps, noascii, nochecksum; /* boolean flags */ +int page_wid, page_hei; /* page size in points */ +char *page_name; /* name of the media */ +double unit = 1.0; /* unit specification */ + +char *prgname; /* used to print error msgs, initialized to argv[0] by main */ + +/* + * Functions to handle command line arguments + */ + +struct encode_item { + char *string; + struct encode_item *next; +} *list_head, *list_tail; + +/* each "-b" option adds a string to the input pool allocating its space */ +int get_input_string(void *arg) +{ + struct encode_item *item = malloc(sizeof(*item)); + if (!item) { + fprintf(stderr, "%s: malloc: %s\n", prgname, strerror(errno)); + return -2; + } + item->string = strdup(arg); + if (!list_head) { + list_head = list_tail = item; + } else { + list_tail->next = item; + list_tail = item; + } + item->next = NULL; + return 0; +} + +/* and this function extracts strings from the pool */ +unsigned char *retrieve_input_string(FILE *ifile) +{ + char *string; + static char fileline[128]; + + struct encode_item *item = list_head; + if (list_tail) { /* this means at least one "-b" was specified */ + if (!item) + return NULL; /* the list is empty */ + string = item->string; + list_head = item->next; + free(item); + return string; + } + + /* else, read from the file */ + if (!fgets(fileline, 128, ifile)) + return NULL; + if (fileline[strlen(fileline)-1]=='\n') + fileline[strlen(fileline)-1]= '\0'; + return strdup(fileline); +} + +/* accept a unit specification */ +int get_unit(void *arg) +{ + static struct { + char *str; + double unit; + } *ptr, unittab[] = { + {"pt", 1.0}, + {"in", 72.0}, + {"cm", 72.0/2.54}, + {"mm", 72.0/25.4}, + {NULL, 0.0} + }; + + for (ptr = unittab; ptr->str && strcmp((char *)arg, ptr->str); ptr++) + ; + unit = ptr->unit; + if (ptr->str) return 0; + + fprintf(stderr, "%s: incorrect unit \"%s\" (use one of", + prgname, (char *)arg); + for (ptr = unittab; ptr->str; ptr++) + fprintf(stderr, " \"%s\"", ptr->str); + fprintf(stderr, ")\n"); + return -2; +} + +/* convert an encoding name to an encoding integer code */ +int get_encoding(void *arg) +{ + encoding_type = encode_id((char *)arg); + if (encoding_type >=0) return 0; + fprintf(stderr, "%s: wrong encoding \"%s\"\n", prgname, + (char *)arg); + return -2; /* error, no help */ +} + +/* convert a geometry specification */ +int get_geometry(void *arg) +{ + double w = 0.0, h = 0.0; + double x = 0.0, y = 0.0; + int n; + + if (((char *)arg)[0]=='+') { + n = sscanf((char *)arg, "+%lf+%lf%s", &x, &y, (char *)arg); + } else { + n = sscanf((char *)arg, "%lfx%lf+%lf+%lf%s", &w, &h, &x, &y, + (char *)arg); + } + if (n!=4 && n!=2) { + fprintf(stderr, "%s: wrong geometry \"%s\"\n", prgname, (char *)arg); + return -2; + } + /* convert to points */ + code_width = w * unit; + code_height = h * unit; + xmargin0 = x * unit; + ymargin0 = y * unit; + return 0; +} + +/* convert a geometry specification */ +int get_table(void *arg) +{ + double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0; + int n; + + n = sscanf((char *)arg, "%dx%d+%lf+%lf-%lf-%lf", + &columns, &lines, &x0, &y0, &x1, &y1); + + if (n==1 || n==3) { /* error: 2, 4, 5, 6 are fine */ + fprintf(stderr, "%s: wrong table specification \"%s\"\n", prgname, + (char *)arg); + return -2; + } + if (n < 6) y1 = y0; /* symmetric by default */ + if (n < 5) x1 = x0; + + /* convert and return */ + xmargin0 = x0 * unit; + ymargin0 = y0 * unit; + xmargin1 = x1 * unit; + ymargin1 = y1 * unit; + return 0; +} + +/* convert an internal margin specification */ +int get_margin(void *arg) +{ + char separator; + double x,y; + int n; + + /* accept one number or two, separated by any char */ + n = sscanf((char *)arg, "%lf%c%lf", &x, &separator, &y); + + if (n==1) { + n=3; y = x; + } + if (n==3) { + ximargin = x * unit; + yimargin = y * unit; + return 0; + } + fprintf(stderr, "%s: wrong margin specification \"%s\"\n", prgname, + (char *)arg); + return -2; + return 0; +} + +/* convert a page geometry specification */ +int get_page_geometry(void *arg) +{ + int n; + double dpw, dph; /* page width, height in mm or inches */ + static char tmpstr[20]; + page_name = arg; /* if undecipherable, we won't run the program :) */ + /* + * try to decode a "mm" string (eg. "210mmx297mm" or "210x297mm") + */ + n = sscanf((char *)arg, "%lfmmx%lf", &dpw, &dph); + if (n != 2 && strlen(arg)<20) { + n = sscanf((char *)arg, "%lfx%lf%s", &dpw, &dph, tmpstr); + if (n == 3 && !strcmp(tmpstr, "mm")) { + /* Ok, convert to points: 1in is 25.4mm, 1in is also 72p */ + page_wid = (int)(dpw / 25.4 * 72.0 + 0.5); + page_hei = (int)(dph / 25.4 * 72.0 + 0.5); + return 0; + } + } + + /* + * try to decode an "in" string (eg. "8.5inx11in" or "8.5x11in") + */ + n = sscanf((char *)arg, "%lfinx%lf", &dpw, &dph); + if (n != 2 && strlen(arg)<20) { + n = sscanf((char *)arg, "%lfx%lf%s", &dpw, &dph, tmpstr); + if (n == 3 && !strcmp(tmpstr, "in")) { + page_wid = (int)(dpw * 72.0 + 0.5); /* round to points */ + page_hei = (int)(dph * 72.0 + 0.5); + return 0; + } + } + + /* + * try to decode a numeric specification + */ + n = sscanf((char *)arg, "%lfx%lf", &dpw, &dph); + if (n == 2) { + page_wid = dpw * unit; + page_hei = dph * unit; + if (unit != 1.0) { /* rebuild the page name */ + page_name = malloc(32); /* big, to avoid snprintf, missing on HP */ + if (page_name) + sprintf(page_name, "%dx%d\n", page_wid, page_hei); + } + return 0; + } + +#ifndef NO_LIBPAPER + /* + * try to use libpaper, since it is available + */ + { + const struct paper* paptr; + + paperinit(); + paptr = paperinfo(arg); + if (!paptr) { /* unknown name */ + paperdone(); + return -1; + } + page_wid = (int)(paperpswidth(paptr) + 0.5); + page_hei = (int)(paperpsheight(paptr) + 0.5); + paperdone(); + return 0; + } +#endif + /* If we got here, the argument is undecipherable: fail */ + fprintf(stderr, "%s: wrong page size specification \"%s\"\n", prgname, + (char *)arg); + return -2; +} + +/* + * The table of possible arguments + */ +struct commandline option_table[] = { + {'i', CMDLINE_S, &ifilename, NULL, NULL, NULL, + "input file (strings to encode), default is stdin"}, + {'o', CMDLINE_S, &ofilename, NULL, NULL, NULL, + "output file, default is stdout"}, + {'b', CMDLINE_S, NULL, get_input_string, NULL, NULL, + "string to encode (use input file if missing)"}, + {'e', CMDLINE_S, NULL, get_encoding, "BARCODE_ENCODING", NULL, + "encoding type (default is best fit for first string)"}, + {'u', CMDLINE_S, NULL, get_unit, "BARCODE_UNIT", NULL, + "unit (\"mm\", \"in\", ...) used to decode -g, -t, -p"}, + {'g', CMDLINE_S, NULL, get_geometry, "BARCODE_GEOMETRY", NULL, + "geometry on the page: [<wid>x<hei>][+<margin>+<margin>]"}, + {'t', CMDLINE_S, NULL, get_table, "BARCODE_TABLE", NULL, + "table geometry: <cols>x<lines>[+<margin>+<margin>]"}, + {'m', CMDLINE_S, NULL, get_margin, "BARCODE_MARGIN", "10", + "internal margin for each item in a table: <xm>[,<ym>]"}, + {'n', CMDLINE_NONE, &noascii, NULL, NULL, NULL, + "\"numeric\": avoid printing text along with the bars"}, + {'c', CMDLINE_NONE, &nochecksum, NULL, NULL, NULL, + "no Checksum character, if the chosen encoding allows it"}, + {'E', CMDLINE_NONE, &eps, NULL, NULL, NULL, + "print one code as eps file (default: multi-page ps)"}, + {'P', CMDLINE_NONE, &pcl, NULL, NULL, NULL, + "create PCL output instead of postscript"}, + {'p', CMDLINE_S, NULL, get_page_geometry, NULL, NULL, + "page size (refer to the man page)"}, + {0,} +}; + +#ifdef NO_STRERROR +/* + * A strerror replacement (thanks to Thad Floryan <thad@thadlabs.com>) + */ +char *strerror(int error) +{ + static char msg[16]; + if (error >= 0 && error < sys_nerr) + return sys_errlist[error]; + sprintf(msg, "Error %d", error); + return msg; +} +#endif + +/* + * The main function + */ +int main(int argc, char **argv) +{ + struct Barcode_Item * bc; + FILE *ifile = stdin; + FILE *ofile = stdout; + char *line; + int flags=0; /* for the library */ + int page, retval; + + prgname = argv[0]; + + /* First of all, accept "--help" and "-h" as a special case */ + if (argc == 2 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h"))) { + commandline_errormsg(stderr, option_table, argv[0], "Options:\n"); + fprintf(stderr,"\n"); + list_encodes(stderr); + exit(1); + } + /* Also, accept "--version" as a special case */ + if (argc == 2 && (!strcmp(argv[1],"--version"))) { + printf("barcode frontend (GNU barcode) " BARCODE_VERSION "\n"); + exit(0); + } + + /* Otherwise, parse the commandline */ + retval = commandline(option_table, argc, argv, "Use: %s [options]\n"); + if (retval) { + if (retval == -1) /* help printed, complete it */ + list_encodes(stderr); + else /* no help printed, suggest it */ + fprintf(stderr, "%s: try \"%s --help\"\n", prgname, prgname); + exit(1); + } + + /* If no paper size has been specified, use the default, if any */ + if (!page_name) { + page_wid = 595; page_hei = 842; + page_name = "A4"; /* I live in Europe :) */ +#ifndef NO_LIBPAPER + get_page_geometry(systempapername()); /* or the system default */ +#endif + } + + /* FIXME: print warnings for incompatible options */ + + /* open the input stream if specified */ + if (ifilename) + ifile = fopen(ifilename,"r"); + if (!ifile) { + fprintf(stderr, "%s: %s: %s\n", argv[0], ifilename, + strerror(errno)); + exit(1); + } + + /* open the output stream if specified */ + if (ofilename) + ofile = fopen(ofilename,"w"); + if (!ofile) { + fprintf(stderr, "%s: %s: %s\n", argv[0], ofilename, + strerror(errno)); + exit(1); + } + + if (encoding_type < 0) { /* unknown type specified */ + fprintf(stderr,"%s: Unknown endoding. Try \"%s --help\"\n", + argv[0], argv[0]); + exit(1); + } + flags |= encoding_type; + if (pcl) { + flags |= BARCODE_OUT_PCL; + } else { + ps = !eps; /* a shortcut */ + if (eps) + flags |= BARCODE_OUT_EPS; /* print headers too */ + else + flags |= BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + } + if (noascii) + flags |= BARCODE_NO_ASCII; + if (nochecksum) + flags |= BARCODE_NO_CHECKSUM; + + /* the table is not available in eps mode */ + if (eps && (lines>1 || columns>1)) { + fprintf(stderr, "%s: can't print tables in EPS format\n",argv[0]); + exit(1); + } + + if (ps) { /* The header is independent of single/table mode */ + /* Headers. Don't let the library do it, we may need multi-page */ + fprintf(ofile, "%%!PS-Adobe-2.0\n"); + /* It would be nice to know the bounding box. Leave it alone */ + fprintf(ofile, "%%%%Creator: \"barcode\", " + "libbarcode sample frontend\n"); + if (page_name) + fprintf(ofile, "%%%%DocumentPaperSizes: %s\n", page_name); + fprintf(ofile, "%%%%EndComments\n"); + fprintf(ofile, "%%%%EndProlog\n\n"); + } + + /* + * Here we are, ready to work. Handle the one-per-page case first, + * as it is shorter. + */ + if (!lines && !columns) { + page = 0; + while ( (line = retrieve_input_string(ifile)) ) { + page++; + if (ps) { + fprintf(ofile, "%%%%Page: %i %i\n\n",page,page); + } + if (Barcode_Encode_and_Print(line, ofile, code_width, code_height, + xmargin0, ymargin0, flags) < 0) { + fprintf(stderr, "%s: can't encode \"%s\"\n", argv[0], line); + } + if (eps) break; /* if output is eps, do it once only */ + if (ps) fprintf(ofile, "showpage\n"); + if (pcl) fprintf(ofile, "\f"); + } + /* no more lines, print footers */ + if (ps) { + fprintf(ofile, "%%%%Trailer\n\n"); + } + } else { + + /* table mode, the header has been already printed */ + + int xstep = (page_wid - xmargin0 - xmargin1)/columns; + int ystep = (page_hei - ymargin0 - ymargin1)/lines; + int x = columns, y = -1; /* position in the table, start off-page */ + + if (!ximargin) ximargin = BARCODE_DEFAULT_MARGIN; + if (!yimargin) yimargin = BARCODE_DEFAULT_MARGIN; + /* Assign default size unless -g did it (Joachim Reichelt) */ + if ( !code_width && !code_height) { + code_width = xstep - 2*ximargin; + code_height = ystep - 2*yimargin; + } + + page=0; + while ( (line = retrieve_input_string(ifile)) ) { + x++; /* fit x and y */ + if (x >= columns) { + x=0; y--; + if (y<0) { + y = lines-1; page++; + /* flush page */ + if (ps && page > 1) fprintf(ofile, "showpage\n"); + if (pcl && page > 1) fprintf(ofile, "\f"); + /* new page */ + if (ps) fprintf(ofile, "%%%%Page: %i %i\n\n",page,page); + } + } + + /* + * Create a barcode item. This allows to set the margin to 0, as + * we have [xy]imargin to use. But don't use Encode_and_Print(), + * unroll it here instead + */ + bc = Barcode_Create(line); + if (!bc) { + fprintf(stderr, "%s: Barcode_Create(): %s\n", argv[0], + strerror(errno)); + exit(1); + } + bc->margin = 0; + if ( (Barcode_Position(bc, code_width, code_height, + xmargin0 + ximargin + x * xstep, + ymargin0 + yimargin + y * ystep, 0.0) < 0) + || (Barcode_Encode(bc, flags) < 0) + || (Barcode_Print(bc, ofile, flags) < 0) ) { + fprintf(stderr, "%s: can't encode \"%s\": %s\n", argv[0], + line, strerror(bc->error)); + } + Barcode_Delete(bc); + } + if (ps) fprintf(ofile, "showpage\n\n%%%%Trailer\n\n"); + if (pcl) fprintf(ofile, "\f"); + } + return 0; +} + + + diff --git a/glabels2/barcode-0.98/missing b/glabels2/barcode-0.98/missing new file mode 100755 index 0000000..d46f79f --- /dev/null +++ b/glabels2/barcode-0.98/missing @@ -0,0 +1,198 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc. +# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.in; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`$configure_ac'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`$configure_ac'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`$configure_ac'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/glabels2/barcode-0.98/mkinstalldirs b/glabels2/barcode-0.98/mkinstalldirs new file mode 100755 index 0000000..6b3b5fc --- /dev/null +++ b/glabels2/barcode-0.98/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/glabels2/barcode-0.98/msi.c b/glabels2/barcode-0.98/msi.c new file mode 100644 index 0000000..77a373b --- /dev/null +++ b/glabels2/barcode-0.98/msi.c @@ -0,0 +1,155 @@ +/* + * msi.c -- encoding for MSI-Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + + +/* Patterns */ +static char *patterns[] = { "13", "31" }; + +static char *fillers[] = { "031", "131" }; + +static int width = 16 /* each character uses 4 patterns */, + startpos = 6 /* length of the first filler */; + +/* + * Check that the text can be encoded. Returns 0 or -1. + */ +int Barcode_msi_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!isdigit(text[i])) + return -1; + } + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[(code >> 3) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 1) & 1], + patterns[code & 1]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_msi_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("msi"); + + if ((bc->flags & BARCODE_NO_CHECKSUM)) + usesum = 0; + else + usesum = 1; + + text = bc->ascii; + + /* the partial code is head + 8 * (text + check) + tail + margin + term. */ + partial = malloc( 3 + 8 * (strlen(text) + 1) + 3 + 2 ); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; i<strlen(text); i++) { + code = text[i] - '0'; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + + textpos += width; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + if (usesum) { + /* For a code ...FEDCBA the checksum is computed + * as the sum of digits of the number ...FDB plus + * the sum of digits of the number ...ECA * 2. + * Which is equivalent to the sum of each digit of ...ECA doubled + * plus carry. + */ + if ((i ^ strlen(text)) & 1) { + /* a last digit, 2 away from last, etc. */ + checksum += 2 * code + (2 * code) / 10; + } else { + checksum += code; + } + } + } + /* Some implementations use a double checksum. Currently the only way + * to print a barcode with double checksum is to put the checksum + * digit printed below at the end of a code in the command line + * and re-run the program. + */ + if (usesum) { + /* the check digit is the complement of the checksum + * to a multiple of 10. + */ + checksum = (checksum + 9) / 10 * 10 - checksum; + /* fprintf(stderr, "Checksum: %d\n", checksum); */ + add_one(ptr, checksum); + ptr += strlen(ptr); + } + + strcpy(ptr, fillers[1]); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/pcl.c b/glabels2/barcode-0.98/pcl.c new file mode 100644 index 0000000..d5ec097 --- /dev/null +++ b/glabels2/barcode-0.98/pcl.c @@ -0,0 +1,200 @@ +/* + * pcl.c -- printing the "partial" bar encoding in PCL format + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Andrea Scopece (a.scopece@tin.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? See file "ps.c" + */ + + +int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + char font_id[6]; /* default font, should be "scalable" */ + /* 0 Line printer, use on older LJet II, isn't scalable */ + /* 4148 Univers, use on LJet III series, and Lj 4L, 5L */ + /* 16602 Arial, default LJ family 4, 5, 6, Color, Djet */ + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + +#if 0 + /* If too small (5 + text), enlarge and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + int hei = i * scalef; + bc->yoff -= (hei-bc->height)/2; + bc->height = hei; + if (bc->yoff < 0) { + bc->height += -bc->yoff; + bc->yoff = 0; + } + } +#else + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } +#endif + + /* + * deal with PCL output + */ + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + + fprintf(f,"%c&a%.0fH", 27, x0 * 10.0); + fprintf(f,"%c&a%.0fV", 27, y0 * 10.0); + fprintf(f,"%c*c%.0fH", 27, ((j*scalef)-SHRINK_AMOUNT) * 10.0); + fprintf(f,"%c*c%.0fV", 27, yr * 10.0); + fprintf(f,"%c*c0P\n", 27); + } + xpos += j * scalef; + } + + /* the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + /* select a Scalable Font */ + + if (fsav != f2) + { + if ((bc->flags & BARCODE_OUT_PCL_III) == BARCODE_OUT_PCL_III) + { strcpy(font_id, "4148"); /* font Univers */ + } + else + { strcpy(font_id, "16602"); /* font Arial */ + } + + fprintf(f,"%c(8U%c(s1p%5.2fv0s0b%sT", 27, 27, f2 * scalef, font_id); + } + fsav = f2; + + fprintf(f,"%c&a%.0fH", 27, (bc->xoff + f1 * scalef + bc->margin) * 10.0); + fprintf(f,"%c&a%.0fV", 27, + mode != '-' + ? ((double)bc->yoff + bc->margin + 8*scalef) * 10.0 + : ((double)bc->yoff + bc->margin + bc->height ) * 10.0); + + fprintf(f, "%c", c); + } + + } + + return 0; +} diff --git a/glabels2/barcode-0.98/plessey.c b/glabels2/barcode-0.98/plessey.c new file mode 100644 index 0000000..ec47100 --- /dev/null +++ b/glabels2/barcode-0.98/plessey.c @@ -0,0 +1,164 @@ +/* + * plessey.c -- encoding for Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + +static char * patterns[] = { "13", "31" }; + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "ABCDEF"; + +/* stop sequence may be 231311313 (barcodemill.com) */ +static char *fillers[] = { "031311331", "331311313" }; + +static int width = 16, startpos = 16; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_pls_verify(unsigned char *text) +{ + int i, upper = 0, lower = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!strchr(alphabet,toupper(text[i]))) + return -1; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + } + if (upper && lower) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[code & 1], + patterns[(code >> 1) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 3) & 1] + ); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_pls_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + unsigned char *checkptr; + int i, code, textpos; + static char check[9] = {1,1,1,1,0,1,0,0,1}; + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("plessey"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 4) * 8 + 3); + checkptr = calloc (1, strlen(text) * 4 + 8); + + if (!partial || !checkptr) { + if (partial) free(partial); + if (checkptr) free(checkptr); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; i<strlen(text); i++) { + c = strchr(alphabet, toupper(text[i])); + if (!c) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += width; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + checkptr[4*i] = code & 1; + checkptr[4*i+1] = (code >> 1) & 1; + checkptr[4*i+2] = (code >> 2) & 1; + checkptr[4*i+3] = (code >> 3) & 1; + } + /* The CRC checksum is required */ + for (i=0; i < 4*strlen(text); i++) { + int j; + if (checkptr[i]) + for (j = 0; j < 9; j++) + checkptr[i+j] ^= check[j]; + } + for (i = 0; i < 8; i++) { + sprintf(ptr, patterns[checkptr[strlen(text) * 4 + i]]); + ptr += 2; + } + fprintf(stderr, "CRC: "); + for (i = 0; i < 8; i++) { + fputc('0' + checkptr[strlen(text) * 4 + i], stderr); + } + fputc('\n', stderr); + strcpy(ptr, fillers[1]); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/glabels2/barcode-0.98/ps.c b/glabels2/barcode-0.98/ps.c new file mode 100644 index 0000000..3591751 --- /dev/null +++ b/glabels2/barcode-0.98/ps.c @@ -0,0 +1,272 @@ +/* + * ps.c -- printing the "partial" bar encoding + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? + * + * The first char in "partial" tells how much extra space to add to the + * left of the bars. For EAN-13, it is used to leave space to print the + * first digit, other codes may have '0' for no-extra-space-needed. + * + * The next characters are alternating bars and spaces, as multiples + * of the base dimension which is 1 unless the code is + * rescaled. Rescaling is calculated as the ratio from the requested + * width and the calculated width. Digits represent bar/space + * dimensions. Lower-case letters represent those bars that should + * extend lower than the others: 'a' is equivalent to '1', 'b' is '2' and + * so on. + * + * The "textinfo" string is made up of fields "%lf:%lf:%c" separated by + * blank space. The first integer is the x position of the character, + * the second is the font size (before rescaling) and the char item is + * the charcter to be printed. + * + * Both the "partial" and "textinfo" strings may include "-" or "+" as + * special characters (in "textinfo" the char should be a standalone + * word). They state where the text should be printed: below the bars + * ("-", default) or above the bars. This is used, for example, to + * print the add-5 and add-2 codes to the right of UPC or EAN codes + * (the add-5 extension is mostly used in ISBN codes. + */ + + +int Barcode_ps_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen, printable=1; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + +#if 0 + /* If too small (5 + text), enlarge and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + int hei = i * scalef; + bc->yoff -= (hei-bc->height)/2; + bc->height = hei; + if (bc->yoff < 0) { + bc->height += -bc->yoff; + bc->yoff = 0; + } + } +#else + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } +#endif + + /* + * Ok, then deal with actual ps (eps) output + */ + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { /* spit a header first */ + if (bc->flags & BARCODE_OUT_EPS) + fprintf(f, "%%!PS-Adobe-2.0 EPSF-1.2\n"); + else + fprintf(f, "%%!PS-Adobe-2.0\n"); + fprintf(f, "%%%%Creator: libbarcode\n"); + if (bc->flags & BARCODE_OUT_EPS) { + fprintf(f, "%%%%BoundingBox: %i %i %i %i\n", + bc->xoff, + bc->yoff, + bc->xoff + bc->width + 2* bc->margin, + bc->yoff + bc->height + 2* bc->margin); + } + fprintf(f, "%%%%EndComments\n"); + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f, "%%%%EndProlog\n\n"); + fprintf(f, "%%%%Page: 1 1\n\n"); + } + } + + /* Print some informative comments */ + for (i=0; bc->ascii[i]; i++) + if (bc->ascii[i] < ' ') + printable = 0; + + fprintf(f,"%% Printing barcode for \"%s\", scaled %5.2f", + printable ? bc->ascii : "<unprintable string>", scalef); + if (bc->encoding) + fprintf(f,", encoded using \"%s\"",bc->encoding); + fprintf(f, "\n"); + fprintf(f,"%% The space/bar succession is represented " + "by the following widths (space first):\n" + "%% "); + for (i=0; i<strlen(bc->partial); i++) { + unsigned char c = bc->partial[i]; + if (isdigit(c)) putc(c, f); + if (islower(c)) putc(c-'a'+'1', f); + if (isupper(c)) putc(c-'A'+'1', f); + } + /* open array for "forall" */ + fprintf(f, "\n[\n%% height xpos ypos width" + " height xpos ypos width\n"); + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos + (j*scalef)/2; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + y0 += (isdigit(*ptr) ? 10 : 5) * scalef; + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + /* Define an array and then use "forall" (Hans Schou) */ + fprintf(f," [%5.2f %6.2f %6.2f %5.2f]%s", + yr, x0, y0, (j * scalef) - SHRINK_AMOUNT, + i%4 == 1 ? " " : "\n"); + } + xpos += j * scalef; + } + fprintf(f,"\n]\t{ {} forall setlinewidth moveto 0 exch rlineto stroke} " + "bind forall\n"); + + /* Then, the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + fprintf(f, "[\n%% char xpos ypos fontsize\n"); + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + fprintf(f, " [("); + /* Both the backslash and the two parens are special */ + if (c=='\\' || c==')' || c=='(') + fprintf(f, "\\%c) ", c); + else + fprintf(f, "%c) ", c); + fprintf(f, "%6.2f %6.2f %5.2f]\n", + bc->xoff + f1 * scalef + bc->margin, + mode == '-' + ? (double)bc->yoff + bc->margin + : (double)bc->yoff + bc->margin+bc->height - 8*scalef, + fsav == f2 ? 0.0 : f2 * scalef); + fsav = f2; + } + fprintf(f,"] { {} forall dup 0.00 ne {\n\t" + "/Helvetica findfont exch scalefont setfont\n" + " } {pop} ifelse\n" + " moveto show} bind forall\n"); + + + } + + fprintf(f,"%% End barcode for \"%s\"\n\n", + printable ? bc->ascii : "<unprintable string>"); + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f,"showpage\n"); + fprintf(f, "%%%%Trailer\n\n"); + } + } + return 0; +} + + + + diff --git a/glabels2/barcode-0.98/sample.c b/glabels2/barcode-0.98/sample.c new file mode 100644 index 0000000..46e6205 --- /dev/null +++ b/glabels2/barcode-0.98/sample.c @@ -0,0 +1,98 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "barcode.h" + +int main(int argc, char **argv) +{ + int ps = 1, pcl = 0, oflags; + if (argc == 2 && !strcmp(argv[1],"-P")) { + ps = 0; pcl = 1; argc=1; + } + if (argc>2) { + fprintf(stderr, "%s: use \"%s\" for postscript or \"%s -P\" for PCL\n", + argv[0], argv[0], argv[0]); + exit(1); + } + if (pcl) { + oflags = BARCODE_OUT_PCL; + } else { + oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + printf("%%!PS-Adobe-2.0\n"); + printf("%%%%Creator: barcode sample program\n"); + printf("%%%%EndComments\n"); + printf("%%%%EndProlog\n\n"); + printf("%%%%Page: 1 1\n\n"); + } + /* Print a few barcodes in several places in the page */ + + /* default size, bottom left */ + Barcode_Encode_and_Print("800894002700",stdout, 0, 0, 40, 40, + BARCODE_EAN | oflags); + + /* smaller */ + Barcode_Encode_and_Print("800894002700",stdout, 70, 50, 160, 55, + BARCODE_EAN | oflags); + + /* smallest */ + Barcode_Encode_and_Print("800894002700",stdout, 40, 30, 270, 70, + BARCODE_EAN | oflags); + + /* A bigger all-0 */ + Barcode_Encode_and_Print("000000000000",stdout, 170, 0, 40, 160, + BARCODE_EAN | oflags); + + /* Still bigger all-0 (but UPC, this time) */ + Barcode_Encode_and_Print("00000000000",stdout, 250, 0, 270, 160, + BARCODE_UPC | oflags); + + /* A few code-39 ones */ + Barcode_Encode_and_Print("silly code",stdout, 0, 0, 40, 320, + BARCODE_39 | oflags); + Barcode_Encode_and_Print("SAMPLE CODES",stdout, 100, 30, 400, 80, + BARCODE_39 | oflags); + + /* ISBN with add-5 */ + Barcode_Encode_and_Print("1-56592-292-1 90000",stdout, 0, 0, 40, 430, + BARCODE_ISBN | oflags); + + /* UPC with add-2 */ + Barcode_Encode_and_Print("07447084452 07",stdout, 0, 0, 300, 410, + BARCODE_UPC | oflags); + + /* code 128-C */ + Barcode_Encode_and_Print("12345678900123456789",stdout, 0, 0, 40, 530, + BARCODE_128C | oflags); + + /* and my data as code-128B autodetected */ + Barcode_Encode_and_Print("RBNLSN68T11E897W",stdout, 0, 60, 240, 510, + oflags); + /* same as code-39, forced */ + Barcode_Encode_and_Print("RBNLSN68T11E897W",stdout, 0, 60, 240, 590, + BARCODE_NO_CHECKSUM | BARCODE_39 | oflags); + + /* one interleaved 2 of 5 */ + Barcode_Encode_and_Print("0123456789",stdout, 0, 0, 40, 620, + BARCODE_I25 | oflags); + + /* upc-e and ean-8 (autotected based on code size) */ + Barcode_Encode_and_Print("012345",stdout, 0, 0, 50, 720, oflags); + Barcode_Encode_and_Print("0123456",stdout, 0, 0, 160, 720, oflags); + + + + if (pcl) { + printf("\f"); + } else { + printf("\nshowpage\n"); + printf("%%%%Trailer\n\n"); + } + return 0; +} + + + + + + + diff --git a/glabels2/config.h.in b/glabels2/config.h.in new file mode 100644 index 0000000..bceba42 --- /dev/null +++ b/glabels2/config.h.in @@ -0,0 +1,154 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef PACKAGE +#undef VERSION +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR +#undef GETTEXT_PACKAGE +#undef HACKTEXT + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define if using `alloca.c'. */ +#undef C_ALLOCA + +/* always defined to indicate that i18n is enabled */ +#undef ENABLE_NLS + +/* Define if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you have the <argz.h> header file. */ +#undef HAVE_ARGZ_H + +/* Define if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Define if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if your <locale.h> file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the <locale.h> header file. */ +#undef HAVE_LOCALE_H + +/* Define if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define if you have the <nl_types.h> header file. */ +#undef HAVE_NL_TYPES_H + +/* Define if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT + +/* Define if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT + +/* Define if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY + +/* Name of package */ +#undef PACKAGE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `long' if <sys/types.h> does not define. */ +#undef off_t + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t diff --git a/glabels2/configure b/glabels2/configure new file mode 100755 index 0000000..d6f01dd --- /dev/null +++ b/glabels2/configure @@ -0,0 +1,6303 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52 for glabels 1.89.0. +# +# Report bugs to <http://sourceforge.net/tracker/?func=add&group_id=46122&atid=445116>. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="src/glabels.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subdirs_all="$ac_subdirs_all barcode-0.98" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME='glabels' +PACKAGE_TARNAME='glabels' +PACKAGE_VERSION='1.89.0' +PACKAGE_STRING='glabels 1.89.0' +PACKAGE_BUGREPORT='http://sourceforge.net/tracker/?func=add&group_id=46122&atid=445116' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<EOF +\`configure' configures glabels 1.89.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +EOF + + cat <<EOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +EOF + + cat <<\EOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +EOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of glabels 1.89.0:";; + esac + cat <<\EOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-platform-gnome-2 enable GNOME 2.x platform default=no + --enable-compile-warnings=no/minimum/yes/maximum/error Turn on compiler warnings. + --enable-iso-c Try to warn if code is not ISO C + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to <http://sourceforge.net/tracker/?func=add&group_id=46122&atid=445116>. +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF +glabels configure 1.89.0 +generated by GNU Autoconf 2.52 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by glabels $as_me 1.89.0, which was +generated by GNU Autoconf 2.52. Invocation command line was + + $ $0 $@ + +EOF +{ +cat <<_ASUNAME +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:878: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:889: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:897: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:913: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:917: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:923: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:925: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:927: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:946: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:948: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:968: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:971: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:997: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1017: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1066: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:1077: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:1100: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { { echo "$as_me:1113: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest* +echo "$as_me:1120: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +echo "$as_me:1135: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:1155: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:1159: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +PACKAGE=glabels + +VERSION=1.89.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { { echo "$as_me:1169: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >>confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + +missing_dir=`cd $ac_aux_dir && pwd` +echo "$as_me:1183: checking for working aclocal" >&5 +echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$as_me:1190: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$as_me:1194: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1198: checking for working autoconf" >&5 +echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$as_me:1205: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$as_me:1209: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1213: checking for working automake" >&5 +echo $ECHO_N "checking for working automake... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$as_me:1220: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$as_me:1224: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1228: checking for working autoheader" >&5 +echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$as_me:1235: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$as_me:1239: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1243: checking for working makeinfo" >&5 +echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$as_me:1250: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$as_me:1254: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1258: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:1267: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + +ac_config_headers="$ac_config_headers config.h" + +ac_config_commands="$ac_config_commands default-1" + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:1285: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:1302: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:1313: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:1316: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + have_pkgconfig=no + if test -x "$PKG_CONFIG" ; then + have_pkgconfig=yes + else + PKG_CONFIG= + fi + echo "$as_me:1326: checking for pkg-config" >&5 +echo $ECHO_N "checking for pkg-config... $ECHO_C" >&6 + pkgconfig_required_version=0.8.0 + if test x$have_pkgconfig = xyes ; then + $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version + if test $? -ne 0; then + echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + have_pkgconfig=no + fi + fi + if test x$have_pkgconfig = xyes ; then + echo "$as_me:1338: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + PKG_CONFIG= + echo "$as_me:1342: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + if test xfail = xfail; then + { { echo "$as_me:1345: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&5 +echo "$as_me: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&2;} + { (exit 1); exit 1; }; } + fi + fi + + if test xyes = xyes ; then + platform_gnome_2_default=yes + else + platform_gnome_2_default=no + fi + if test xforce = xforce ; then + platform_gnome_2="$platform_gnome_2_default"; + else + # Check whether --enable-platform-gnome-2 or --disable-platform-gnome-2 was given. +if test "${enable_platform_gnome_2+set}" = set; then + enableval="$enable_platform_gnome_2" + platform_gnome_2="$enableval" +else + platform_gnome_2="$platform_gnome_2_default" +fi; + fi + +if test $platform_gnome_2 = yes; then + PLATFORM_GNOME_2_TRUE= + PLATFORM_GNOME_2_FALSE='#' +else + PLATFORM_GNOME_2_TRUE='#' + PLATFORM_GNOME_2_FALSE= +fi + + echo "$as_me:1382: checking for GNOME Platform" >&5 +echo $ECHO_N "checking for GNOME Platform... $ECHO_C" >&6 + if test $platform_gnome_2 = yes; then + echo "$as_me:1385: result: GNOME 2.x" >&5 +echo "${ECHO_T}GNOME 2.x" >&6 + GNOME_INTERFACE_VERSION=2 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:1391: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:1408: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:1419: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:1422: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + have_pkgconfig=no + if test -x "$PKG_CONFIG" ; then + have_pkgconfig=yes + else + PKG_CONFIG= + fi + echo "$as_me:1432: checking for pkg-config" >&5 +echo $ECHO_N "checking for pkg-config... $ECHO_C" >&6 + pkgconfig_required_version=0.8.0 + if test x$have_pkgconfig = xyes ; then + $PKG_CONFIG --atleast-pkgconfig-version $pkgconfig_required_version + if test $? -ne 0; then + echo "*** Your version of pkg-config is too old. You need version $pkgconfig_required_version or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + have_pkgconfig=no + fi + fi + if test x$have_pkgconfig = xyes ; then + echo "$as_me:1444: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + PKG_CONFIG= + echo "$as_me:1448: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + if test xfail = xfail; then + { { echo "$as_me:1451: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&5 +echo "$as_me: error: +*** You need the latest pkg-config (at least $pkgconfig_required_version). +*** Get the latest version of pkg-config from +*** http://www.freedesktop.org/software/pkgconfig." >&2;} + { (exit 1); exit 1; }; } + fi + fi + + else + echo "$as_me:1464: result: GNOME 1.x" >&5 +echo "${ECHO_T}GNOME 1.x" >&6 + GNOME_INTERFACE_VERSION=1 + fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1477: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1492: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1500: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1503: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1512: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1527: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1535: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1538: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1551: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1566: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1574: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1577: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1586: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1601: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1609: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1612: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1625: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1645: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1667: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1670: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1681: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1696: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1704: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1707: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1720: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1735: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1743: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1746: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1758: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1763:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1766: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1769: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1771: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1774: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1776: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1779: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1783 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1799: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1802: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1805: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1828: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1834: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1839: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1845: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1848: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1855: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1863: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1870: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1872: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1875: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1877: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1880: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1896: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1902: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1908: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1914 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1926: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1929: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1941: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1948: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1952: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1958 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1973: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1976: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1979: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1982: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1994: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:2000: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2006 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2018: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2021: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2024: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2027: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2037: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2064: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2067: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2070: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2073: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 2085 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2098: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2101: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2104: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2107: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 2117 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2129: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2132: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2135: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2138: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + echo "$as_me:2165: checking for strerror in -lcposix" >&5 +echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6 +if test "${ac_cv_lib_cposix_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2173 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2192: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2195: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2198: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2201: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_cposix_strerror=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_cposix_strerror=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2212: result: $ac_cv_lib_cposix_strerror" >&5 +echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6 +if test $ac_cv_lib_cposix_strerror = yes; then + LIBS="$LIBS -lcposix" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:2226: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:2241: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2249: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2252: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:2261: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:2276: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:2284: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:2287: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:2300: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:2315: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2323: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2326: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:2335: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:2350: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:2358: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:2361: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:2374: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:2394: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2416: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2419: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:2430: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:2445: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:2453: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:2456: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2469: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:2484: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:2492: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:2495: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:2507: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:2512:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:2515: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:2518: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:2520: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:2523: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:2525: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:2528: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:2531: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2537 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2552: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2555: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2558: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2561: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:2573: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:2579: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2585 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2597: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2600: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2603: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2606: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2616: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2643: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2646: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2649: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2652: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 2664 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2677: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2680: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2683: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2686: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 2696 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2708: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2711: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2714: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2717: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:2744: checking for ${CC-cc} option to accept ANSI C" >&5 +echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 +if test "${am_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + cat >conftest.$ac_ext <<_ACEOF +#line 2761 "configure" +#include "confdefs.h" +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; + +int +main () +{ + +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2803: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2806: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2809: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2812: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_prog_cc_stdc="$ac_arg"; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +CC="$ac_save_CC" + +fi + +if test -z "$am_cv_prog_cc_stdc"; then + echo "$as_me:2826: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 +else + echo "$as_me:2829: result: $am_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$am_cv_prog_cc_stdc" >&6 +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:2842: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2863 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:2868: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2874: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2897 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2901: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2907: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2944: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2954 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:2959: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2965: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2988 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2992: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2998: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:3026: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:3037: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3043 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:3051: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:3057: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 3079 "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 3097 "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 3118 "configure" +#include "confdefs.h" +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:3144: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3147: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:3149: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3152: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:3165: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + if test -z "" ; then + default_compile_warnings=no + else + default_compile_warnings="" + fi + + # Check whether --enable-compile-warnings or --disable-compile-warnings was given. +if test "${enable_compile_warnings+set}" = set; then + enableval="$enable_compile_warnings" + enable_compile_warnings="$enableval" +else + enable_compile_warnings="$default_compile_warnings" +fi; + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall -Wunused" + ;; + yes) + warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" + ;; + maximum|error) + warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wsign-promo -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + echo "$as_me:3213: checking whether gcc understands $option" >&5 +echo $ECHO_N "checking whether gcc understands $option... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 3216 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3228: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3231: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3234: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3237: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + has_option=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +has_option=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + echo "$as_me:3247: result: $has_option" >&5 +echo "${ECHO_T}$has_option" >&6 + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + { { echo "$as_me:3261: error: Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" >&5 +echo "$as_me: error: Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + CFLAGS="$realsave_CFLAGS" + echo "$as_me:3267: checking what warning flags to pass to the C compiler" >&5 +echo $ECHO_N "checking what warning flags to pass to the C compiler... $ECHO_C" >&6 + echo "$as_me:3269: result: $warning_flags" >&5 +echo "${ECHO_T}$warning_flags" >&6 + + # Check whether --enable-iso-c or --disable-iso-c was given. +if test "${enable_iso_c+set}" = set; then + enableval="$enable_iso_c" + +else + enable_iso_c=no +fi; + + echo "$as_me:3280: checking what language compliance flags to pass to the C compiler" >&5 +echo $ECHO_N "checking what language compliance flags to pass to the C compiler... $ECHO_C" >&6 + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *\ \ -ansi\ \ *) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *\ \ -pedantic\ \ *) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + echo "$as_me:3295: result: $complCFLAGS" >&5 +echo "${ECHO_T}$complCFLAGS" >&6 + + WARN_CFLAGS="$warning_flags $complCFLAGS" + +GNOME_X_CHECKS + +# Extract the first word of "glib-genmarshal", so it can be a program name with args. +set dummy glib-genmarshal; ac_word=$2 +echo "$as_me:3304: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GLIB_GENMARSHAL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GLIB_GENMARSHAL in + [\\/]* | ?:[\\/]*) + ac_cv_path_GLIB_GENMARSHAL="$GLIB_GENMARSHAL" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GLIB_GENMARSHAL="$ac_dir/$ac_word" + echo "$as_me:3321: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +GLIB_GENMARSHAL=$ac_cv_path_GLIB_GENMARSHAL + +if test -n "$GLIB_GENMARSHAL"; then + echo "$as_me:3332: result: $GLIB_GENMARSHAL" >&5 +echo "${ECHO_T}$GLIB_GENMARSHAL" >&6 +else + echo "$as_me:3335: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +GTK_REQUIRED=2.0.5 +LIBGNOMEUI_REQUIRED=2.0.1 +LIBXML_REQUIRED=2.4.23 +LIBGNOMEPRINT_REQUIRED=1.115.0 +LIBGNOMEPRINTUI_REQUIRED=1.115.0 +LIBGNOMECANVAS_REQUIRED=2.0.1 +GDKPIXBUF_REQUIRED=2.0.5 + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:3352: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:3369: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:3381: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:3384: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:3398: checking for gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED" >&5 +echo $ECHO_N "checking for gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED" ; then + echo "$as_me:3420: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:3424: checking GLABELS_CFLAGS" >&5 +echo $ECHO_N "checking GLABELS_CFLAGS... $ECHO_C" >&6 + GLABELS_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED"` + echo "$as_me:3433: result: $GLABELS_CFLAGS" >&5 +echo "${ECHO_T}$GLABELS_CFLAGS" >&6 + + echo "$as_me:3436: checking GLABELS_LIBS" >&5 +echo $ECHO_N "checking GLABELS_LIBS... $ECHO_C" >&6 + GLABELS_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED"` + echo "$as_me:3445: result: $GLABELS_LIBS" >&5 +echo "${ECHO_T}$GLABELS_LIBS" >&6 + else + GLABELS_CFLAGS="" + GLABELS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GLABELS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED"` + echo $GLABELS_PKG_ERRORS + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + : + else + { { echo "$as_me:3471: error: Library requirements (gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 +echo "$as_me: error: Library requirements (gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} + { (exit 1); exit 1; }; } + fi + +GETTEXT_PACKAGE=glabels + +cat >>confdefs.h <<EOF +#define GETTEXT_PACKAGE "$GETTEXT_PACKAGE" +EOF + +ALL_LINGUAS="fr de ja pt_BR" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:3498: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:3513: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:3521: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:3524: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:3533: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:3548: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:3557: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:3560: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +echo "$as_me:3569: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 3577 "configure" +#include "confdefs.h" +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:3626: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3629: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3632: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3635: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:3652: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:3655: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:3660: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3666 "configure" +#include "confdefs.h" + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3724: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3727: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3730: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3733: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3743: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\EOF +#define const +EOF + +fi + +echo "$as_me:3753: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +#line 3761 "configure" +#include "confdefs.h" +#ifndef __cplusplus +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3770: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3773: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3776: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3779: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:3790: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in + inline | yes) ;; + no) +cat >>confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >>confdefs.h <<EOF +#define inline $ac_cv_c_inline +EOF + ;; +esac + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:3811: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3817 "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3823: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3826: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3829: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3832: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3842: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:3852: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3858 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3873: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3876: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3879: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3882: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3892: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <<EOF +#define off_t long +EOF + +fi + +echo "$as_me:3904: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3910 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3925: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3928: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3931: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3934: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3944: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<EOF +#define size_t unsigned +EOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo "$as_me:3958: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3964 "configure" +#include "confdefs.h" +#include <alloca.h> +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3976: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3979: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3982: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3985: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_working_alloca_h=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3995: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo "$as_me:4005: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4011 "configure" +#include "confdefs.h" +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4043: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4046: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4049: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4052: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_alloca_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_alloca_works=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4062: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 + +if test $ac_cv_func_alloca_works = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=alloca.$ac_objext + +cat >>confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + +echo "$as_me:4083: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4089 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +echo "$as_me:4107: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4112: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4118 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4149: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4152: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4155: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4158: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4168: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<EOF +#define CRAY_STACKSEG_END $ac_func +EOF + + break +fi + + done +fi + +echo "$as_me:4182: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4191 "configure" +#include "confdefs.h" +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + exit (find_stack_direction () < 0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4214: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4217: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4219: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4222: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_stack_direction=1 +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_stack_direction=-1 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:4234: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 + +cat >>confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:4246: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4252 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4256: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4262: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4281: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +for ac_func in getpagesize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4294: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4300 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4331: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4334: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4337: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4340: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4350: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:4360: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat >conftest.$ac_ext <<_ACEOF +#line 4369 "configure" +#include "confdefs.h" +$ac_includes_default +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include <fcntl.h> +#include <sys/mman.h> + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4496: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4499: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4501: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4504: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:4516: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi +rm -f conftest.mmap + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:4531: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4537 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4541: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4547: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4566: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ +strdup __argz_count __argz_stringify __argz_next +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4580: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4586 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4617: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4620: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4623: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4626: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4636: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + + if test $ac_cv_header_locale_h = yes; then + echo "$as_me:4647: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4653 "configure" +#include "confdefs.h" +#include <locale.h> +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4665: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4668: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4671: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4674: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4684: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + USE_NLS=yes + + nls_cv_force_use_gnu_gettext="no" + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + echo "$as_me:4704: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4710 "configure" +#include "confdefs.h" +#include <libintl.h> +_ACEOF +if { (eval echo "$as_me:4714: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4720: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_libintl_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_libintl_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4739: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 +if test $ac_cv_header_libintl_h = yes; then + echo "$as_me:4742: checking for dgettext in libc" >&5 +echo $ECHO_N "checking for dgettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_dgettext_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4748 "configure" +#include "confdefs.h" +#include <libintl.h> +int +main () +{ +return (int) dgettext ("","") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4760: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4763: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4766: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4769: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_dgettext_libc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +gt_cv_func_dgettext_libc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4779: result: $gt_cv_func_dgettext_libc" >&5 +echo "${ECHO_T}$gt_cv_func_dgettext_libc" >&6 + + if test "$gt_cv_func_dgettext_libc" != "yes"; then + echo "$as_me:4783: checking for bindtextdomain in -lintl" >&5 +echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 4791 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char bindtextdomain (); +int +main () +{ +bindtextdomain (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4810: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4813: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4816: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4819: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_bindtextdomain=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_intl_bindtextdomain=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4830: result: $ac_cv_lib_intl_bindtextdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6 +if test $ac_cv_lib_intl_bindtextdomain = yes; then + echo "$as_me:4833: checking for dgettext in libintl" >&5 +echo $ECHO_N "checking for dgettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_dgettext_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + echo "$as_me:4838: checking for dgettext in -lintl" >&5 +echo $ECHO_N "checking for dgettext in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_dgettext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 4846 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dgettext (); +int +main () +{ +dgettext (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4865: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4868: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4871: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4874: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_dgettext=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_intl_dgettext=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4885: result: $ac_cv_lib_intl_dgettext" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_dgettext" >&6 +if test $ac_cv_lib_intl_dgettext = yes; then + gt_cv_func_dgettext_libintl=yes +else + gt_cv_func_dgettext_libintl=no +fi + +fi +echo "$as_me:4894: result: $gt_cv_func_dgettext_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_dgettext_libintl" >&6 +fi + + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + LIBS="$LIBS -lintl"; + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + +cat >>confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:4913: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$as_me:4940: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:4943: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + if test "$MSGFMT" != "no"; then + +for ac_func in dcgettext +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4951: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4957 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4988: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4991: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4994: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4997: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5007: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:5019: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + echo "$as_me:5036: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:5048: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:5051: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:5057: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$as_me:5084: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:5087: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + cat >conftest.$ac_ext <<_ACEOF +#line 5092 "configure" +#include "confdefs.h" + +int +main () +{ +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5105: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5108: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5111: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5114: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + INSTOBJEXT=.mo + fi + fi + + # Added by Martin Baulig 12/15/98 for libc5 systems + if test "$gt_cv_func_dgettext_libc" != "yes" \ + && test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS=-lintl + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + fi + +fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" != "yes"; then + +cat >>confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + else + CATOBJEXT= + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$as_me:5157: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + ac_config_commands="$ac_config_commands default-2" + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo "$as_me:5177: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + echo "$as_me:5186: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + test -d po || mkdir po + if test "$CATOBJEXT" = ".cat"; then + echo "$as_me:5197: checking for linux/version.h" >&5 +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_version_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5203 "configure" +#include "confdefs.h" +#include <linux/version.h> +_ACEOF +if { (eval echo "$as_me:5207: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5213: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_linux_version_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_linux_version_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:5232: result: $ac_cv_header_linux_version_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 +if test $ac_cv_header_linux_version_h = yes; then + msgformat=linux +else + msgformat=xopen +fi + + sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + +if test "x${prefix}" = "xNONE"; then + cat >>confdefs.h <<EOF +#define PACKAGE_LOCALE_DIR "${ac_default_prefix}/${DATADIRNAME}/locale" +EOF + + cat >>confdefs.h <<EOF +#define PACKAGE_DATA_DIR "${ac_default_prefix}/${DATADIRNAME}" +EOF + +else + cat >>confdefs.h <<EOF +#define PACKAGE_LOCALE_DIR "${prefix}/${DATADIRNAME}/locale" +EOF + + cat >>confdefs.h <<EOF +#define PACKAGE_DATA_DIR "${prefix}/${DATADIRNAME}" +EOF + +fi + +subdirs="$subdirs barcode-0.98" + +ac_config_files="$ac_config_files Makefile src/Makefile src/pixmaps/Makefile src/stock-pixmaps/Makefile po/Makefile.in doc/Makefile doc/C/Makefile glabels.spec" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:5367: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +EOF + +cat >>$CONFIG_STATUS <<EOF +ac_cs_version="\\ +glabels config.status 1.89.0 +configured by $0, generated by GNU Autoconf 2.52, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:5543: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:5562: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me (glabels 1.89.0) 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<EOF +# +# INIT-COMMANDS section. +# + +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/pixmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/pixmaps/Makefile" ;; + "src/stock-pixmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/stock-pixmaps/Makefile" ;; + "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/C/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/C/Makefile" ;; + "glabels.spec" ) CONFIG_FILES="$CONFIG_FILES glabels.spec" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "default-2" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-2" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:5615: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@PLATFORM_GNOME_2_TRUE@,$PLATFORM_GNOME_2_TRUE,;t t +s,@PLATFORM_GNOME_2_FALSE@,$PLATFORM_GNOME_2_FALSE,;t t +s,@GNOME_INTERFACE_VERSION@,$GNOME_INTERFACE_VERSION,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t +s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t +s,@GLABELS_CFLAGS@,$GLABELS_CFLAGS,;t t +s,@GLABELS_LIBS@,$GLABELS_LIBS,;t t +s,@GETTEXT_PACKAGE@,$GETTEXT_PACKAGE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t +s,@DATADIRNAME@,$DATADIRNAME,;t t +s,@GMOFILES@,$GMOFILES,;t t +s,@INSTOBJEXT@,$INSTOBJEXT,;t t +s,@INTLDEPS@,$INTLDEPS,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@INTLOBJS@,$INTLOBJS,;t t +s,@POFILES@,$POFILES,;t t +s,@POSUB@,$POSUB,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@subdirs@,$subdirs,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:5861: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:5879: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:5892: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:5953: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:5964: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:5977: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:6094: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + default-2 ) case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac ;; + esac +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d $srcdir/$ac_subdir || continue + + { echo "$as_me:6215: configuring in $ac_subdir" >&5 +echo "$as_me: configuring in $ac_subdir" >&6;} + case $srcdir in + .) ;; + *) { case "./$ac_subdir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="./$ac_subdir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + if test -d ./$ac_subdir; then :; + else + { { echo "$as_me:6237: error: cannot create \`pwd\`/$ac_subdir" >&5 +echo "$as_me: error: cannot create \`pwd\`/$ac_subdir" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_subdir + + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + ac_sub_configure="$SHELL '$ac_sub_srcdir/configure.gnu'" + elif test -f $ac_sub_srcdir/configure; then + ac_sub_configure="$SHELL '$ac_sub_srcdir/configure'" + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + { echo "$as_me:6268: WARNING: no configuration information is in $ac_subdir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_dots$cache_file ;; + esac + + { echo "$as_me:6282: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" >&5 +echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" >&6;} + # The eval makes quoting arguments work. + eval $ac_sub_configure $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir || + { { echo "$as_me:6287: error: $ac_sub_configure failed for $ac_subdir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_subdir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd $ac_popdir + done +fi + +echo " + +Configuration: + + Source code location: ${srcdir} + Compiler: ${CC} + +" diff --git a/glabels2/configure.in b/glabels2/configure.in new file mode 100644 index 0000000..3938d7b --- /dev/null +++ b/glabels2/configure.in @@ -0,0 +1,97 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(glabels, 1.89.0, http://sourceforge.net/tracker/?func=add&group_id=46122&atid=445116) +AC_CONFIG_SRCDIR(src/glabels.c) +AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) + +AM_MAINTAINER_MODE +AM_CONFIG_HEADER(config.h) + +GNOME_PLATFORM_GNOME_2(yes, force) + +AC_ISC_POSIX +AC_PROG_CC +AM_PROG_CC_STDC +AC_HEADER_STDC + +GNOME_COMPILE_WARNINGS +GNOME_X_CHECKS + +AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) + + +dnl ******************************************************************* +dnl * Check for required package and version +dnl ******************************************************************* +dnl Minimum versions of libraries +GTK_REQUIRED=2.0.5 +LIBGNOMEUI_REQUIRED=2.0.1 +LIBXML_REQUIRED=2.4.23 +LIBGNOMEPRINT_REQUIRED=1.115.0 +LIBGNOMEPRINTUI_REQUIRED=1.115.0 +LIBGNOMECANVAS_REQUIRED=2.0.1 +GDKPIXBUF_REQUIRED=2.0.5 + +PKG_CHECK_MODULES(GLABELS, gtk+-2.0 >= $GTK_REQUIRED + libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + libxml-2.0 >= $LIBXML_REQUIRED + libgnomeprint-2.0 >= $LIBGNOMEPRINT_REQUIRED + libgnomeprintui-2.0 >= $LIBGNOMEPRINTUI_REQUIRED + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED + gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED) +AC_SUBST(GLABELS_CFLAGS) +AC_SUBST(GLABELS_LIBS) + +dnl **************************************** +dnl * Supported languages +dnl **************************************** +dnl Add the languages which your application supports here. +GETTEXT_PACKAGE=glabels +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE") +ALL_LINGUAS="fr de ja pt_BR" +AM_GLIB_GNU_GETTEXT + + +dnl **************************************** +dnl * Set PACKAGE_LOCALE_DIR in config.h. +dnl **************************************** +if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale") + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/${DATADIRNAME}") +else + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale") + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/${DATADIRNAME}") +fi + + +dnl **************************************** +dnl * Configure barcode library +dnl **************************************** +AC_CONFIG_SUBDIRS(barcode-0.98) + + + +dnl **************************************** +dnl * Makefiles +dnl **************************************** +AC_OUTPUT([ +Makefile +src/Makefile +src/pixmaps/Makefile +src/stock-pixmaps/Makefile +po/Makefile.in +doc/Makefile +doc/C/Makefile +glabels.spec +]) + + +echo " + +Configuration: + + Source code location: ${srcdir} + Compiler: ${CC} + +" diff --git a/glabels2/cvswrappers b/glabels2/cvswrappers new file mode 100644 index 0000000..755951d --- /dev/null +++ b/glabels2/cvswrappers @@ -0,0 +1 @@ +*.png -k 'b' diff --git a/glabels2/data/predefined-labels.template b/glabels2/data/predefined-labels.template new file mode 100644 index 0000000..5ada010 --- /dev/null +++ b/glabels2/data/predefined-labels.template @@ -0,0 +1,495 @@ +<?xml version="1.0"?> +<GLabels-templates> + + + <!-- ******************************************************************** --> + <!-- Avery US-Letter products (and look-alikes) --> + <!-- ******************************************************************** --> + + <!-- =================================================================== --> + <!-- Avery 5160 family: Mailing Labels, 1'' x 2_5/8'', 30 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 5160" size="US-Letter" description="Mailing Labels"> + <Label id="0" style="rectangle" width="189" height="72" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="10" x0="11.5" y0="36" dx="200" dy="72"/> + </Label> + <Alias name="Avery 15160"/> + <Alias name="Avery 18160"/> + <Alias name="Avery 18660"/> + <Alias name="Avery 25160"/> + <Alias name="Avery 5260"/> + <Alias name="Avery 5510"/> + <Alias name="Avery 5520"/> + <Alias name="Avery 5560"/> + <Alias name="Avery 5810"/> + <Alias name="Avery 5920"/> + <Alias name="Avery 5960"/> + <Alias name="Avery 5970"/> + <Alias name="Avery 5971"/> + <Alias name="Avery 5972"/> + <Alias name="Avery 5979"/> + <Alias name="Avery 5980"/> + <Alias name="Avery 6233"/> + <Alias name="Avery 6245"/> + <Alias name="Avery 6460"/> + <Alias name="Avery 6498"/> + <Alias name="Avery 8160"/> + <Alias name="Avery 8250"/> + <Alias name="Avery 8460"/> + <Alias name="Avery 8560"/> + <Alias name="Avery 8620"/> + <Alias name="Avery 8660"/> + <Alias name="Avery 8810"/> + <Alias name="Avery 8920"/> + <Alias name="Avery 8930"/> + <Alias name="Maco ll5805"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5162 family: Mailing labels, 1_1/3'' x 4'', 14 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 5162" size="US-Letter" description="Mailing labels"> + <Label id="0" style="rectangle" width="288" height="96" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="7" x0="10.5" y0="60" dx="303" dy="96"/> + </Label> + <Alias name="Avery 15162"/> + <Alias name="Avery 18162"/> + <Alias name="Avery 18662"/> + <Alias name="Avery 5262"/> + <Alias name="Avery 5512"/> + <Alias name="Avery 5522"/> + <Alias name="Avery 5922"/> + <Alias name="Avery 5962"/> + <Alias name="Avery 8162"/> + <Alias name="Avery 8252"/> + <Alias name="Avery 8462"/> + <Alias name="Avery 8662"/> + <Alias name="Avery 8922"/> + <Alias name="Avery 8932"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5163 family: Shipping labels, 4'' x 2'', 10 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 5163" size="US-Letter" description="Shipping labels"> + <Label id="0" style="rectangle" width="288" height="144" round="10"> + <Markup type="margin" size="10"/> + <Layout nx="2" ny="5" x0="11.25" y0="36" dx="301.5" dy="144"/> + </Label> + <Alias name="Avery 15163"/> + <Alias name="Avery 18163"/> + <Alias name="Avery 18663"/> + <Alias name="Avery 5263"/> + <Alias name="Avery 5513"/> + <Alias name="Avery 5523"/> + <Alias name="Avery 5795"/> + <Alias name="Avery 5923"/> + <Alias name="Avery 5963"/> + <Alias name="Avery 5978"/> + <Alias name="Avery 8163"/> + <Alias name="Avery 8253"/> + <Alias name="Avery 8463"/> + <Alias name="Avery 8663"/> + <Alias name="Avery 8763"/> + <Alias name="Avery 8923"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5167 family: Address labels, 1_3/4'' x 1/2'', 80 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 5167" size="US-Letter" description="Address labels"> + <Label id="0" style="rectangle" width="126" height="36" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="4" ny="20" x0="20.25" y0="36" dx="148.5" dy="36"/> + </Label> + <Alias name="Avery 15167"/> + <Alias name="Avery 15267"/> + <Alias name="Avery 18167"/> + <Alias name="Avery 18667"/> + <Alias name="Avery 5267"/> + <Alias name="Avery 5667"/> + <Alias name="Avery 5927"/> + <Alias name="Avery 6467"/> + <Alias name="Avery 6504"/> + <Alias name="Avery 8167"/> + <Alias name="Avery 8567"/> + <Alias name="Avery 8667"/> + <Alias name="Avery 8927"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5196 family: Diskette labels, 2_3/4'' x 2_3/4'', 9 per sheet* --> + <!-- =================================================================== --> + <Sheet name="Avery 5196" size="US-Letter" description="Diskette labels"> + <Label id="0" style="rectangle" width="198" height="198" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="3" x0="9" y0="126" dx="198" dy="216"/> + </Label> + <Alias name="Avery 5096"/> + <Alias name="Avery 5896"/> + <Alias name="Avery 8196"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5371 family: Business Cards, 2'' x 3_1/2'', 10 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 5371" size="US-Letter" description="Business Cards"> + <Label id="0" style="rectangle" width="252" height="144" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="54" y0="36" dx="252" dy="144"/> + </Label> + <Alias name="Avery 25371"/> + <Alias name="Avery 26550"/> + <Alias name="Avery 26551"/> + <Alias name="Avery 27871"/> + <Alias name="Avery 27881"/> + <Alias name="Avery 27882"/> + <Alias name="Avery 28371"/> + <Alias name="Avery 28877"/> + <Alias name="Avery 5372"/> + <Alias name="Avery 5376"/> + <Alias name="Avery 5377"/> + <Alias name="Avery 5871"/> + <Alias name="Avery 5876"/> + <Alias name="Avery 5877"/> + <Alias name="Avery 5911"/> + <Alias name="Avery 8271"/> + <Alias name="Avery 8371"/> + <Alias name="Avery 8372"/> + <Alias name="Avery 8374"/> + <Alias name="Avery 8376"/> + <Alias name="Avery 8377"/> + <Alias name="Avery 8471"/> + <Alias name="Avery 8476"/> + <Alias name="Avery 8571"/> + <Alias name="Avery 8871"/> + <Alias name="Avery 8872"/> + <Alias name="Avery 8876"/> + <Alias name="Avery 8877"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 8373 family: Business Cards, 2'' x 3_1/2'', 8 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 8373" size="US-Letter" description="Business Cards"> + <Label id="0" style="rectangle" width="252" height="144" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="4" x0="36" y0="54" dx="288" dy="180"/> + </Label> + <Alias name="Avery 3612"/> + <Alias name="Avery 5881"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5931 family: CD/DVD Labels (face only), 2 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 5931" size="US-Letter" + description="CD/DVD Labels (face only)"> + <Label id="0" style="cd" radius="166.5" hole="58.5"> + <Markup type="margin" size="5"/> + <Layout nx="1" ny="2" x0="139.5" y0="49.5" dx="0" dy="360"/> + </Label> + <Alias name="Avery 5691"/> + <Alias name="Avery 5692"/> + <Alias name="Avery 5694"/> + <Alias name="Avery 8692"/> + <Alias name="Avery 8694"/> + <Alias name="Avery 8695"/> + <Alias name="Avery 8699"/> + <Alias name="Avery 8831"/> + <Alias name="Avery 8832"/> + <Alias name="Avery 8842"/> + <Alias name="Avery 8844"/> + <Alias name="Avery 8846"/> + <Alias name="Avery 8847"/> + <Alias name="Avery 8931"/> + <Alias name="Avery 8941"/> + <Alias name="Avery 8942"/> + <Alias name="Neato USCD2lbl.NTT"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5997face family: VCR Labels, 1_7/8'' x 3_1/16'', 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 5997 - VCR Face" size="US-Letter" + description="VCR Face Labels"> + <Label id="0" style="rectangle" width="220" height="133" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="80" y0="66.5" dx="236" dy="133"/> + </Label> + <Alias name="Avery 5199 - VCR Face"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 5997spine family: VCR Labels, 2/3'' x 5_3/4'',15 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 5997 - VCR Spine" size="US-Letter" + description="VCR Spine Labels"> + <Label id="0" style="rectangle" width="414" height="48" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="1" ny="15" x0="99" y0="36" dx="0" dy="48"/> + </Label> + <Alias name="Avery 5199 - VCR Spine"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 6490 family: Diskette Labels, 2_11/16'' x 2'', 15 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 6490" size="US-Letter" description="Diskette labels"> + <Label id="0" style="rectangle" width="193.5" height="144" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="5" x0="9.215999926" y0="36" dx="200.2679959" dy="144"/> + </Label> + <Alias name="Avery 6501"/> + <Alias name="Avery 6861"/> + <Alias name="Avery 8096"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 8165 family: Full-page label, 8_1/2'' x 11'', 1 per sheet * --> + <!-- =================================================================== --> + <Sheet name="Avery 8165" size="US-Letter" description="Full-page"> + <Label id="0" style="rectangle" width="612" height="792" + round="0"> + <Markup type="margin" size="5"/> + <Layout nx="1" ny="1" x0="0" y0="0" dx="0" dy="0"/> + </Label> + <Alias name="Avery 3114"/> + <Alias name="Avery 3121"/> + <Alias name="Avery 3123"/> + <Alias name="Avery 3131"/> + <Alias name="Avery 3132"/> + <Alias name="Avery 3133"/> + <Alias name="Avery 3141"/> + <Alias name="Avery 3142"/> + <Alias name="Avery 3145"/> + <Alias name="Avery 3245"/> + <Alias name="Avery 3246"/> + <Alias name="Avery 3247"/> + <Alias name="Avery 3255"/> + <Alias name="Avery 3267"/> + <Alias name="Avery 3270"/> + <Alias name="Avery 3271"/> + <Alias name="Avery 3272"/> + <Alias name="Avery 3275"/> + <Alias name="Avery 3276"/> + <Alias name="Avery 3277"/> + <Alias name="Avery 3614"/> + <Alias name="Avery 3625"/> + <Alias name="Avery 3641"/> + <Alias name="Avery 3651"/> + <Alias name="Avery 5165"/> + <Alias name="Avery 5177"/> + <Alias name="Avery 5182"/> + <Alias name="Avery 5265"/> + <Alias name="Avery 5277"/> + <Alias name="Avery 5282"/> + <Alias name="Avery 53205"/> + <Alias name="Avery 53211"/> + <Alias name="Avery 53230"/> + <Alias name="Avery 53240"/> + <Alias name="Avery 5884"/> + <Alias name="Avery 5975"/> + <Alias name="Avery 6465"/> + <Alias name="Avery 6503"/> + <Alias name="Avery 75287"/> + <Alias name="Avery 75299"/> + <Alias name="Avery 8255"/> + <Alias name="Avery 8314"/> + <Alias name="Avery 8324"/> + <Alias name="Avery 8384"/> + <Alias name="Avery 8465"/> + <Alias name="Avery 8665"/> + <Alias name="IP Invent It! #00064-3"/> + <Alias name="Generic US-Letter Full-page"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 3274.1 family: Square stickers, 2_1/2'' x 2_1/2, 9 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 3274.1" size="US-Letter" description="Square Stickers"> + <Label id="0" style="rectangle" width="180" height="180" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="3" x0="22.5" y0="90" dx="193.5" dy="216"/> + </Label> + <Alias name="Avery 3111"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 3274.2 family: Small round stickers, 1_1/2'', 20 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 3274.2" size="US-Letter" description="Small Round Stickers"> + <Label id="0" style="round" radius="54"> + <Markup type="margin" size="5"/> + <Layout nx="4" ny="5" x0="36" y0="54" dx="144" dy="144"/> + </Label> + <Alias name="Avery 3112"/> + <Alias name="Avery 8293"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 3274.3 family: Big round stickers, 2_1/2'', 9 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 3274.3" size="US-Letter" description="Big Round Stickers"> + <Label id="0" style="round" radius="90"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="3" x0="22.5" y0="90" dx="193.5" dy="216"/> + </Label> + </Sheet> + + + + <!-- ******************************************************************** --> + <!-- Avery A4 products (and look-alikes) --> + <!-- ******************************************************************** --> + + <!-- =================================================================== --> + <!-- Avery 7163 family: Mailing labels, 99.1 x 38.1 mm, 14 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 7163" size="A4" description="Mailing labels"> + <Label id="0" style="rectangle" width="280.9" height="108" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="7" x0="9.5" y0="43" dx="292" dy="108"/> + </Label> + <Alias name="Avery L7163"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 8414 family: Business Cards, 50.8 x 87.0 mm, 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Avery 8414" size="A4" description="Business Cards"> + <Label id="0" style="rectangle" width="246.6" height="144" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="42" y0="64" dx="264" dy="144"/> + </Label> + <Alias name="Avery J8414"/> + </Sheet> + + <!-- =================================================================== --> + <!-- Avery 8666 family: Diskette labels (face only), 70 x 52 mm, 10 per --> + <!-- =================================================================== --> + <Sheet name="Avery 8666" size="A4" + description="3.5'' Diskette labels (face only)"> + <Label id="0" style="rectangle" width="198.4" height="147.4" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="66" y0="53" dx="264" dy="147"/> + </Label> + <Alias name="Avery J8666"/> + </Sheet> + + + + <!-- ******************************************************************** --> + <!-- Zweckform A4 products --> + <!-- ******************************************************************** --> + + <!-- =================================================================== --> + <!-- Zweckform 32010: Business Cards, 54.0 x 85.0 mm, 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Zweckform 32010" size="A4" description="Business Cards"> + <Label id="0" style="rectangle" width="240.94" height="153.07" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="40" y0="40" dx="269" dy="153"/> + </Label> + </Sheet> + + <!-- =================================================================== --> + <!-- Zweckform 4761: Lever Arch File Labels, 192 x 61 mm, 4 per sheet --> + <!-- =================================================================== --> + <Sheet name="Zweckform 4761" size="A4" description="Lever Arch File Labels"> + <Label id="0" style="rectangle" width="544.25" height="172.9" round="5"> + <Markup type="margin" size="5"/> + <Layout nx="1" ny="4" x0="25" y0="75" dx="544.25" dy="172.9"/> + </Label> + </Sheet> + + <!-- =================================================================== --> + <!-- Zweckform 3651: Rectangular Labels, 52 x 29.5 mm, 40 per sheet --> + <!-- =================================================================== --> + <Sheet name="Zweckform 3651" size="A4" description="Rectangular Labels"> + <Label id="0" style="rectangle" width="147.4016" height="83.6220" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="4" ny="10" x0="2.834" y0="2.834" dx="147.4016" dy="83.6220"/> + </Label> + </Sheet> + + <!-- =================================================================== --> + <!-- Zweckform 3669: Rectangular Labels, 70 x 50.8mm, 15 per sheet --> + <!-- =================================================================== --> + <Sheet name="Zweckform 3669" size="A4" description="QSL-Karten Etiketten 70mm x 50,8mm"> + <Label id="0" style="rectangle" width="198.425" height="144" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="5" x0="0" y0="61" dx="198.425" dy="144"/> + </Label> + </Sheet> + + + + <!-- ******************************************************************** --> + <!-- Misc. US-Letter products. --> + <!-- ******************************************************************** --> + + <!-- =================================================================== --> + <!-- Southworth BC: Business Cards, 2'' x 3_1/2'', 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Southworth BC" size="US-Letter" description="Business Cards"> + <Label id="0" style="rectangle" width="252" height="144" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="36" y0="36" dx="288" dy="144"/> + </Label> + </Sheet> + + + + <!-- ******************************************************************** --> + <!-- Misc. A4 products. --> + <!-- ******************************************************************** --> + + <!-- =================================================================== --> + <!-- Sigel DP 830/DP 930: Business Cards, 55.0 x 85.0 mm, 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Sigel DP 830/DP 930" size="A4" description="Business Cards"> + <Label id="0" style="rectangle" width="240.9" height="155.9" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="40" y0="31" dx="269" dy="156"/> + </Label> + </Sheet> + + <!-- =================================================================== --> + <!-- Ascom A4/24/MKII: Rectangular Labels, 24 per sheet --> + <!-- =================================================================== --> + <Sheet name="Ascom A4/24/MKII" size="A4" description="Rectangular Labels"> + <Label id="0" style="rectangle" width="181" height="96" round="10"> + <Markup type="margin" size="5"/> + <Layout nx="3" ny="8" x0="19" y0="36" dx="187" dy="96"/> + </Label> + </Sheet> + + <!-- =================================================================== --> + <!-- Agipa 119488: Business Cards, 50 x 90 mm, 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Agipa 119488" size="A4" + description="Agipa 119488: Business Cards"> + <Label id="0" style="rectangle" width="255" height="142" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="43" y0="67" dx="255" dy="142"/> + </Label> + </Sheet> + + <!-- =================================================================== --> + <!-- Ednet BC: Business Cards, 51 x 89 mm, 10 per sheet --> + <!-- =================================================================== --> + <Sheet name="Ednet" size="A4" description="Business Cards"> + <Label id="0" style="rectangle" width="253" height="145" round="0"> + <Markup type="margin" size="5"/> + <Layout nx="2" ny="5" x0="40" y0="59" dx="253" dy="145"/> + </Label> + </Sheet> + +</GLabels-templates> + + + + diff --git a/glabels2/glabels.desktop b/glabels2/glabels.desktop new file mode 100644 index 0000000..0459cb1 --- /dev/null +++ b/glabels2/glabels.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=gLabels +Name[ja]=gLabels +Comment=Create Labels & Business Cards +Comment[ja]=¥é¥Ù¥ë¤È¥Ó¥¸¥Í¥¹¥«¡¼¥É¤ÎºîÀ®¥×¥í¥°¥é¥à +Exec=glabels +Icon=glabels/glabels-icon.png +Terminal=0 +Type=Application diff --git a/glabels2/glabels.spec.in b/glabels2/glabels.spec.in new file mode 100644 index 0000000..9ff8505 --- /dev/null +++ b/glabels2/glabels.spec.in @@ -0,0 +1,57 @@ +%define name @PACKAGE@ +%define ver @VERSION@ +%define RELEASE 1 +%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} +%define prefix /usr +%define sysconfdir /etc + +Summary: glabels is a GNOME program to create labels and business cards +Name: %name +Version: %ver +Release: %rel +Copyright: GPL +Group: Applications/Graphics +Source: glabels-%{ver}.tar.gz +URL: http://snaught.com/glabels/ +BuildRoot: /var/tmp/glabels-%{PACKAGE_VERSION}-root + +Requires: gtk+ >= 1.3 +Requires: gnome-libs >= 1.108 +Requires: gnome-print >= 1.109 +Requires: gdk-pixbuf >= 1.3 + +%description +gLabels is a lightweight program for creating labels and +business cards for the GNOME desktop environment. +It is designed to work with various laser/ink-jet peel-off +label and business card sheets that you'll find at most office +supply stores. + + +%prep +%setup + +%build +CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure --prefix=%{prefix} +make + +%install +rm -rf $RPM_BUILD_ROOT + +make prefix=$RPM_BUILD_ROOT%{prefix} install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) +%doc README COPYING ChangeLog NEWS AUTHORS INSTALL +%{prefix}/bin/glabels +%{prefix}/bin/glabels-batch +%{prefix}/share/* + + +%changelog +* Sat May 19 2001 Jim Evins <evins@snaught.com> +- Created + diff --git a/glabels2/install-sh b/glabels2/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/glabels2/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/glabels2/missing b/glabels2/missing new file mode 100755 index 0000000..7789652 --- /dev/null +++ b/glabels2/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/glabels2/mkinstalldirs b/glabels2/mkinstalldirs new file mode 100755 index 0000000..6b3b5fc --- /dev/null +++ b/glabels2/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/glabels2/pixmaps/glabels-about-logo.png b/glabels2/pixmaps/glabels-about-logo.png Binary files differnew file mode 100644 index 0000000..6f5d852 --- /dev/null +++ b/glabels2/pixmaps/glabels-about-logo.png diff --git a/glabels2/pixmaps/glabels-icon.png b/glabels2/pixmaps/glabels-icon.png Binary files differnew file mode 100644 index 0000000..298ea89 --- /dev/null +++ b/glabels2/pixmaps/glabels-icon.png diff --git a/glabels2/pixmaps/glabels-logo.png b/glabels2/pixmaps/glabels-logo.png Binary files differnew file mode 100644 index 0000000..40189b9 --- /dev/null +++ b/glabels2/pixmaps/glabels-logo.png diff --git a/glabels2/po/ChangeLog b/glabels2/po/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/glabels2/po/ChangeLog diff --git a/glabels2/po/Makefile.in.in b/glabels2/po/Makefile.in.in new file mode 100644 index 0000000..20ccd41 --- /dev/null +++ b/glabels2/po/Makefile.in.in @@ -0,0 +1,243 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. +# +# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE +# instead of PACKAGE and to look for po2tbl in ./ not in intl/ +# +# - Modified by jacob berkman <jacob@ximian.com> to install +# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize + +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(prefix)/share/glib-2.0/gettext/po +subdir = po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ + +CC = @CC@ +GENCAT = @GENCAT@ +GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ +MSGMERGE = PATH=../src:$$PATH msgmerge + +DEFS = @DEFS@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ + +INCLUDES = -I.. -I$(top_srcdir)/intl + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +SOURCES = +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ +$(POFILES) $(GMOFILES) $(SOURCES) + +POTFILES = \ + +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +INSTOBJEXT = @INSTOBJEXT@ + +.SUFFIXES: +.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat + +.c.o: + $(COMPILE) $< + +.po.pox: + $(MAKE) $(GETTEXT_PACKAGE).pot + $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && $(GENCAT) $@ $*.msg + + +all: all-@USE_NLS@ + +all-yes: $(CATALOGS) +all-no: + +$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(GETTEXT_PACKAGE).po \ + || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \ + && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot ) + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ + fi + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + case "$$cat" in \ + *.gmo) destdir=$(gnulocaledir);; \ + *) destdir=$(localedir);; \ + esac; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ + fi; \ + if test -r $$cat; then \ + $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + if test "$(PACKAGE)" = "glib"; then \ + if test -r "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ + fi; \ + $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ + $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + done + rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in + +check: all + +dvi info tags TAGS ID: + +mostlyclean: + rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) +dist distdir: update-po $(DISTFILES) + dists="$(DISTFILES)"; \ + for file in $$dists; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(GETTEXT_PACKAGE).pot + PATH=`pwd`/../src:$$PATH; \ + cd $(srcdir); \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done + +# POTFILES is created from POTFILES.in by stripping comments, empty lines +# and Intltool tags (enclosed in square brackets), and appending a full +# relative path to them +POTFILES: POTFILES.in + ( if test 'x$(srcdir)' != 'x.'; then \ + posrcprefix='$(top_srcdir)/'; \ + else \ + posrcprefix="../"; \ + fi; \ + rm -f $@-t $@ \ + && (sed -e '/^#/d' \ + -e "s/^\[.*\] +//" \ + -e '/^[ ]*$$/d' \ + -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ + | sed -e '$$s/\\$$//') > $@-t \ + && chmod a-w $@-t \ + && mv $@-t $@ ) + +Makefile: Makefile.in.in ../config.status POTFILES + cd .. \ + && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/po/POTFILES.in b/glabels2/po/POTFILES.in new file mode 100644 index 0000000..68b42a5 --- /dev/null +++ b/glabels2/po/POTFILES.in @@ -0,0 +1,135 @@ +# List of source files containing translatable strings. + +src/glabels.c +src/glabels.h +src/glabels-batch.c +src/splash.c +src/splash.h +src/mdi.c +src/mdi.h +src/mdi-child.c +src/mdi-child.h +src/stock.c +src/stock.h +src/menus.h +src/menus.c +src/commands.h +src/commands.c +src/file.h +src/file.c +src/recent.h +src/recent.c +src/tools.h +src/tools.c +src/prefs.c +src/prefs.h +src/prefs-dialog.c +src/prefs-dialog.h +src/view.c +src/view.h +src/view-object.c +src/view-object.h +src/view-box.c +src/view-box.h +src/view-ellipse.c +src/view-ellipse.h +src/view-line.c +src/view-line.h +src/view-image.c +src/view-image.h +src/view-text.c +src/view-text.h +src/view-barcode.c +src/view-barcode.h +src/view-highlight.c +src/view-highlight.h +src/merge-properties.c +src/merge-properties.h +src/print.c +src/print.h +src/print-dialog.c +src/print-dialog.h +src/bc.c +src/bc.h +src/bc-gnubarcode.c +src/bc-gnubarcode.h +src/bc-postnet.c +src/bc-postnet.h +src/label.c +src/label.h +src/label-object.c +src/label-object.h +src/label-text.c +src/label-text.h +src/label-box.c +src/label-box.h +src/label-line.c +src/label-line.h +src/label-ellipse.c +src/label-ellipse.h +src/label-image.c +src/label-image.h +src/label-barcode.c +src/label-barcode.h +src/template.c +src/template.h +src/xml-label.c +src/xml-label.h +src/merge.c +src/merge.h +src/merge-text.c +src/merge-text.h +src/merge-ui.c +src/merge-ui.h +src/merge-ui-text.c +src/merge-ui-text.h +src/text-node.c +src/text-node.h +src/wdgt-text-props.c +src/wdgt-text-props.h +src/wdgt-text-entry.c +src/wdgt-text-entry.h +src/wdgt-position.c +src/wdgt-position.h +src/wdgt-size.c +src/wdgt-size.h +src/wdgt-line.c +src/wdgt-line.h +src/wdgt-fill.c +src/wdgt-fill.h +src/wdgt-vector.c +src/wdgt-vector.h +src/wdgt-bc-props.c +src/wdgt-bc-props.h +src/wdgt-bc-style.c +src/wdgt-bc-style.h +src/wdgt-bc-data.c +src/wdgt-bc-data.h +src/wdgt-print-copies.c +src/wdgt-print-copies.h +src/wdgt-print-merge.c +src/wdgt-print-merge.h +src/wdgt-media-select.c +src/wdgt-media-select.h +src/wdgt-mini-preview.c +src/wdgt-mini-preview.h +src/wdgt-rotate-label.c +src/wdgt-rotate-label.h +src/util.c +src/util.h +src/canvas-hacktext.c +src/canvas-hacktext.h +src/bonobo-mdi-child.c +src/bonobo-mdi-child.h +src/bonobo-mdi.c +src/bonobo-mdi.h +src/gnome-recent-model.c +src/gnome-recent-model.h +src/gnome-recent-util.c +src/gnome-recent-util.h +src/gnome-recent-view.c +src/gnome-recent-view.h +src/gnome-recent-view-bonobo.c +src/gnome-recent-view-bonobo.h +src/debug.c +src/debug.h diff --git a/glabels2/po/de.po b/glabels2/po/de.po new file mode 100644 index 0000000..c1e3142 --- /dev/null +++ b/glabels2/po/de.po @@ -0,0 +1,907 @@ +# French translation of glabels. +# Copyright (C) 2001 Jim Evins <evins@snaught.com> +# Marcus Bauer <m@7n7.de>, 2001. +# +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.2.0\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2001-10-15 15:31+0200\n" +"Last-Translator: Marcus Bauer <m@7n7.de>\n" +"Language-Team: German <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "Seiten:" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "Kopien" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "Begrenzungen drucken (um Druckausrichtung zu testen)" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "Spiegelbildlich drucken" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "Datei kann nicht geöffnet werden" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "Nicht speichern." + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "Nicht speichern." + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels is free software; you can redistribute it and/or modify it under the " +"terms of the GNU General Public License as published by the Free Software " +"Foundation; either version 2 of the License, or (at your option) any later " +"version.\n" +" \n" +"This program is distributed in the hope that it will be useful, but WITHOUT " +"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or " +"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for " +"more details.\n" +msgstr "" +"Ein GNOME-Programm zur Erstellung von Etiketten und Visitenkarten.\n" +" \n" +"Glabels ist freie Software; Sie können sie weiterverteilen und/oder ändern " +"unter den Bedingungen der GNU General Public License, veröffentlicht von der " +"Free Software Foundation, entweder Version 2 der Lizenz oder (optional) " +"jeder späteren Version.\n" +" \n" +"Dieses Programm wird verteilt in der Hoffnung, dass es nützlich ist, aber " +"OHNE JEDE GARANTIE; Weitere Details in der GNU General Public License.\n" + +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "bis:" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "Labels" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "Neues Etikett oder neue Karte" + +#: src/file.c:109 +msgid "Media Type" +msgstr "Medien Typ" + +#: src/file.c:119 +#, fuzzy +msgid "Label orientation" +msgstr "Ausrichtung ändern" + +#: src/file.c:248 +msgid "Open" +msgstr "Öffnen" + +#: src/file.c:250 +msgid "Open label" +msgstr "Öffnen Etikett" + +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "Datei kann nicht geöffnet werden" + +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "Fehler beim Schreiben der Datei" + +#: src/file.c:468 +msgid "Save label as" +msgstr "Datei speichern unter" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "Dateinamen angeben" + +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "Fehler beim Schreiben der Datei" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +#, fuzzy +msgid "points" +msgstr "Punkt" + +#: src/prefs.c:627 +msgid "inches" +msgstr "Inch" + +#: src/prefs.c:629 +msgid "mm" +msgstr "mm" + +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "Skalierung" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels : Einstellungen" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "Anzeige Einheiten" + +#: src/prefs-dialog.c:289 +#, fuzzy +msgid "Points" +msgstr "Punkt" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "Inch" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "Millimeter" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "Standard Papierformat" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "Linie" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "Füllen" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "Löschen" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "Ganz nach vorne" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "Ganz nach hinten" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "Einstellungen ändern..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "Rechteck bearbeiten..." + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "Erscheinungsbild" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "Outline" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "Position/Breite" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "Position" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "Breite" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "Ellipse bearbeiten..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "Linienobjekt bearbeiten..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "Bildeinstellungen bearbeiten..." + +#: src/view-image.c:300 +msgid "Image" +msgstr "Bild" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "Reset Bildgröße" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "Text Objekt bearbeiten" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "Text" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "Barcode bearbeiten..." + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "Wert" + +#: src/view-barcode.c:292 +#, fuzzy +msgid "Barcode data" +msgstr "Barcode Wert" + +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "Text Einstellungen" + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "Stil" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "Ungültiger Barcode-Wert" + +#: src/merge-properties.c:84 +#, fuzzy +msgid "Edit document-merge properties" +msgstr "Dokumenten Mischerei bearbeiten..." + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "Quelle" + +#: src/merge-properties.c:142 +#, fuzzy +msgid "Format:" +msgstr "Font" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "Ort:" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "Felder" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "Drucken" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "Drucken" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "Kopien" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "Kontrolle der Mischung mit Datenquelle (Serienfunktion)" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "Optionen" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "Druckvorschau" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "Keine Dateivorlagen gefunden!" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "Fehler: xmlParseFile error" + +#: src/xml-label.c:174 +msgid "No document root" +msgstr "Kein document root" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "Fehlerhafter Dokument-Typ, glabels Namespace nicht gefunden" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Fehlerhafter root node = \"%s\"" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "fehlerhafter node = \"%s\"" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "Problem beim Speichern der xml-Datei." + +#: src/merge.c:80 +msgid "None" +msgstr "Keine" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "Text mit Tabulatoren als Trennern" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "Text mit Kommata als Separatoren" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "Text mit Doppelpunkten als Separatoren" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "Nicht verfügbar" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "Wählen Sie die einzumischende Datenquelle" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "Spalte" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "Benutzerdefinierter Feldschlüssel" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "Beispiel Daten" + +#. Font label +#: src/wdgt-text-props.c:184 +#, fuzzy +msgid "Font:" +msgstr "Font:" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +#, fuzzy +msgid "Color:" +msgstr "Farbe" + +#. Alignment label +#: src/wdgt-text-props.c:251 +#, fuzzy +msgid "Alignment:" +msgstr "Textanordnung:" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "Key:" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "Datenfeld einfügen" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y:" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +#, fuzzy +msgid "Width:" +msgstr "Länge der Linie" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "Höhe" + +#: src/wdgt-size.c:224 +#, fuzzy +msgid "Maintain current aspect ratio" +msgstr "Seitenverhältnis beibehalten" + +#. Length label +#: src/wdgt-vector.c:186 +#, fuzzy +msgid "Length:" +msgstr "Länge" + +#. Angle label +#: src/wdgt-vector.c:210 +#, fuzzy +msgid "Angle:" +msgstr "Winkel" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "Grad" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +#, fuzzy +msgid "Scale:" +msgstr "Skalierung" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "Zeige Text mit Barcode" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "Literale:" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "Seiten:" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "Labels" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "von:" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "bis:" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "Start bei Etikett" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "auf erster Seite" + +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "Zuordnen" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "Kopien:" + +#: src/wdgt-media-select.c:252 +#, fuzzy +msgid "Description:" +msgstr "Position" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "Seiten Format:" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "Etikett Format:" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "Layout:" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d pro Seite)" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "Rotieren" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "Öffnen" + +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "Gespeicherte Kopie von %s wiederherstellen?" + +#~ msgid "Unknown media type. Using default." +#~ msgstr "Unbekannter Medientyp. Nehme daher Standardeinstellung." + +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "``%s'' wurde geändert \n" +#~ "\n" +#~ "Wollen Sie speichern?" + +#~ msgid "Cannot save file" +#~ msgstr "Kann Datei nicht speichern" + +#~ msgid "Save As" +#~ msgstr "Speichern unter..." + +#~ msgid "Close / Save label as" +#~ msgstr "Schließen / Speichern des Etikett als" + +#~ msgid "Label no longer valid!" +#~ msgstr "Etikett nicht mehr gültig!" + +#~ msgid "Image format not currently supported" +#~ msgstr "Bildformat wird zur Zeit nicht unterstützt" + +#~ msgid "General" +#~ msgstr "Allgemeine Einstellungen" + +#~ msgid "_New" +#~ msgstr "_Neu" + +#~ msgid "Make a new, empty label" +#~ msgstr "Erzeuge neues, leeres Etikett" + +#~ msgid "U_nselect All " +#~ msgstr "A_uswahl aufheben" + +#~ msgid "Remove all selections" +#~ msgstr "Alle Auswahlen aufheben" + +#, fuzzy +#~ msgid "Select" +#~ msgstr "Löschen" + +#~ msgid "Select, move and modify objects" +#~ msgstr "Objekte auswählen, bewegen, ändern" + +#~ msgid "Create text object" +#~ msgstr "Textobjekt erzeugen" + +#~ msgid "Box" +#~ msgstr "Box" + +#~ msgid "Create box/rectangle object" +#~ msgstr "Rechteck-Objekt erzeugen" + +#~ msgid "Create line object" +#~ msgstr "Linienobjekt erzeugen" + +#~ msgid "Ellipse" +#~ msgstr "Ellipse" + +#~ msgid "Create ellipse/circle object" +#~ msgstr "Ellipsenobjekt erzeugen" + +#~ msgid "Create image object" +#~ msgstr "Bildobjekt erzeugen" + +#, fuzzy +#~ msgid "Barcode" +#~ msgstr "Barcode Wert" + +#~ msgid "Create barcode object" +#~ msgstr "Barcodeobjekt erzeugen" + +#~ msgid "Zoom in" +#~ msgstr "vergrößern" + +#~ msgid "Zoom out" +#~ msgstr "verkleinern" + +#~ msgid "Zoom 1:1" +#~ msgstr "Zoom 1:1" + +#~ msgid "Zoom to 1:1" +#~ msgstr "Maßstab auf 1:1 einstellen" + +#, fuzzy +#~ msgid "Merge properties" +#~ msgstr "Einstellungen ändern..." + +#, fuzzy +#~ msgid "Edit merge properties" +#~ msgstr "Bildeinstellungen bearbeiten..." + +#~ msgid "_Tools" +#~ msgstr "_Werkzeuge" + +#~ msgid " New " +#~ msgstr " Neu " + +#~ msgid "New Label/Card" +#~ msgstr "Neues Etikett/Neue Karte" + +#~ msgid " Open " +#~ msgstr " Öffnen " + +#~ msgid "Open a file" +#~ msgstr "Datei öffnen" + +#~ msgid " Save " +#~ msgstr " Speichern " + +#~ msgid "Save current file" +#~ msgstr "Aktuelle Datei speichern" + +#~ msgid " Print " +#~ msgstr " Drucken " + +#~ msgid "Print current file" +#~ msgstr "Aktuelle Datei drucken" + +#~ msgid "Function is not implemented!" +#~ msgstr "Funktion noch nicht implementiert!" + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Funktion noch nicht implementiert!" + +#~ msgid "w" +#~ msgstr "w" + +#~ msgid "h" +#~ msgstr "h" + +#~ msgid "x" +#~ msgstr "x" + +#~ msgid "y" +#~ msgstr "y" + +#~ msgid "Startup" +#~ msgstr "Programmstart" + +#~ msgid "Under construction" +#~ msgstr "Hier wird noch eifrig gebaut..." + +#, fuzzy +#~ msgid "Maintain original aspect ratio" +#~ msgstr "Seitenverhältnis beibehalten" + +#~ msgid "Text color" +#~ msgstr "Textfarbe" + +#~ msgid "Line Color" +#~ msgstr "Linienfarbe" + +#~ msgid "Fill Color" +#~ msgstr "Füllfarbe" diff --git a/glabels2/po/fr.po b/glabels2/po/fr.po new file mode 100644 index 0000000..0427321 --- /dev/null +++ b/glabels2/po/fr.po @@ -0,0 +1,2497 @@ +# French translation of glabels. + + + +# Copyright (C) 2001 Jim Evins <evins@snaught.com> + + + +# Olivier Berger <oberger@gnu.org>, 2001. + + + +# + + + +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.2.0\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2001-10-15 15:31+0200\n" +"Last-Translator: Olivier Berger <oberger@gnu.org>\n" +"Language-Team: French <gnomefr@traduc.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +# src/print_copies.c:193 + + + +# src/print_copies.c:193 + + + +# src/print_copies.c:171 + +# src/print_copies.c:170 +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "Feuilles :" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print.c:146 + +# src/print_dialog.c:104 +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "Copies" + +# src/print.c:180 + + + +# src/print.c:180 + + + +# src/print.c:196 + +# src/print_dialog.c:152 +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "imprimer des bordures (pour tester l'alignement de l'imprimante)" + +# src/print_dialog.c:160 +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "imprimer à l'envers (i.e. une image miroir)" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +# src/file.c:214 + + + +# src/file.c:214 + + + +# src/file.c:249 + +# src/file.c:249 +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "Impossible d'ouvrir le fichier" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +# src/mdi.c:482 + + + +# src/mdi.c:488 + + + +# src/mdi.c:459 + +# src/mdi.c:459 +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "Ne pas sauver" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +# src/mdi.c:482 + + + +# src/mdi.c:488 + + + +# src/mdi.c:459 + +# src/mdi.c:459 +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "Ne pas sauver" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +# src/menu.c:185 + + + +# src/menu.c:185 + + + +# src/menu.c:290 + +# src/menu.c:290 +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels is free software; you can redistribute it and/or modify it under the " +"terms of the GNU General Public License as published by the Free Software " +"Foundation; either version 2 of the License, or (at your option) any later " +"version.\n" +" \n" +"This program is distributed in the hope that it will be useful, but WITHOUT " +"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or " +"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for " +"more details.\n" +msgstr "" +"Un programme de création d'étiquettes et de cartes de visite pour GNOME.\n" +" \n" +"Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le " +"modifier conformément aux dispositions de la Licence Publique Générale GNU, " +"telle que publiée par la Free Software Foundation ; version 2 de la licence, " +"ou encore (à votre choix) toute version ultérieure.\n" +" \n" +"Ce programme est distribué dans l'espoir qu'il sera utile, mais SANS AUCUNE " +"GARANTIE ; sans même la garantie implicite de COMMERCIALISATION ou " +"D'ADAPTATION A UN OBJET PARTICULIER. Pour plus de détail, voir la Licence " +"Publique Générale GNU.\n" + +# src/print_copies.c:221 + + + +# src/print_copies.c:221 + + + +# src/print_copies.c:199 + +# src/print_copies.c:198 +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "à :" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +# src/print_copies.c:210 + + + +# src/print_copies.c:210 + + + +# src/print_copies.c:188 + +# src/print_copies.c:187 +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "Etiquettes" + +# src/file.c:59 + + + +# src/file.c:59 + + + +# src/file.c:72 + +# src/file.c:72 +#: src/file.c:82 +msgid "New Label or Card" +msgstr "Nouvelle étiquette ou carte" + +# src/file.c:87 + + + +# src/file.c:87 + + + +# src/file.c:98 + +# src/file.c:98 +#: src/file.c:109 +msgid "Media Type" +msgstr "Type de média" + +# src/file.c:98 + + + +# src/file.c:98 + + + +# src/file.c:109 + +# src/file.c:109 +#: src/file.c:119 +msgid "Label orientation" +msgstr "Orientation de l'étiquette" + +# src/file.c:178 + + + +# src/file.c:178 + + + +# src/file.c:211 + +# src/file.c:211 +#: src/file.c:248 +msgid "Open" +msgstr "Ouvrir" + +# src/file.c:183 + + + +# src/file.c:183 + + + +# src/file.c:213 + +# src/file.c:213 +#: src/file.c:250 +msgid "Open label" +msgstr "Ouvrir une étiquette" + +# src/file.c:214 + + + +# src/file.c:214 + + + +# src/file.c:249 + +# src/file.c:249 +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "Impossible d'ouvrir le fichier" + +# src/file.c:330 src/mdi.c:740 + + + +# src/file.c:330 src/mdi.c:746 + + + +# src/file.c:374 src/mdi.c:705 + +# src/file.c:374 src/mdi.c:705 +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "Erreur d'écriture du fichier" + +# src/file.c:278 + + + +# src/file.c:278 + + + +# src/file.c:316 + +# src/file.c:316 +#: src/file.c:468 +msgid "Save label as" +msgstr "Enregistrer l'étiquette sous" + +# src/file.c:319 src/mdi.c:729 + + + +# src/file.c:319 src/mdi.c:735 + + + +# src/file.c:362 src/mdi.c:693 + +# src/file.c:362 src/mdi.c:693 +#: src/file.c:550 +msgid "Must supply file name" +msgstr "Vous devez donner un nom de fichier" + +# src/file.c:330 src/mdi.c:740 + + + +# src/file.c:330 src/mdi.c:746 + + + +# src/file.c:374 src/mdi.c:705 + +# src/file.c:374 src/mdi.c:705 +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "Erreur d'écriture du fichier" + +# src/print.c:171 + + + +# src/prefs.c:463 src/prefs.c:470 src/prop_line.c:202 + + + +# src/prefs.c:445 src/prefs.c:452 src/prop_line.c:183 + +# src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "points" + +# src/item_line.c:271 + + + +# src/prefs.c:465 + + + +# src/prefs.c:447 + +# src/prefs.c:450 +#: src/prefs.c:627 +msgid "inches" +msgstr "pouces" + +# src/prefs.c:467 + + + +# src/prefs.c:449 + +# src/prefs.c:452 +#: src/prefs.c:629 +msgid "mm" +msgstr "mm" + +# src/prop_bc.c:189 + + + +# src/prop_bc.c:187 + + + +# src/prop_bc.c:168 + +# src/prop_bc.c:168 +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "Echelle :" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +# src/preferences.c:92 + + + +# src/prefs.c:101 + + + +# src/prefs.c:92 + +# src/prefs.c:86 +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels : Préférences" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +# src/prefs.c:248 + + + +# src/prefs.c:226 + +# src/prefs.c:220 +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "Unités d'affichage" + +# src/print.c:149 + + + +# src/prefs.c:259 + + + +# src/prefs.c:237 + +# src/prefs.c:231 +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "Points" + +# src/prefs.c:265 + + + +# src/prefs.c:243 + +# src/prefs.c:237 +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "Pouces" + +# src/prefs.c:271 + + + +# src/prefs.c:250 + +# src/prefs.c:244 +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "Milimètres" + +# src/item_image.c:341 + + + +# src/prefs.c:278 + + + +# src/prefs.c:255 + +# src/prefs.c:249 +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "Taille de page par défaut" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +# src/item_line.c:271 + + + +# src/item_line.c:271 + + + +# src/item_line.c:256 src/menu.c:106 + +# src/item_line.c:256 src/menu.c:106 +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "Ligne" + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/item_box.c:258 src/item_ellipse.c:260 + +# src/item_box.c:258 src/item_ellipse.c:260 +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "Remplissage" + +# src/display.c:1157 src/display.c:1205 + + + +# src/display.c:1160 src/display.c:1208 + + + +# src/display.c:1171 src/display.c:1219 + +# src/display.c:1186 src/display.c:1234 +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "Supprimer" + +# src/display.c:1167 src/display.c:1215 + + + +# src/display.c:1170 src/display.c:1218 + + + +# src/display.c:1181 src/display.c:1229 + +# src/display.c:1196 src/display.c:1244 +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "Avancer au premier plan" + +# src/display.c:1173 src/display.c:1221 + + + +# src/display.c:1176 src/display.c:1224 + + + +# src/display.c:1187 src/display.c:1235 + +# src/display.c:1202 src/display.c:1250 +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "Reculer à l'arrière-plan" + +# src/display.c:1194 + + + +# src/display.c:1197 + + + +# src/display.c:1208 + +# src/display.c:1223 +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "Editer les propriétés..." + +# src/item_box.c:251 + + + +# src/item_box.c:251 + + + +# src/item_box.c:235 + +# src/item_box.c:235 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "Editer les propriétés de l'objet boîte..." + +# src/item_barcode.c:334 src/item_box.c:261 src/item_ellipse.c:266 + + + +# src/item_line.c:268 src/item_text.c:464 + + + +# src/item_barcode.c:340 src/item_box.c:261 src/item_ellipse.c:266 + + + +# src/item_line.c:268 src/item_text.c:464 + + + +# src/item_barcode.c:317 src/item_box.c:245 src/item_ellipse.c:247 + +# src/item_line.c:253 src/item_text.c:479 + +# src/item_barcode.c:317 src/item_box.c:245 src/item_ellipse.c:247 +# src/item_line.c:253 src/item_text.c:479 +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "Apparence" + +# src/item_box.c:264 src/item_ellipse.c:269 + + + +# src/item_box.c:264 src/item_ellipse.c:269 + + + +# src/item_box.c:248 src/item_ellipse.c:250 + +# src/item_box.c:248 src/item_ellipse.c:250 +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "Bordure" + +# src/item_box.c:288 src/item_ellipse.c:293 src/item_image.c:312 + + + +# src/item_line.c:286 + + + +# src/item_box.c:288 src/item_ellipse.c:293 src/item_image.c:312 + + + +# src/item_line.c:286 + + + +# src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 + +# src/item_line.c:271 + +# src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +# src/item_line.c:271 +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "Position/Taille" + +# src/item_barcode.c:362 src/item_barcode.c:365 src/item_box.c:291 + + + +# src/item_ellipse.c:296 src/item_image.c:315 src/item_line.c:289 + + + +# src/item_text.c:487 src/item_text.c:490 + + + +# src/item_barcode.c:368 src/item_barcode.c:371 src/item_box.c:291 + + + +# src/item_ellipse.c:296 src/item_image.c:315 src/item_line.c:289 + + + +# src/item_text.c:487 src/item_text.c:490 + + + +# src/item_barcode.c:345 src/item_barcode.c:348 src/item_box.c:275 + +# src/item_ellipse.c:277 src/item_image.c:318 src/item_line.c:274 + +# src/item_text.c:500 src/item_text.c:503 + +# src/item_barcode.c:345 src/item_barcode.c:348 src/item_box.c:275 +# src/item_ellipse.c:277 src/item_image.c:318 src/item_line.c:274 +# src/item_text.c:500 src/item_text.c:503 +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "Position" + +# src/item_box.c:302 src/item_ellipse.c:307 src/item_image.c:326 + + + +# src/item_line.c:300 + + + +# src/item_box.c:302 src/item_ellipse.c:307 src/item_image.c:326 + + + +# src/item_line.c:300 + + + +# src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 + +# src/item_line.c:285 + +# src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +# src/item_line.c:285 +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "Taille" + +# src/item_ellipse.c:256 + + + +# src/item_ellipse.c:256 + + + +# src/item_ellipse.c:237 + +# src/item_ellipse.c:237 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "Editer les propriétés de l'objet ellipse..." + +# src/item_line.c:258 + + + +# src/item_line.c:258 + + + +# src/item_line.c:243 + +# src/item_line.c:243 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "Editer les propriétés de l'objet ligne..." + +# src/item_image.c:272 + + + +# src/item_image.c:272 + + + +# src/item_image.c:257 + +# src/item_image.c:257 +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "Editer les propriétés de l'objet image..." + +# src/item_image.c:283 + + + +# src/item_image.c:283 + + + +# src/item_image.c:268 src/menu.c:113 + +# src/item_image.c:268 src/menu.c:113 +#: src/view-image.c:300 +msgid "Image" +msgstr "Image" + +# src/item_image.c:341 + + + +# src/item_image.c:340 + + + +# src/item_image.c:342 + +# src/item_image.c:342 +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "Restaurer la taille d'image" + +# src/item_text.c:432 + + + +# src/item_text.c:432 + + + +# src/item_text.c:450 + +# src/item_text.c:450 +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "Editer les propriétés de l'objet texte..." + +# src/item_text.c:442 src/item_text.c:627 + + + +# src/item_text.c:442 src/item_text.c:627 + + + +# src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 + +# src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "Texte" + +# src/item_barcode.c:299 + + + +# src/item_barcode.c:299 + + + +# src/item_barcode.c:287 + +# src/item_barcode.c:287 +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "Editer les propriétés de l'objet code-barre..." + +# src/item_barcode.c:309 + + + +# src/item_barcode.c:308 + + + +# src/item_barcode.c:297 + +# src/item_barcode.c:297 +#: src/view-barcode.c:287 +msgid "Data" +msgstr "Données" + +# src/item_barcode.c:316 + + + +# src/item_barcode.c:317 + + + +# src/item_barcode.c:299 + +# src/item_barcode.c:299 +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "Données de code-barre" + +# src/item_text.c:467 + + + +# src/item_text.c:467 + + + +# src/item_text.c:482 + +# src/item_text.c:482 +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "Propriétés du texte" + +# src/item_barcode.c:347 + + + +# src/item_barcode.c:353 + + + +# src/item_barcode.c:330 + +# src/item_barcode.c:330 +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "Style" + +# src/item_barcode.c:564 src/item_barcode.c:588 src/print.c:641 + + + +# src/item_barcode.c:570 src/item_barcode.c:594 src/print.c:641 + + + +# src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:799 + +# src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:600 +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "Code-barre invalide" + +# src/item_box.c:251 + + + +# src/item_box.c:251 + + + +# src/merge_properties.c:82 + +# src/merge_properties.c:82 +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "Editer les propriétés de fusion de document" + +# src/merge_properties.c:131 + +# src/merge_properties.c:131 +#: src/merge-properties.c:130 +msgid "Source" +msgstr "Source" + +# src/prop_text.c:214 + + + +# src/prop_text.c:199 + + + +# src/merge_properties.c:143 + +# src/merge_properties.c:143 +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "Format :" + +# src/merge_properties.c:158 + +# src/merge_properties.c:158 +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "Emplacement :" + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/item_box.c:274 src/item_ellipse.c:279 + + + +# src/merge_properties.c:168 + +# src/merge_properties.c:168 +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "Champs" + +# src/print.c:149 + + + +# src/print.c:149 + + + +# src/print.c:141 + +# src/print_dialog.c:99 +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "Imprimer" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +# src/print.c:149 + + + +# src/print.c:149 + + + +# src/print.c:141 + +# src/print_dialog.c:99 +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "Imprimer" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print.c:146 + +# src/print_dialog.c:104 +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "Copies" + +# src/print.c:164 + +# src/print_dialog.c:121 +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "Contrôle de la fusion de document" + +# src/print.c:171 + + + +# src/print.c:171 + + + +# src/print.c:186 + +# src/print_dialog.c:141 +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "Options" + +# src/print.c:235 + + + +# src/print.c:235 + + + +# src/print.c:283 src/print.c:348 + +# src/print_dialog.c:241 src/print_dialog.c:280 +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "Aperçu avant impression" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +# src/template.c:179 + + + +# src/template.c:178 + +# src/template.c:223 +#: src/template.c:346 +msgid "No template files found!" +msgstr "Aucun fichier de patron trouvé !" + +# src/label.c:186 src/label.c:211 + + + +# src/label.c:186 src/label.c:211 + + + +# src/label.c:170 src/label.c:194 + +# src/label.c:168 src/label.c:192 +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "erreur xmlParseFile" + +# src/label.c:243 + + + +# src/label.c:244 + + + +# src/label.c:225 + +# src/label.c:223 +#: src/xml-label.c:174 +msgid "No document root" +msgstr "Pas de racine de document" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +# src/label.c:248 + + + +# src/label.c:249 + + + +# src/label.c:236 + +# src/label.c:234 +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "document de type erroné, aucun espace de noms glabels trouvé" + +# src/label.c:253 + + + +# src/label.c:254 + + + +# src/label.c:241 + +# src/label.c:239 +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Mauvais noeud racine = \"%s\"" + +# src/label.c:298 + + + +# src/label.c:301 + + + +# src/label.c:294 + +# src/label.c:290 +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "mauvais noeud = \"%s\"" + +# src/label.c:487 + + + +# src/label.c:493 + + + +# src/label.c:589 + +# src/label.c:587 +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "Problème de sauvegarde du fichier xml." + +# src/merge.c:80 + +# src/merge.c:78 +#: src/merge.c:80 +msgid "None" +msgstr "Aucun" + +# src/merge.c:89 + +# src/merge.c:86 +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "Texte avec séparateurs de tabulation" + +# src/merge.c:98 + +# src/merge.c:94 +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "Texte séparé par des virgules" + +# src/merge.c:107 + +# src/merge.c:102 +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "Texte séparé par des deux-points" + +# src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 + +# src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "Non défini" + +# src/merge_ui_text.c:170 + +# src/merge_ui_text.c:170 +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "Sélection de la base de données source de la fusion" + +# src/merge_ui_text.c:330 + +# src/merge_ui_text.c:330 +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "Colonne" + +# src/merge_ui_text.c:334 + +# src/merge_ui_text.c:334 +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "Clé de champ spécifique" + +# src/merge_ui_text.c:338 + +# src/merge_ui_text.c:338 +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "Exemple de données" + +# src/prop_text.c:214 + + + +# src/prop_text.c:199 + + + +# src/prop_text.c:181 + +# src/prop_text.c:181 +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "Police :" + +# src/prop_bc.c:204 src/prop_fill.c:186 src/prop_line.c:203 + + + +# src/prop_text.c:263 + + + +# src/prop_bc.c:210 src/prop_fill.c:184 src/prop_line.c:209 + + + +# src/prop_text.c:247 + + + +# src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 + +# src/prop_text.c:234 + +# src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +# src/prop_text.c:234 +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "Couleur :" + +# src/prop_text.c:277 + + + +# src/prop_text.c:264 + + + +# src/prop_text.c:248 + +# src/prop_text.c:248 +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "Alignement :" + +# src/prop_bc_data.c:196 src/prop_text_entry.c:180 + +# src/prop_bc_data.c:196 src/prop_text_entry.c:180 +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "Clé :" + +# src/prop_text_entry.c:196 + +# src/prop_text_entry.c:196 +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "Insérer champ de fusion" + +# src/prop_position.c:192 + + + +# src/prop_position.c:173 + +# src/prop_position.c:173 +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X :" + +# src/prop_position.c:212 + + + +# src/prop_position.c:191 + +# src/prop_position.c:191 +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y :" + +# src/prop_line.c:188 + + + +# src/prop_line.c:187 src/prop_size.c:202 + + + +# src/prop_line.c:169 src/prop_size.c:182 + +# src/prop_line.c:169 src/prop_size.c:182 +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "Largeur :" + +# src/prop_size.c:220 + + + +# src/prop_size.c:198 + +# src/prop_size.c:198 +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "Hauteur :" + +# src/prop_size.c:215 + + + +# src/prop_size.c:247 + + + +# src/prop_size.c:222 + +# src/prop_size.c:222 +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "Conserver le rapport d'échelle actuel" + +# src/prop_vector.c:196 + + + +# src/prop_vector.c:202 + + + +# src/prop_vector.c:183 + +# src/prop_vector.c:183 +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "Longueur :" + +# src/prop_vector.c:207 + + + +# src/prop_vector.c:228 + + + +# src/prop_vector.c:207 + +# src/prop_vector.c:207 +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "Angle :" + +# src/prop_vector.c:245 + + + +# src/prop_vector.c:224 + +# src/prop_vector.c:224 +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "degrés" + +# src/prop_bc.c:189 + + + +# src/prop_bc.c:187 + + + +# src/prop_bc.c:168 + +# src/prop_bc.c:168 +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "Echelle :" + +# src/prop_bc.c:202 + + + +# src/prop_bc.c:182 + +# src/prop_bc.c:182 +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +# src/prop_bc_style.c:328 + + + +# src/prop_bc_style.c:328 + + + +# src/prop_bc_style.c:313 + +# src/prop_bc_style.c:313 +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "Afficher du texte avec le code-barre" + +# src/prop_bc_data.c:176 + +# src/prop_bc_data.c:176 +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "Littéral :" + +# src/print_copies.c:193 + + + +# src/print_copies.c:193 + + + +# src/print_copies.c:171 + +# src/print_copies.c:170 +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "Feuilles :" + +# src/print_copies.c:210 + + + +# src/print_copies.c:210 + + + +# src/print_copies.c:188 + +# src/print_copies.c:187 +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "Etiquettes" + +# src/print_copies.c:213 + + + +# src/print_copies.c:213 + + + +# src/print_copies.c:191 + +# src/print_copies.c:190 +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "de :" + +# src/print_copies.c:221 + + + +# src/print_copies.c:221 + + + +# src/print_copies.c:199 + +# src/print_copies.c:198 +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "à :" + +# src/print_copies_merge.c:197 + +# src/print_merge.c:170 +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "Commencer par l'étiquette" + +# src/print_copies_merge.c:206 + +# src/print_merge.c:179 +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "en 1ère page" + +# src/rotate_select.c:187 + + + +# src/rotate_select.c:187 + + + +# src/print_copies_merge.c:186 + +# src/print_merge.c:188 +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "Assembler" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print_copies_merge.c:173 + +# src/print_merge.c:195 +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "Copies :" + +# src/media_select.c:216 + + + +# src/media_select.c:242 + + + +# src/media_select.c:222 + +# src/media_select.c:222 +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "Description :" + +# src/media_select.c:221 + + + +# src/media_select.c:247 + + + +# src/media_select.c:227 + +# src/media_select.c:227 +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "Taille de page :" + +# src/media_select.c:226 + + + +# src/media_select.c:252 + + + +# src/media_select.c:232 + +# src/media_select.c:232 +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "Taille d'étiquette :" + +# src/media_select.c:231 + + + +# src/media_select.c:257 + + + +# src/media_select.c:237 + +# src/media_select.c:237 +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "Disposition :" + +# src/media_select.c:515 + + + +# src/media_select.c:481 + +# src/media_select.c:353 +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d par feuille)" + +# src/media_select.c:522 + + + +# src/media_select.c:488 + +# src/media_select.c:367 +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +# src/media_select.c:522 + + + +# src/media_select.c:488 + +# src/media_select.c:372 +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +# src/rotate_select.c:187 + + + +# src/rotate_select.c:187 + + + +# src/rotate_select.c:167 + +# src/rotate_select.c:169 +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "Rotation" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +# src/file.c:178 + + + +# src/file.c:178 + + + +# src/file.c:211 + +# src/file.c:211 +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "Ouvrir" + +# src/mdi.c:190 + + + +# src/mdi.c:189 + + + +# src/mdi.c:169 + +# src/mdi.c:169 +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "Rétablir la version sauvegardée de %s ?" + +# src/mdi.c:219 + + + +# src/mdi.c:207 + +# src/mdi.c:207 +#~ msgid "Unknown media type. Using default." +#~ msgstr "Type de media inconnu. Utilisation de celui par défaut." + +# src/mdi.c:477 + + + +# src/mdi.c:483 + + + +# src/mdi.c:455 + +# src/mdi.c:455 +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "``%s'' a été modifié \n" +#~ "\n" +#~ "Voulez-vous l'enregistrer ?" + +# src/file.c:248 src/mdi.c:635 + + + +# src/file.c:248 src/mdi.c:641 + + + +# src/file.c:288 src/mdi.c:601 + +# src/file.c:288 src/mdi.c:601 +#~ msgid "Cannot save file" +#~ msgstr "Impossible d'enregistrer le fichier" + +# src/file.c:271 src/mdi.c:660 + + + +# src/file.c:271 src/mdi.c:666 + + + +# src/file.c:311 src/mdi.c:623 + +# src/file.c:311 src/mdi.c:623 +#~ msgid "Save As" +#~ msgstr "Enregistrer sous" + +# src/mdi.c:663 + + + +# src/mdi.c:669 + + + +# src/mdi.c:626 + +# src/mdi.c:626 +#~ msgid "Close / Save label as" +#~ msgstr "Fermer / Enregistrer l'étiquette sous" + +# src/file.c:309 src/mdi.c:716 + + + +# src/file.c:309 src/mdi.c:722 + + + +# src/file.c:352 src/mdi.c:680 + +# src/file.c:352 src/mdi.c:680 +#~ msgid "Label no longer valid!" +#~ msgstr "Etiquette plus valide !" + +# src/item_image.c:389 src/item_image.c:444 + + + +# src/item_image.c:388 src/item_image.c:442 + + + +# src/item_image.c:389 src/item_image.c:454 + +# src/item_image.c:389 src/item_image.c:454 +#~ msgid "Image format not currently supported" +#~ msgstr "Format d'image non supporté actuellement" + +# src/item_barcode.c:337 + + + +# src/item_barcode.c:343 src/prefs.c:243 + + + +# src/item_barcode.c:320 src/prefs.c:221 + +# src/item_barcode.c:320 src/prefs.c:215 +#~ msgid "General" +#~ msgstr "Général" + +# src/menu.c:50 + + + +# src/menu.c:50 + + + +# src/menu.c:50 + +# src/menu.c:50 +#~ msgid "_New" +#~ msgstr "_Nouveau" + +# src/menu.c:51 + + + +# src/menu.c:51 + + + +# src/menu.c:51 + +# src/menu.c:51 +#~ msgid "Make a new, empty label" +#~ msgstr "Créer une nouvelle étiquette vide" + +# src/menu.c:86 + + + +# src/menu.c:86 + + + +# src/menu.c:85 + +# src/menu.c:85 +#~ msgid "U_nselect All " +#~ msgstr "_Désélectionne tout" + +# src/menu.c:86 + + + +# src/menu.c:86 + + + +# src/menu.c:86 + +# src/menu.c:86 +#~ msgid "Remove all selections" +#~ msgstr "Supprime toutes les sélections" + +# src/display.c:1157 src/display.c:1205 + + + +# src/display.c:1160 src/display.c:1208 + + + +# src/menu.c:94 + +# src/menu.c:94 +#~ msgid "Select" +#~ msgstr "Sélectionner" + +# src/tools.c:59 + + + +# src/tools.c:59 + + + +# src/menu.c:95 src/menu.c:186 + +# src/menu.c:95 src/menu.c:186 +#~ msgid "Select, move and modify objects" +#~ msgstr "Sélectionner, déplacer et modifier les objets" + +# src/tools.c:64 + + + +# src/tools.c:64 + + + +# src/menu.c:100 src/menu.c:191 + +# src/menu.c:100 src/menu.c:191 +#~ msgid "Create text object" +#~ msgstr "Créer un objet texte" + +# src/menu.c:103 + +# src/menu.c:103 +#~ msgid "Box" +#~ msgstr "Boîte" + +# src/tools.c:67 + + + +# src/tools.c:67 + + + +# src/menu.c:103 src/menu.c:194 + +# src/menu.c:103 src/menu.c:194 +#~ msgid "Create box/rectangle object" +#~ msgstr "Créer un objet boîte/rectangle" + +# src/tools.c:70 + + + +# src/tools.c:70 + + + +# src/menu.c:106 src/menu.c:197 + +# src/menu.c:106 src/menu.c:197 +#~ msgid "Create line object" +#~ msgstr "Créer un objet ligne" + +# src/menu.c:109 + +# src/menu.c:109 +#~ msgid "Ellipse" +#~ msgstr "Ellipse" + +# src/tools.c:73 + + + +# src/tools.c:73 + + + +# src/menu.c:110 src/menu.c:200 + +# src/menu.c:110 src/menu.c:200 +#~ msgid "Create ellipse/circle object" +#~ msgstr "Créer un objet ellipse/cercle" + +# src/tools.c:76 + + + +# src/tools.c:76 + + + +# src/menu.c:113 src/menu.c:203 + +# src/menu.c:113 src/menu.c:203 +#~ msgid "Create image object" +#~ msgstr "Créer un objet image" + +# src/item_barcode.c:316 + + + +# src/item_barcode.c:317 + + + +# src/menu.c:116 + +# src/menu.c:116 +#~ msgid "Barcode" +#~ msgstr "Code-barre" + +# src/tools.c:79 + + + +# src/tools.c:79 + + + +# src/menu.c:116 src/menu.c:206 + +# src/menu.c:116 src/menu.c:206 +#~ msgid "Create barcode object" +#~ msgstr "Créer un objet code-barre" + +# src/tools.c:84 + + + +# src/tools.c:84 + + + +# src/menu.c:121 src/menu.c:211 + +# src/menu.c:121 src/menu.c:211 +#~ msgid "Zoom in" +#~ msgstr "Zoom supérieur" + +# src/tools.c:87 + + + +# src/tools.c:87 + + + +# src/menu.c:124 src/menu.c:214 + +# src/menu.c:124 src/menu.c:214 +#~ msgid "Zoom out" +#~ msgstr "Zoom inférieur" + +# src/tools.c:90 + + + +# src/tools.c:90 + + + +# src/menu.c:127 + +# src/menu.c:127 +#~ msgid "Zoom 1:1" +#~ msgstr "Zoom 1:1" + +# src/tools.c:90 + + + +# src/tools.c:90 + + + +# src/menu.c:127 src/menu.c:217 + +# src/menu.c:127 src/menu.c:217 +#~ msgid "Zoom to 1:1" +#~ msgstr "Zoomer à 1:1" + +# src/item_text.c:467 + + + +# src/item_text.c:467 + + + +# src/menu.c:132 src/menu.c:223 + +# src/menu.c:132 src/menu.c:223 +#~ msgid "Merge properties" +#~ msgstr "Propriétés de fusion" + +# src/item_image.c:272 + + + +# src/item_image.c:272 + + + +# src/menu.c:133 + +# src/menu.c:133 +#~ msgid "Edit merge properties" +#~ msgstr "Editer les propriétés de fusion" + +# src/menu.c:157 + +# src/menu.c:157 +#~ msgid "_Tools" +#~ msgstr "_Outils" + +# src/menu.c:138 + + + +# src/menu.c:138 + + + +# src/menu.c:168 + +# src/menu.c:168 +#~ msgid " New " +#~ msgstr " Nouveau " + +# src/menu.c:138 + + + +# src/menu.c:138 + + + +# src/menu.c:168 + +# src/menu.c:168 +#~ msgid "New Label/Card" +#~ msgstr "Nouvelle étiquette/carte" + +# src/menu.c:140 + + + +# src/menu.c:140 + + + +# src/menu.c:170 + +# src/menu.c:170 +#~ msgid " Open " +#~ msgstr " Ouvrir " + +# src/menu.c:140 + + + +# src/menu.c:140 + + + +# src/menu.c:170 + +# src/menu.c:170 +#~ msgid "Open a file" +#~ msgstr "Ouvrir un fichier" + +# src/menu.c:142 + + + +# src/menu.c:142 + + + +# src/menu.c:172 + +# src/menu.c:172 +#~ msgid " Save " +#~ msgstr " Enregistrer " + +# src/menu.c:142 + + + +# src/menu.c:142 + + + +# src/menu.c:172 + +# src/menu.c:172 +#~ msgid "Save current file" +#~ msgstr "Sauvegarder le fichier en cours" + +# src/menu.c:145 + + + +# src/menu.c:145 + + + +# src/menu.c:175 + +# src/menu.c:175 +#~ msgid " Print " +#~ msgstr " Imprimer " + +# src/menu.c:145 + + + +# src/menu.c:145 + + + +# src/menu.c:175 + +# src/menu.c:175 +#~ msgid "Print current file" +#~ msgstr "Imprimer le fichier en cours" + +# src/menu.c:221 + + + +# src/menu.c:221 + + + +# src/menu.c:326 + +# src/menu.c:326 +#~ msgid "Function is not implemented!" +#~ msgstr "Cette fonction n'est pas implémentée !" + +# src/tools.c:297 + + + +# src/tools.c:297 + + + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Cette fonction n'est pas encore implémentée !" + +# src/prop_size.c:194 + + + +#~ msgid "w" +#~ msgstr "l" + +# src/prop_size.c:203 + + + +#~ msgid "h" +#~ msgstr "h" + +# src/prop_position.c:183 + + + +#~ msgid "x" +#~ msgstr "x" + +# src/prop_position.c:195 + + + +#~ msgid "y" +#~ msgstr "y" + +# src/media_select.c:462 + + + +#~ msgid "%.1f x %.1f" +#~ msgstr "%.1f x %.1f" + +# src/preferences.c:213 + + + +#~ msgid "Startup" +#~ msgstr "Démarrage" + +# src/preferences.c:215 + + + +#~ msgid "Under construction" +#~ msgstr "En construction" + +#, fuzzy +#~ msgid "Maintain original aspect ratio" +#~ msgstr "Conserver le rapport d'échelle d'origine" + +#~ msgid "Text color" +#~ msgstr "Couleur du texte" + +#~ msgid "Line Color" +#~ msgstr "Couleur de ligne" + +#~ msgid "Fill Color" +#~ msgstr "Couleur de remplissage" diff --git a/glabels2/po/glabels.pot b/glabels2/po/glabels.pot new file mode 100644 index 0000000..3cfbe2e --- /dev/null +++ b/glabels2/po/glabels.pot @@ -0,0 +1,709 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#: src/commands.c:384 +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "sheets" +msgstr "" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +msgid "copies" +msgstr "" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, c-format +msgid "cannot open glabels file %s\n" +msgstr "" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +msgid "Do_n't save" +msgstr "" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +msgid "_Don't close" +msgstr "" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels is free software; you can redistribute it and/or modify it under the " +"terms of the GNU General Public License as published by the Free Software " +"Foundation; either version 2 of the License, or (at your option) any later " +"version.\n" +" \n" +"This program is distributed in the hope that it will be useful, but WITHOUT " +"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or " +"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for " +"more details.\n" +msgstr "" + +#: src/commands.c:371 +msgid "Author:" +msgstr "" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +msgid "glabels" +msgstr "" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "" + +#: src/file.c:109 +msgid "Media Type" +msgstr "" + +#: src/file.c:119 +msgid "Label orientation" +msgstr "" + +#: src/file.c:248 +msgid "Open" +msgstr "" + +#: src/file.c:250 +msgid "Open label" +msgstr "" + +#: src/file.c:338 +#, c-format +msgid "Cannot open file '%s'" +msgstr "" + +#: src/file.c:429 +#, c-format +msgid "Error saving file '%s'" +msgstr "" + +#: src/file.c:468 +msgid "Save label as" +msgstr "" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "" + +#: src/file.c:569 +#, c-format +msgid "Error writing file '%s'" +msgstr "" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "" + +#: src/prefs.c:627 +msgid "inches" +msgstr "" + +#: src/prefs.c:629 +msgid "mm" +msgstr "" + +#: src/prefs-dialog.c:220 +msgid "Locale" +msgstr "" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +msgid "Preferences" +msgstr "" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "" + +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "" + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "" + +#: src/view-image.c:300 +msgid "Image" +msgstr "" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "" + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "" + +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "" + +#: src/view-barcode.c:318 +msgid "Barcode Properties" +msgstr "" + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "" + +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "" + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "" + +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +msgid "P_rinter" +msgstr "" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "" + +#: src/xml-label.c:174 +msgid "No document root" +msgstr "" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +msgid "bad document, unknown glabels Namespace" +msgstr "" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "" + +#: src/merge.c:80 +msgid "None" +msgstr "" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "" + +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "" + +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "" + +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "" + +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "" + +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "" + +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "" + +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, c-format +msgid "Open %s" +msgstr "" diff --git a/glabels2/po/ja.po b/glabels2/po/ja.po new file mode 100644 index 0000000..836c63d --- /dev/null +++ b/glabels2/po/ja.po @@ -0,0 +1,854 @@ +# glabels ja.po +# Copyright (C) 2001 Free Software Foundation, Inc. +# Takeshi Aihana <aihana@gnome.gr.jp>, 2001, 2002. +# +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.4.1\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2002-01-15 22:34+0900\n" +"Last-Translator: Takeshi Aihana <aihana@gnome.gr.jp>\n" +"Language-Team: Japanese <gnome-translation@gnome.gr.jp>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "用紙:" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "コピー" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "アウトラインをå°åˆ·ã™ã‚‹ (å°åˆ·æ™‚ã®é…置を確èªã™ã‚‹ãŸã‚)" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "å転ã—ã¦å°åˆ· (i.e. ç”»åƒã‚’ミラーã—ãŸã‚‚ã®)" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "ファイルãŒé–‹ã‘ã¾ã›ã‚“" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "ä¿å˜ã—ãªã„" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "ä¿å˜ã—ãªã„" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels is free software; you can redistribute it and/or modify it under the " +"terms of the GNU General Public License as published by the Free Software " +"Foundation; either version 2 of the License, or (at your option) any later " +"version.\n" +" \n" +"This program is distributed in the hope that it will be useful, but WITHOUT " +"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or " +"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for " +"more details.\n" +msgstr "" +"GNOME å‘ã‘ã®ãƒ©ãƒ™ãƒ«/ビジãƒã‚¹ã‚«ãƒ¼ãƒ‰ã®ä½œæˆãƒ—ãƒã‚°ãƒ©ãƒ ã§ã™ã€‚\n" +"\n" +"Glabels ã¯ãƒ•ãƒªãƒ¼ã‚½ãƒ•ãƒˆã§ã™ã€‚フリーソフトウェア財団ãŒå®šã‚ã‚‹ GNU 一般公有使用許" +"諾契約書ã®ç¬¬2版もã—ãã¯ãれ以é™ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ä¸‹ã§è¤‡è£½ã€æ”¹ç·¨ã€å†é…布ãŒèªã‚られ" +"ã¦ã„ã¾ã™ã€‚\n" +"\n" +"ã“ã®ãƒ—ãƒã‚°ãƒ©ãƒ ãŒå½¹ã«ç«‹ã¤ã“ã¨ã‚’望むä¸ã§é…布ã•ã‚Œã¦ã„ã¾ã™ãŒã€å®Œå…¨ç„¡ä¿è¨¼ã§ã™ã€‚販" +"売目的ã¾ãŸã¯å•†ç”¨ç›®çš„ã®ä¿è¨¼ã¯ã‚ã‚Šã¾ã›ã‚“。詳細ã«ã¤ã„ã¦ã¯ GNU 一般公有使用許諾契" +"約書をå‚ç…§ã—ã¦ä¸‹ã•ã„。\n" + +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "終了:" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "ラベル" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "æ–°è¦ãƒ©ãƒ™ãƒ«ã¾ãŸã¯ã‚«ãƒ¼ãƒ‰" + +#: src/file.c:109 +msgid "Media Type" +msgstr "メディアã®ç¨®é¡ž" + +#: src/file.c:119 +msgid "Label orientation" +msgstr "ラベルã®å‘ã" + +#: src/file.c:248 +msgid "Open" +msgstr "é–‹ã" + +#: src/file.c:250 +msgid "Open label" +msgstr "ラベルを開ãã¾ã™" + +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "ファイルãŒé–‹ã‘ã¾ã›ã‚“" + +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "ファイルã®æ›¸ãè¾¼ã¿ã§ã‚¨ãƒ©ãƒ¼" + +#: src/file.c:468 +msgid "Save label as" +msgstr "ラベルã«åå‰ã‚’付ã‘ã¦ä¿å˜ã—ã¾ã™" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "ファイルåを指定ã—ã¦ä¸‹ã•ã„" + +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "ファイルã®æ›¸ãè¾¼ã¿ã§ã‚¨ãƒ©ãƒ¼" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "ãƒã‚¤ãƒ³ãƒˆ" + +#: src/prefs.c:627 +msgid "inches" +msgstr "[インãƒ]" + +#: src/prefs.c:629 +msgid "mm" +msgstr "[ミリ]" + +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "寸法:" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels: è¨å®š" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "表示ã™ã‚‹å˜ä½" + +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "ãƒã‚¤ãƒ³ãƒˆ" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "インãƒ" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "ミリ" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "デフォルトã®ç”¨ç´™ã‚µã‚¤ã‚º" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "ç›´ç·š" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "å¡—ã‚Šã¤ã¶ã—" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "削除" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "å‰ã«æŒã£ã¦æ¥ã‚‹" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "後ã‚ã«ã¾ã‚ã™" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "プãƒãƒ‘ティã®ç·¨é›†..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "四角ã®ç·¨é›†" + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "外観" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "矩形" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "ä½ç½®ã¨ã‚µã‚¤ã‚º" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "ä½ç½®" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "サイズ" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "楕円ã®ç·¨é›†" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "ç›´ç·šã®ç·¨é›†" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "ç”»åƒã®ç·¨é›†" + +#: src/view-image.c:300 +msgid "Image" +msgstr "ç”»åƒ" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "ç”»åƒã‚µã‚¤ã‚ºã®ãƒªã‚»ãƒƒãƒˆ" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "テã‚ストã®ç·¨é›†" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "テã‚スト" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã®ç·¨é›†" + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "データ" + +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ãƒ»ãƒ‡ãƒ¼ã‚¿" + +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "æ–‡å—プãƒãƒ‘ティ..." + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "スタイル" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "ãŠã‹ã—ãªãƒãƒ¼ã‚³ãƒ¼ãƒ‰" + +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "çµåˆãƒ‰ã‚ュメント・プãƒãƒ‘ティã®ç·¨é›†" + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "ソース" + +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "書å¼:" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "å ´æ‰€:" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "フィールド" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "å°åˆ·" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "å°åˆ·" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "コピー" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "ドã‚ュメントをコントãƒãƒ¼ãƒ«ã«ãƒžãƒ¼ã‚¸ã™ã‚‹" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "オプション" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "å°åˆ·ãƒ—レビュー" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "テンプレート・ファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ï¼" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "xmlParseFile エラー" + +#: src/xml-label.c:174 +msgid "No document root" +msgstr "root ドã‚ュメントã§ã¯ã‚ã‚Šã¾ã›ã‚“" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "ドã‚ュメントã®ç¨®é¡žãŒé–“é•ã£ã¦ã„ã¾ã™ã€‚Glabels åå‰ç©ºé–“ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "ãŠã‹ã—㪠root ã®ãƒŽãƒ¼ãƒ‰ = \"%s\"" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "ãŠã‹ã—ãªãƒŽãƒ¼ãƒ‰ = \"%s\"" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "XML ファイルã®ä¿å˜ã§å•é¡ŒãŒã‚ã‚Šã¾ã™" + +#: src/merge.c:80 +msgid "None" +msgstr "ãªã—" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "タブã§åŒºåˆ‡ã£ãŸãƒ†ã‚スト" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "コンマã§åŒºåˆ‡ã£ãŸãƒ†ã‚スト" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "コãƒãƒ³ã§åŒºåˆ‡ã£ãŸãƒ†ã‚スト" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "N/A" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "çµåˆãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒ»ã‚½ãƒ¼ã‚¹ã®é¸æŠž" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "列" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "カスタム・フィールド・ã‚ー" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "サンプルデータ" + +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "フォント:" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "色:" + +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "ä½ç½®:" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "ã‚ー:" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "çµåˆãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã®æŒ¿å…¥" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y:" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "å¹…:" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "高ã•:" + +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "ç¾åœ¨ã®ã‚¢ã‚¹ãƒšã‚¯ãƒˆæ¯”率をç¶æŒã™ã‚‹" + +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "é•·ã•:" + +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "角度:" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "度" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "寸法:" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’付ã‘ã¦ãƒ†ã‚ストを表示ã™ã‚‹" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "リテラル:" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "用紙:" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "ラベル" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "開始:" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "終了:" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "ラベルã®é–‹å§‹" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "(最åˆã®ã‚·ãƒ¼ãƒˆ)" + +#: src/wdgt-print-merge.c:197 +msgid "Collate" +msgstr "製本" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "コピー:" + +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "説明:" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "用紙ã®ã‚µã‚¤ã‚º:" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "ラベルã®å¤§ãã•:" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "レイアウト:" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d 個/シート)" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "回転ã•ã›ã‚‹" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "é–‹ã" + +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "%s ã®ã‚³ãƒ”ーをå転ã—ã¾ã™ã‹ï¼Ÿ" + +#~ msgid "Unknown media type. Using default." +#~ msgstr "メディアã®ç¨®é¡žãŒç‰¹å®šã§ãã¾ã›ã‚“。デフォルトを使用ã—ã¾ã™ã€‚" + +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "%s ã¯ç·¨é›†ã•ã‚Œã¦ã„ã¾ã™ã€‚\n" +#~ "\n" +#~ "ä¿å˜ã—ã¾ã™ã‹ï¼Ÿ" + +#~ msgid "Cannot save file" +#~ msgstr "ファイルをä¿å˜ã™ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã›ã‚“" + +#~ msgid "Save As" +#~ msgstr "åå‰ã‚’付ã‘ã¦ä¿å˜" + +#~ msgid "Close / Save label as" +#~ msgstr "ラベルã«åå‰ã‚’付ã‘ã¦ä¿å˜ã—ã¦é–‰ã˜ã¾ã™" + +#~ msgid "Label no longer valid!" +#~ msgstr "ラベルã¯æœ‰åŠ¹ã§ã¯ã‚ã‚Šã¾ã›ã‚“ï¼" + +#~ msgid "Image format not currently supported" +#~ msgstr "ç”»åƒãƒ•ã‚©ãƒ¼ãƒžãƒƒãƒˆã¯ã‚µãƒãƒ¼ãƒˆã—ã¦ã„ã¾ã›ã‚“" + +#~ msgid "General" +#~ msgstr "全般" + +#~ msgid "_New" +#~ msgstr "æ–°è¦(_N)" + +#~ msgid "Make a new, empty label" +#~ msgstr "æ–°è¦ã«ç©ºã®ãƒ©ãƒ™ãƒ«ã‚’作æˆã—ã¾ã™" + +#~ msgid "U_nselect All " +#~ msgstr "å…¨ã¦é¸æŠžè§£é™¤(_N)" + +#~ msgid "Remove all selections" +#~ msgstr "é¸æŠžç¯„囲を解除ã—ã¾ã™" + +#~ msgid "Select" +#~ msgstr "é¸æŠž" + +#~ msgid "Select, move and modify objects" +#~ msgstr "オブジェクトã®é¸æŠžã€ç§»å‹•ã€ç·¨é›†ã‚’è¡Œã„ã¾ã™" + +#~ msgid "Create text object" +#~ msgstr "テã‚スト・オブジェクトを作æˆã—ã¾ã™" + +#~ msgid "Box" +#~ msgstr "四角" + +#~ msgid "Create box/rectangle object" +#~ msgstr "四角/三角ã®ã‚ªãƒ–ジェクトを作æˆã—ã¾ã™" + +#~ msgid "Create line object" +#~ msgstr "直線オブジェクトを作æˆã—ã¾ã™" + +#~ msgid "Ellipse" +#~ msgstr "楕円" + +#~ msgid "Create ellipse/circle object" +#~ msgstr "楕円/円オブジェクトを作æˆã—ã¾ã™" + +#~ msgid "Create image object" +#~ msgstr "ç”»åƒã‚ªãƒ–ジェクトを作æˆã—ã¾ã™" + +#~ msgid "Barcode" +#~ msgstr "ãƒãƒ¼ã‚³ãƒ¼ãƒ‰" + +#~ msgid "Create barcode object" +#~ msgstr "ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ãƒ»ã‚ªãƒ–ジェクトを作æˆã—ã¾ã™" + +#~ msgid "Zoom in" +#~ msgstr "拡大" + +#~ msgid "Zoom out" +#~ msgstr "縮å°" + +#~ msgid "Zoom 1:1" +#~ msgstr "å…ƒã®ã‚µã‚¤ã‚ºã¸" + +#~ msgid "Zoom to 1:1" +#~ msgstr "縦横比 1:1 ã®ã‚µã‚¤ã‚ºã«ã—ã¾ã™" + +#~ msgid "Merge properties" +#~ msgstr "çµåˆãƒ—ãƒãƒ‘ティ" + +#~ msgid "Edit merge properties" +#~ msgstr "çµåˆãƒ—ãƒãƒ‘ティを編集ã—ã¾ã™" + +#~ msgid "_Tools" +#~ msgstr "ツール(_T)" + +#~ msgid " New " +#~ msgstr " æ–°è¦ " + +#~ msgid "New Label/Card" +#~ msgstr "æ–°è¦ã®ãƒ©ãƒ™ãƒ«/カードを作æˆã—ã¾ã™" + +#~ msgid " Open " +#~ msgstr " é–‹ã " + +#~ msgid "Open a file" +#~ msgstr "ファイルを開ãã¾ã™" + +#~ msgid " Save " +#~ msgstr " ä¿å˜ " + +#~ msgid "Save current file" +#~ msgstr "ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’ä¿å˜ã—ã¾ã™" + +#~ msgid " Print " +#~ msgstr " å°åˆ· " + +#~ msgid "Print current file" +#~ msgstr "ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’å°åˆ·ã—ã¾ã™" + +#~ msgid "Function is not implemented!" +#~ msgstr "ã¾ã ã“ã®æ©Ÿèƒ½ã¯å®Ÿè£…ã•ã‚Œã¦ã„ã¾ã›ã‚“ï¼" diff --git a/glabels2/po/pt_BR.po b/glabels2/po/pt_BR.po new file mode 100644 index 0000000..65628ec --- /dev/null +++ b/glabels2/po/pt_BR.po @@ -0,0 +1,861 @@ +# Brazilian Portuguese translation of Glabels. +# Copyright (C) 2001 Jim Evins <evins@snaught.com> +# Paulo R. Ormenese <pormenese@uol.com.br>, 2001. +# +#: src/commands.c:384 +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.4.1\n" +"POT-Creation-Date: 2002-08-20 21:43-0400\n" +"PO-Revision-Date: 2002-01-31 21:20+ZONE\n" +"Last-Translator: Paulo R. Ormenese <pormenese@uol.com.br>\n" +"Language-Team: Brazilian portuguese <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/glabels.c:59 +msgid "Show view debugging messages." +msgstr "" + +#: src/glabels.c:62 +msgid "Show item debugging messages." +msgstr "" + +#: src/glabels.c:65 +msgid "Show printing debugging messages." +msgstr "" + +#: src/glabels.c:68 +msgid "Show prefs debugging messages." +msgstr "" + +#: src/glabels.c:71 +msgid "Show file debugging messages." +msgstr "" + +#: src/glabels.c:74 +msgid "Show document debugging messages." +msgstr "" + +#: src/glabels.c:77 +msgid "Show template debugging messages." +msgstr "" + +#: src/glabels.c:80 +msgid "Show xml debugging messages." +msgstr "" + +#: src/glabels.c:83 +msgid "Show document merge debugging messages." +msgstr "" + +#: src/glabels.c:86 +msgid "Show commands debugging messages." +msgstr "" + +#: src/glabels.c:89 +msgid "Show undo debugging messages." +msgstr "" + +#: src/glabels.c:92 +msgid "Show recent debugging messages." +msgstr "" + +#: src/glabels.c:95 +msgid "Show mdi debugging messages." +msgstr "" + +#: src/glabels.c:98 +msgid "Show media select widget debugging messages." +msgstr "" + +#: src/glabels.c:101 +msgid "Show mini preview widget debugging messages." +msgstr "" + +#: src/glabels.c:104 +msgid "Show widget debugging messages." +msgstr "" + +#: src/glabels.c:107 +msgid "Turn on all debugging messages." +msgstr "" + +#: src/glabels-batch.c:47 +msgid "print this message" +msgstr "" + +#: src/glabels-batch.c:49 +msgid "print the version of glabels-batch being used" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "set output filename (default=\"output.ps\")" +msgstr "" + +#: src/glabels-batch.c:51 +msgid "filename" +msgstr "" + +#: src/glabels-batch.c:53 +msgid "number of sheets (default=1)" +msgstr "" + +#: src/glabels-batch.c:53 +#, fuzzy +msgid "sheets" +msgstr "Páginas:" + +#: src/glabels-batch.c:55 +msgid "number of copies (default=1)" +msgstr "" + +#: src/glabels-batch.c:55 +#, fuzzy +msgid "copies" +msgstr "Cópias" + +#: src/glabels-batch.c:57 src/print-dialog.c:205 +msgid "print outlines (to test printer alignment)" +msgstr "imprimir contornos (testar alinhamento da impressora)" + +#: src/glabels-batch.c:59 src/print-dialog.c:214 +msgid "print in reverse (i.e. a mirror image)" +msgstr "imprimir ao contrário (como uma imagem de espelho)" + +#: src/glabels-batch.c:90 +msgid "[OPTION...] GLABELS_FILE..." +msgstr "" + +#: src/glabels-batch.c:109 +msgid "missing glabels file\n" +msgstr "" + +#: src/glabels-batch.c:140 +#, fuzzy, c-format +msgid "cannot open glabels file %s\n" +msgstr "Impossível abrir o arquivo" + +#: src/mdi.c:579 +#, c-format +msgid "" +"Do you want to save the changes you made to the document \"%s\"? \n" +"\n" +"Your changes will be lost if you don't save them." +msgstr "" + +#: src/mdi.c:584 +#, fuzzy +msgid "Do_n't save" +msgstr "Não salve" + +#: src/mdi.c:604 +msgid "_Don't quit" +msgstr "" + +#: src/mdi.c:609 +#, fuzzy +msgid "_Don't close" +msgstr "Não salve" + +#: src/mdi.c:706 +msgid "(modified)" +msgstr "" + +#: src/commands.c:359 +msgid "" +"A label and business card creation program for GNOME.\n" +" \n" +"Glabels is free software; you can redistribute it and/or modify it under the " +"terms of the GNU General Public License as published by the Free Software " +"Foundation; either version 2 of the License, or (at your option) any later " +"version.\n" +" \n" +"This program is distributed in the hope that it will be useful, but WITHOUT " +"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or " +"FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for " +"more details.\n" +msgstr "" +"Um programa para criação de etiquetas e cartões de negócios para o GNOME.\n" +"\n" +"Glabels é software livre; você pode redistribuí-lo e/ou modificá-lo sob os " +"termos da Licença Pública Geral GNU conforme publicada pela Free Software " +"Foundation; ou a versão 2 da Licença, ou (sob sua opção) qualquer versão " +"posterior.\n" +"\n" +"Este programa é distribuido na esperança de que seja útil, mas SEM QUALQUER " +"GARANTIA; sem mesmo as garantias implícitas de COMERCIALIZAÇÃO ou AJUSTES A " +"UM PROPÓSITO PARTICULAR. Veja a Licença Pública Geral GNU para mais " +"detalhes.\n" + +#: src/commands.c:371 +#, fuzzy +msgid "Author:" +msgstr "até:" + +#: src/commands.c:374 +msgid "See the file AUTHORS for additional acknowledgments," +msgstr "" + +#: src/commands.c:375 +msgid "or visit http://snaught.com/glabels" +msgstr "" + +#: src/commands.c:397 +#, fuzzy +msgid "glabels" +msgstr "Etiquetas" + +#: src/file.c:82 +msgid "New Label or Card" +msgstr "Nova Etiqueta ou Cartão" + +#: src/file.c:109 +msgid "Media Type" +msgstr "Tipo de mídia" + +#: src/file.c:119 +msgid "Label orientation" +msgstr "Orientação da etiqueta" + +#: src/file.c:248 +msgid "Open" +msgstr "Abrir" + +#: src/file.c:250 +msgid "Open label" +msgstr "Abrir etiqueta" + +#: src/file.c:338 +#, fuzzy, c-format +msgid "Cannot open file '%s'" +msgstr "Impossível abrir o arquivo" + +#: src/file.c:429 +#, fuzzy, c-format +msgid "Error saving file '%s'" +msgstr "Erro gravando o arquivo" + +#: src/file.c:468 +msgid "Save label as" +msgstr "Salvar etiqueta como" + +#: src/file.c:550 +msgid "Must supply file name" +msgstr "Necessário informar nome do arquivo" + +#: src/file.c:569 +#, fuzzy, c-format +msgid "Error writing file '%s'" +msgstr "Erro gravando o arquivo" + +#. Should not happen +#: src/prefs.c:625 src/prefs.c:632 src/wdgt-line.c:186 +msgid "points" +msgstr "pontos" + +#: src/prefs.c:627 +msgid "inches" +msgstr "poleg." + +#: src/prefs.c:629 +msgid "mm" +msgstr "mm" + +#: src/prefs-dialog.c:220 +#, fuzzy +msgid "Locale" +msgstr "Escala:" + +#: src/prefs-dialog.c:224 +msgid "Object defaults" +msgstr "" + +#: src/prefs-dialog.c:232 +#, fuzzy +msgid "Preferences" +msgstr "Glabels: Preferências" + +#: src/prefs-dialog.c:272 +msgid "Select locale specific behavior." +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs-dialog.c:279 +msgid "Display units" +msgstr "Exibir unidades" + +#: src/prefs-dialog.c:289 +msgid "Points" +msgstr "Pontos" + +#: src/prefs-dialog.c:296 +msgid "Inches" +msgstr "Polegadas" + +#: src/prefs-dialog.c:303 +msgid "Millimeters" +msgstr "Milímetros" + +#. ----- Page Size Frame ------------------------------------ +#: src/prefs-dialog.c:310 +msgid "Default page size" +msgstr "Tamanho de página padrão" + +#: src/prefs-dialog.c:364 +msgid "Select default properties for new objects." +msgstr "" + +#. ------ Line box ------ +#: src/prefs-dialog.c:377 +msgid "Line" +msgstr "Linha" + +#. ------ Fill box ------ +#: src/prefs-dialog.c:382 src/view-box.c:325 src/view-ellipse.c:325 +msgid "Fill" +msgstr "Preencher" + +#: src/view-object.c:406 src/view.c:1520 +msgid "Delete" +msgstr "Apagar" + +#: src/view-object.c:416 src/view.c:1530 +msgid "Bring to front" +msgstr "Trazer para frente" + +#: src/view-object.c:423 src/view.c:1536 +msgid "Send to back" +msgstr "Enviar para trás" + +#: src/view-object.c:395 +msgid "Edit properties..." +msgstr "Editar propriedades..." + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-box.c:293 +msgid "Edit box object properties" +msgstr "Editar propriedades do objeto caixa" + +#: src/view-barcode.c:313 src/view-box.c:312 src/view-ellipse.c:312 +#: src/view-line.c:309 src/view-text.c:311 +msgid "Appearance" +msgstr "Aparência" + +#. ------ Line box ------ +#: src/view-box.c:315 src/view-ellipse.c:315 src/view-line.c:312 +msgid "Outline" +msgstr "Contorno" + +#: src/view-box.c:340 src/view-ellipse.c:340 src/view-image.c:337 +#: src/view-line.c:328 +msgid "Position/Size" +msgstr "Posição/Tamanho" + +#. ------ Position Frame ------ +#: src/view-barcode.c:345 src/view-barcode.c:349 src/view-box.c:343 +#: src/view-ellipse.c:343 src/view-image.c:340 src/view-line.c:331 +#: src/view-text.c:334 src/view-text.c:338 +msgid "Position" +msgstr "Posição" + +#. ------ Size Frame ------ +#: src/view-box.c:354 src/view-ellipse.c:356 src/view-image.c:353 +#: src/view-line.c:344 +msgid "Size" +msgstr "Tamanho" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-ellipse.c:293 +msgid "Edit ellipse object properties" +msgstr "Editar propriedades do objeto elipse" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-line.c:290 +msgid "Edit line object properties" +msgstr "Editar propriedades do objeto linha" + +#. ----------------------------------------------------------------- +#. Build dialog with notebook. +#. ----------------------------------------------------------------- +#: src/view-image.c:281 +msgid "Edit image object properties" +msgstr "Editar propriedades do objeto imagem" + +#: src/view-image.c:300 +msgid "Image" +msgstr "Imagem" + +#. ------ Size Reset Button ------ +#: src/view-image.c:364 +msgid "Reset image size" +msgstr "Redefinir tamanho da imagem" + +#: src/view-text.c:265 +msgid "Edit text object properties" +msgstr "Editar propriedades do objeto texto" + +#: src/view-text.c:285 src/view-text.c:605 +msgid "Text" +msgstr "Texto" + +#: src/view-barcode.c:267 +msgid "Edit barcode object properties" +msgstr "Editar propriedades do objeto código de barras" + +#: src/view-barcode.c:287 +msgid "Data" +msgstr "Dado" + +#: src/view-barcode.c:292 +msgid "Barcode data" +msgstr "Dado do Código de Barras:" + +#: src/view-barcode.c:318 +#, fuzzy +msgid "Barcode Properties" +msgstr "Propriedades de Texto" + +#. ------ Barcode Style Frame ------ +#: src/view-barcode.c:328 +msgid "Style" +msgstr "Estilo" + +#: src/print.c:814 src/view-barcode.c:758 +msgid "Invalid barcode" +msgstr "Código de barras inválido" + +#: src/merge-properties.c:84 +msgid "Edit document-merge properties" +msgstr "Editar propriedades de fusão do documento" + +#: src/merge-properties.c:130 +msgid "Source" +msgstr "Fonte" + +#: src/merge-properties.c:142 +msgid "Format:" +msgstr "Formato:" + +#: src/merge-properties.c:157 +msgid "Location:" +msgstr "Localização" + +#: src/merge-properties.c:167 +msgid "Fields" +msgstr "Campos" + +#. ----- Contstruct basic print dialog with notebook ----- +#: src/print-dialog.c:102 +msgid "Print" +msgstr "Imprimir" + +#: src/print-dialog.c:124 +msgid "_Job" +msgstr "" + +#: src/print-dialog.c:129 +#, fuzzy +msgid "P_rinter" +msgstr "Imprimir" + +#. ----------- Add simple-copies widget ------------ +#: src/print-dialog.c:158 +msgid "Copies" +msgstr "Cópias" + +#. ------- Otherwise add merge control widget ------------ +#: src/print-dialog.c:174 +msgid "Document merge control" +msgstr "Controle de fusão do documento" + +#. ----------- Add custom print options area ------------ +#: src/print-dialog.c:195 +msgid "Options" +msgstr "Opções" + +#: src/print-dialog.c:345 src/print-dialog.c:384 +msgid "Print preview" +msgstr "Visualizar impressão" + +#: src/label.c:535 +#, c-format +msgid "%s %d" +msgstr "" + +#: src/label.c:535 +msgid "Untitled" +msgstr "" + +#: src/template.c:346 +msgid "No template files found!" +msgstr "Nenhum arquivo modelo encontrado!" + +#: src/xml-label.c:108 src/xml-label.c:139 +msgid "xmlParseFile error" +msgstr "erro: xmlParseFile" + +#: src/xml-label.c:174 +#, fuzzy +msgid "No document root" +msgstr "Sem raiz do documento" + +#: src/xml-label.c:186 +msgid "Importing from glabels 0.1 format" +msgstr "" + +#: src/xml-label.c:194 +msgid "Importing from glabels 0.4 format" +msgstr "" + +#: src/xml-label.c:198 +#, fuzzy +msgid "bad document, unknown glabels Namespace" +msgstr "documento de tipo errado, espaço de nome glabels não encontrado" + +#: src/xml-label.c:226 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Nó raiz ruim = \"%s\"" + +#: src/xml-label.c:249 src/xml-label.c:281 +#, c-format +msgid "bad node = \"%s\"" +msgstr "nó ruim = \"%s\"" + +#: src/xml-label.c:656 +msgid "Problem saving xml file." +msgstr "Problema salvando arquivo xml." + +#: src/merge.c:80 +msgid "None" +msgstr "Nenhum" + +#: src/merge.c:88 +msgid "Text with tab separators" +msgstr "Texto separado com tab" + +#: src/merge.c:96 +msgid "Text with comma separators" +msgstr "Texto separado com vírgula" + +#: src/merge.c:104 +msgid "Text with colon separators" +msgstr "Texto separado com dois pontos" + +#: src/merge-ui.c:223 src/merge-ui.c:265 src/merge-ui.c:435 src/merge-ui.c:483 +msgid "N/A" +msgstr "Não definido" + +#: src/merge-ui-text.c:172 +msgid "Select merge-database source" +msgstr "Selecione a fonte da base de dados da fusão" + +#: src/merge-ui-text.c:330 +msgid "Column" +msgstr "Coluna" + +#: src/merge-ui-text.c:334 +msgid "Custom field key" +msgstr "Chave do campo específico" + +#: src/merge-ui-text.c:338 +msgid "Sample data" +msgstr "Dado de amostra" + +#. Font label +#: src/wdgt-text-props.c:184 +msgid "Font:" +msgstr "Fonte:" + +#. Text Color Label +#: src/wdgt-bc-props.c:190 src/wdgt-fill.c:169 src/wdgt-line.c:192 +#: src/wdgt-text-props.c:237 +msgid "Color:" +msgstr "Cor:" + +#. Alignment label +#: src/wdgt-text-props.c:251 +msgid "Alignment:" +msgstr "Alinhamento:" + +#. Insert merge field label +#: src/wdgt-bc-data.c:199 src/wdgt-text-entry.c:201 +msgid "Key:" +msgstr "Chave:" + +#: src/wdgt-text-entry.c:217 +msgid "Insert merge field" +msgstr "Inserir campo de fusão" + +#. X label +#: src/wdgt-position.c:182 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/wdgt-position.c:200 +msgid "Y:" +msgstr "Y:" + +#. W Label +#: src/wdgt-line.c:172 src/wdgt-size.c:184 +msgid "Width:" +msgstr "Largura:" + +#. H label +#: src/wdgt-size.c:200 +msgid "Height:" +msgstr "Altura:" + +#: src/wdgt-size.c:224 +msgid "Maintain current aspect ratio" +msgstr "Manter taxa de aspecto atual" + +#. Length label +#: src/wdgt-vector.c:186 +msgid "Length:" +msgstr "Comprimento:" + +#. Angle label +#: src/wdgt-vector.c:210 +msgid "Angle:" +msgstr "Ângulo:" + +#. Angle units label +#: src/wdgt-vector.c:227 +msgid "degrees" +msgstr "graus" + +#. Scale Label +#: src/wdgt-bc-props.c:170 +msgid "Scale:" +msgstr "Escala:" + +#. % Label +#: src/wdgt-bc-props.c:184 +#, c-format +msgid "%" +msgstr "%" + +#: src/wdgt-bc-style.c:316 +msgid "Show text with barcode" +msgstr "Exibir texto com código de barras" + +#: src/wdgt-bc-data.c:179 +msgid "Literal:" +msgstr "Literal:" + +#: src/wdgt-print-copies.c:178 +msgid "Sheets:" +msgstr "Páginas:" + +#: src/wdgt-print-copies.c:195 +msgid "Labels" +msgstr "Etiquetas" + +#: src/wdgt-print-copies.c:198 +msgid "from:" +msgstr "de:" + +#: src/wdgt-print-copies.c:206 +msgid "to:" +msgstr "até:" + +#: src/wdgt-print-merge.c:177 +msgid "Start on label" +msgstr "Iniciar na etiqueta" + +#: src/wdgt-print-merge.c:186 +msgid "on 1st sheet" +msgstr "na primeira folha" + +#: src/wdgt-print-merge.c:197 +#, fuzzy +msgid "Collate" +msgstr "Montar" + +#: src/wdgt-print-merge.c:204 +msgid "Copies:" +msgstr "Cópias:" + +#: src/wdgt-media-select.c:252 +msgid "Description:" +msgstr "Descrição:" + +#: src/wdgt-media-select.c:257 +msgid "Page size:" +msgstr "Tamanho da página:" + +#: src/wdgt-media-select.c:262 +msgid "Label size:" +msgstr "Tamanho da etiqueta:" + +#: src/wdgt-media-select.c:267 +msgid "Layout:" +msgstr "Disposição:" + +#: src/wdgt-media-select.c:408 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d por página)" + +#: src/wdgt-media-select.c:422 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/wdgt-media-select.c:427 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/wdgt-rotate-label.c:176 +msgid "Rotate" +msgstr "Girar" + +#: src/bonobo-mdi.c:522 src/bonobo-mdi.c:612 src/bonobo-mdi.c:1850 +#, c-format +msgid "Activate %s" +msgstr "" + +#: src/gnome-recent-view-bonobo.c:189 +#, fuzzy, c-format +msgid "Open %s" +msgstr "Abrir" + +#~ msgid "Revert to saved copy of %s?" +#~ msgstr "Reverter para a cópia gravada de %s?" + +#~ msgid "Unknown media type. Using default." +#~ msgstr "Tipo de mídia desconhecido. Usando padrão." + +#~ msgid "" +#~ "``%s'' has been modified.\n" +#~ "\n" +#~ "Do you wish to save it?" +#~ msgstr "" +#~ "``%s'' foi modificado.\n" +#~ "\n" +#~ "Deseja salvá-lo?" + +#~ msgid "Cannot save file" +#~ msgstr "Não posso salvar o arquivo" + +#~ msgid "Save As" +#~ msgstr "Salvar como" + +#~ msgid "Close / Save label as" +#~ msgstr "Fechar / Salvar etiqueta como" + +#~ msgid "Label no longer valid!" +#~ msgstr "Etiqueta não é mais válida" + +#~ msgid "Image format not currently supported" +#~ msgstr "Formato de imagem não suportado atualmente" + +#~ msgid "General" +#~ msgstr "Geral" + +#~ msgid "_New" +#~ msgstr "_Novo" + +#~ msgid "Make a new, empty label" +#~ msgstr "Criar uma etiqueta nova, vazia" + +#~ msgid "U_nselect All " +#~ msgstr "D_esmarcar Tudo " + +#~ msgid "Remove all selections" +#~ msgstr "Remover todas as seleções" + +#~ msgid "Select" +#~ msgstr "Selecionar" + +#~ msgid "Select, move and modify objects" +#~ msgstr "Selecionar, movimentar e modificar objetos" + +#~ msgid "Create text object" +#~ msgstr "Criar objeto texto" + +#~ msgid "Box" +#~ msgstr "Caixa" + +#~ msgid "Create box/rectangle object" +#~ msgstr "Criar objeto caixa/retângulo" + +#~ msgid "Create line object" +#~ msgstr "Criar objeto linha" + +#~ msgid "Ellipse" +#~ msgstr "Elipse" + +#~ msgid "Create ellipse/circle object" +#~ msgstr "Criar objeto elipse/círculo" + +#~ msgid "Create image object" +#~ msgstr "Criar objeto imagem" + +#~ msgid "Barcode" +#~ msgstr "Código de Barras" + +#~ msgid "Create barcode object" +#~ msgstr "Criar objeto código de barras" + +#~ msgid "Zoom in" +#~ msgstr "Mais Zoom" + +#~ msgid "Zoom out" +#~ msgstr "Menos Zoom" + +#~ msgid "Zoom 1:1" +#~ msgstr "Zoom 1:1" + +#~ msgid "Zoom to 1:1" +#~ msgstr "Zoom para 1:1" + +#~ msgid "Merge properties" +#~ msgstr "Propriedades de Fusão" + +#~ msgid "Edit merge properties" +#~ msgstr "Editar propriedades de fusão" + +#~ msgid "_Tools" +#~ msgstr "_Ferramentas" + +#~ msgid " New " +#~ msgstr " Novo " + +#~ msgid "New Label/Card" +#~ msgstr "Nova Etiqueta/Cartão" + +#~ msgid " Open " +#~ msgstr " Abrir " + +#~ msgid "Open a file" +#~ msgstr "Abrir um arquivo" + +#~ msgid " Save " +#~ msgstr " Salvar " + +#~ msgid "Save current file" +#~ msgstr "Salvar arquivo atual" + +#~ msgid " Print " +#~ msgstr " Imprimir " + +#~ msgid "Print current file" +#~ msgstr "Imprimir arquivo atual" + +#~ msgid "Function is not implemented!" +#~ msgstr "Função não está implementada!" + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Função ainda não implementada!" diff --git a/glabels2/src/Makefile.am b/glabels2/src/Makefile.am new file mode 100644 index 0000000..69b4c96 --- /dev/null +++ b/glabels2/src/Makefile.am @@ -0,0 +1,260 @@ +LIB_BARCODE_DIR = ../barcode-0.98 + +SUBDIRS= pixmaps stock-pixmaps + +bin_PROGRAMS = glabels glabels-batch + +uidir = $(datadir)/glabels/ui/ + + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + $(GLABELS_CFLAGS) \ + -I$(LIB_BARCODE_DIR) \ + -DGNOME_ICONDIR=\""$(datadir)/pixmaps"\" \ + -DGLABELS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DGLABELS_UI_DIR=\""$(datadir)/glabels/ui/"\" \ + -DGLABELS_GLADEDIR=\""$(datadir)/glabels/glade/"\" \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGNOME_DISABLE_DEPRECATED + +glabels_LDFLAGS = -export-dynamic + +glabels_LDADD = \ + $(GLABELS_LIBS) \ + -L$(LIB_BARCODE_DIR) -lbarcode + +glabels_batch_LDFLAGS = -export-dynamic + +glabels_batch_LDADD = \ + $(GLABELS_LIBS) \ + -L$(LIB_BARCODE_DIR) -lbarcode + +BUILT_SOURCES = \ + marshal.c \ + marshal.h \ + gnome-recent-marshal.c \ + gnome-recent-marshal.h + +glabels_SOURCES = \ + glabels.c \ + glabels.h \ + splash.c \ + splash.h \ + mdi.c \ + mdi.h \ + mdi-child.c \ + mdi-child.h \ + stock.c \ + stock.h \ + menus.h \ + menus.c \ + commands.h \ + commands.c \ + file.h \ + file.c \ + recent.h \ + recent.c \ + tools.h \ + tools.c \ + prefs.c \ + prefs.h \ + prefs-dialog.c \ + prefs-dialog.h \ + view.c \ + view.h \ + view-object.c \ + view-object.h \ + view-box.c \ + view-box.h \ + view-ellipse.c \ + view-ellipse.h \ + view-line.c \ + view-line.h \ + view-image.c \ + view-image.h \ + view-text.c \ + view-text.h \ + view-barcode.c \ + view-barcode.h \ + view-highlight.c \ + view-highlight.h \ + merge-properties.c \ + merge-properties.h \ + print.c \ + print.h \ + print-dialog.c \ + print-dialog.h \ + bc.c \ + bc.h \ + bc-gnubarcode.c \ + bc-gnubarcode.h \ + bc-postnet.c \ + bc-postnet.h \ + label.c \ + label.h \ + label-object.c \ + label-object.h \ + label-text.c \ + label-text.h \ + label-box.c \ + label-box.h \ + label-line.c \ + label-line.h \ + label-ellipse.c \ + label-ellipse.h \ + label-image.c \ + label-image.h \ + label-barcode.c \ + label-barcode.h \ + template.c \ + template.h \ + xml-label.c \ + xml-label.h \ + merge.c \ + merge.h \ + merge-text.c \ + merge-text.h \ + merge-ui.c \ + merge-ui.h \ + merge-ui-text.c \ + merge-ui-text.h \ + text-node.c \ + text-node.h \ + wdgt-text-props.c \ + wdgt-text-props.h \ + wdgt-text-entry.c \ + wdgt-text-entry.h \ + wdgt-position.c \ + wdgt-position.h \ + wdgt-size.c \ + wdgt-size.h \ + wdgt-line.c \ + wdgt-line.h \ + wdgt-fill.c \ + wdgt-fill.h \ + wdgt-vector.c \ + wdgt-vector.h \ + wdgt-bc-props.c \ + wdgt-bc-props.h \ + wdgt-bc-style.c \ + wdgt-bc-style.h \ + wdgt-bc-data.c \ + wdgt-bc-data.h \ + wdgt-print-copies.c \ + wdgt-print-copies.h \ + wdgt-print-merge.c \ + wdgt-print-merge.h \ + wdgt-media-select.c \ + wdgt-media-select.h \ + wdgt-mini-preview.c \ + wdgt-mini-preview.h \ + wdgt-rotate-label.c \ + wdgt-rotate-label.h \ + util.c \ + util.h \ + canvas-hacktext.c \ + canvas-hacktext.h \ + bonobo-mdi-child.c \ + bonobo-mdi-child.h \ + bonobo-mdi.c \ + bonobo-mdi.h \ + gnome-recent-model.c \ + gnome-recent-model.h \ + gnome-recent-util.c \ + gnome-recent-util.h \ + gnome-recent-view.c \ + gnome-recent-view.h \ + gnome-recent-view-bonobo.c \ + gnome-recent-view-bonobo.h \ + debug.c \ + debug.h \ + $(BUILT_SOURCES) + +glabels_batch_SOURCES = \ + glabels-batch.c \ + prefs.c \ + prefs.h \ + print.c \ + print.h \ + bc.c \ + bc.h \ + bc-gnubarcode.c \ + bc-gnubarcode.h \ + bc-postnet.c \ + bc-postnet.h \ + label.c \ + label.h \ + label-object.c \ + label-object.h \ + label-text.c \ + label-text.h \ + label-box.c \ + label-box.h \ + label-line.c \ + label-line.h \ + label-ellipse.c \ + label-ellipse.h \ + label-image.c \ + label-image.h \ + label-barcode.c \ + label-barcode.h \ + template.c \ + template.h \ + xml-label.c \ + xml-label.h \ + merge.c \ + merge.h \ + merge-text.c \ + merge-text.h \ + text-node.c \ + text-node.h \ + util.c \ + util.h \ + debug.c \ + debug.h \ + $(BUILT_SOURCES) + +marshal.h: marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gl_marshal > $@ + +marshal.c: marshal.list $(GLIB_GENMARSHAL) + echo "#include \"marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gl_marshal >> $@ + +gnome-recent-marshal.h: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gnome_recent > $@ + +gnome-recent-marshal.c: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + echo "#include \"gnome-recent-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gnome_recent >> $@ + + +ui_DATA = glabels-ui.xml + +EXTRA_DIST = \ + $(ui_DATA) \ + marshal.list \ + gnome-recent-marshal.list + +CLEANFILES = $(BUILT_SOURCES) + +$(bin_PROGRAMS): $(LIB_BARCODE_DIR)/libbarcode.a + +$(LIB_BARCODE_DIR)/libbarcode.a: + cd $(LIB_BARCODE_DIR); $(MAKE) + +clean: barcode_clean + +barcode_clean: + cd $(LIB_BARCODE_DIR); $(MAKE) clean + +distclean maintainer-clean: barcode_distclean + +barcode_distclean: + cd $(LIB_BARCODE_DIR); $(MAKE) distclean + diff --git a/glabels2/src/Makefile.in b/glabels2/src/Makefile.in new file mode 100644 index 0000000..2ec5081 --- /dev/null +++ b/glabels2/src/Makefile.in @@ -0,0 +1,478 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +LIB_BARCODE_DIR = ../barcode-0.98 + +SUBDIRS = pixmaps stock-pixmaps + +bin_PROGRAMS = glabels glabels-batch + +uidir = $(datadir)/glabels/ui/ + +INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/dialogs $(GLABELS_CFLAGS) -I$(LIB_BARCODE_DIR) -DGNOME_ICONDIR=\""$(datadir)/pixmaps"\" -DGLABELS_LOCALEDIR=\""$(datadir)/locale"\" -DGLABELS_UI_DIR=\""$(datadir)/glabels/ui/"\" -DGLABELS_GLADEDIR=\""$(datadir)/glabels/glade/"\" -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED + + +glabels_LDFLAGS = -export-dynamic + +glabels_LDADD = $(GLABELS_LIBS) -L$(LIB_BARCODE_DIR) -lbarcode + + +glabels_batch_LDFLAGS = -export-dynamic + +glabels_batch_LDADD = $(GLABELS_LIBS) -L$(LIB_BARCODE_DIR) -lbarcode + + +BUILT_SOURCES = marshal.c marshal.h gnome-recent-marshal.c gnome-recent-marshal.h + + +glabels_SOURCES = glabels.c glabels.h splash.c splash.h mdi.c mdi.h mdi-child.c mdi-child.h stock.c stock.h menus.h menus.c commands.h commands.c file.h file.c recent.h recent.c tools.h tools.c prefs.c prefs.h prefs-dialog.c prefs-dialog.h view.c view.h view-object.c view-object.h view-box.c view-box.h view-ellipse.c view-ellipse.h view-line.c view-line.h view-image.c view-image.h view-text.c view-text.h view-barcode.c view-barcode.h view-highlight.c view-highlight.h merge-properties.c merge-properties.h print.c print.h print-dialog.c print-dialog.h bc.c bc.h bc-gnubarcode.c bc-gnubarcode.h bc-postnet.c bc-postnet.h label.c label.h label-object.c label-object.h label-text.c label-text.h label-box.c label-box.h label-line.c label-line.h label-ellipse.c label-ellipse.h label-image.c label-image.h label-barcode.c label-barcode.h template.c template.h xml-label.c xml-label.h merge.c merge.h merge-text.c merge-text.h merge-ui.c merge-ui.h merge-ui-text.c merge-ui-text.h text-node.c text-node.h wdgt-text-props.c wdgt-text-props.h wdgt-text-entry.c wdgt-text-entry.h wdgt-position.c wdgt-position.h wdgt-size.c wdgt-size.h wdgt-line.c wdgt-line.h wdgt-fill.c wdgt-fill.h wdgt-vector.c wdgt-vector.h wdgt-bc-props.c wdgt-bc-props.h wdgt-bc-style.c wdgt-bc-style.h wdgt-bc-data.c wdgt-bc-data.h wdgt-print-copies.c wdgt-print-copies.h wdgt-print-merge.c wdgt-print-merge.h wdgt-media-select.c wdgt-media-select.h wdgt-mini-preview.c wdgt-mini-preview.h wdgt-rotate-label.c wdgt-rotate-label.h util.c util.h canvas-hacktext.c canvas-hacktext.h bonobo-mdi-child.c bonobo-mdi-child.h bonobo-mdi.c bonobo-mdi.h gnome-recent-model.c gnome-recent-model.h gnome-recent-util.c gnome-recent-util.h gnome-recent-view.c gnome-recent-view.h gnome-recent-view-bonobo.c gnome-recent-view-bonobo.h debug.c debug.h $(BUILT_SOURCES) + + +glabels_batch_SOURCES = glabels-batch.c prefs.c prefs.h print.c print.h bc.c bc.h bc-gnubarcode.c bc-gnubarcode.h bc-postnet.c bc-postnet.h label.c label.h label-object.c label-object.h label-text.c label-text.h label-box.c label-box.h label-line.c label-line.h label-ellipse.c label-ellipse.h label-image.c label-image.h label-barcode.c label-barcode.h template.c template.h xml-label.c xml-label.h merge.c merge.h merge-text.c merge-text.h text-node.c text-node.h util.c util.h debug.c debug.h $(BUILT_SOURCES) + + +ui_DATA = glabels-ui.xml + +EXTRA_DIST = $(ui_DATA) marshal.list gnome-recent-marshal.list + + +CLEANFILES = $(BUILT_SOURCES) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +glabels_OBJECTS = glabels.o splash.o mdi.o mdi-child.o stock.o menus.o \ +commands.o file.o recent.o tools.o prefs.o prefs-dialog.o view.o \ +view-object.o view-box.o view-ellipse.o view-line.o view-image.o \ +view-text.o view-barcode.o view-highlight.o merge-properties.o print.o \ +print-dialog.o bc.o bc-gnubarcode.o bc-postnet.o label.o label-object.o \ +label-text.o label-box.o label-line.o label-ellipse.o label-image.o \ +label-barcode.o template.o xml-label.o merge.o merge-text.o merge-ui.o \ +merge-ui-text.o text-node.o wdgt-text-props.o wdgt-text-entry.o \ +wdgt-position.o wdgt-size.o wdgt-line.o wdgt-fill.o wdgt-vector.o \ +wdgt-bc-props.o wdgt-bc-style.o wdgt-bc-data.o wdgt-print-copies.o \ +wdgt-print-merge.o wdgt-media-select.o wdgt-mini-preview.o \ +wdgt-rotate-label.o util.o canvas-hacktext.o bonobo-mdi-child.o \ +bonobo-mdi.o gnome-recent-model.o gnome-recent-util.o \ +gnome-recent-view.o gnome-recent-view-bonobo.o debug.o marshal.o \ +gnome-recent-marshal.o +glabels_DEPENDENCIES = +glabels_batch_OBJECTS = glabels-batch.o prefs.o print.o bc.o \ +bc-gnubarcode.o bc-postnet.o label.o label-object.o label-text.o \ +label-box.o label-line.o label-ellipse.o label-image.o label-barcode.o \ +template.o xml-label.o merge.o merge-text.o text-node.o util.o debug.o \ +marshal.o gnome-recent-marshal.o +glabels_batch_DEPENDENCIES = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DATA = $(ui_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(glabels_SOURCES) $(glabels_batch_SOURCES) +OBJECTS = $(glabels_OBJECTS) $(glabels_batch_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +glabels: $(glabels_OBJECTS) $(glabels_DEPENDENCIES) + @rm -f glabels + $(LINK) $(glabels_LDFLAGS) $(glabels_OBJECTS) $(glabels_LDADD) $(LIBS) + +glabels-batch: $(glabels_batch_OBJECTS) $(glabels_batch_DEPENDENCIES) + @rm -f glabels-batch + $(LINK) $(glabels_batch_LDFLAGS) $(glabels_batch_OBJECTS) $(glabels_batch_LDADD) $(LIBS) + +install-uiDATA: $(ui_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(uidir) + @list='$(ui_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(uidir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(uidir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(uidir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(uidir)/$$p; \ + fi; fi; \ + done + +uninstall-uiDATA: + @$(NORMAL_UNINSTALL) + list='$(ui_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(uidir)/$$p; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" != "." || dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: install-binPROGRAMS +install-exec: install-exec-recursive + +install-data-am: install-uiDATA +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: uninstall-binPROGRAMS uninstall-uiDATA +uninstall: uninstall-recursive +all-am: Makefile $(PROGRAMS) $(DATA) +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(uidir) + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \ + mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ + distclean-generic clean-am + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile uninstall-uiDATA install-uiDATA \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +marshal.h: marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gl_marshal > $@ + +marshal.c: marshal.list $(GLIB_GENMARSHAL) + echo "#include \"marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gl_marshal >> $@ + +gnome-recent-marshal.h: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + $(GLIB_GENMARSHAL) $< --header --prefix=gnome_recent > $@ + +gnome-recent-marshal.c: gnome-recent-marshal.list $(GLIB_GENMARSHAL) + echo "#include \"gnome-recent-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) $< --body --prefix=gnome_recent >> $@ + +$(bin_PROGRAMS): $(LIB_BARCODE_DIR)/libbarcode.a + +$(LIB_BARCODE_DIR)/libbarcode.a: + cd $(LIB_BARCODE_DIR); $(MAKE) + +clean: barcode_clean + +barcode_clean: + cd $(LIB_BARCODE_DIR); $(MAKE) clean + +distclean maintainer-clean: barcode_distclean + +barcode_distclean: + cd $(LIB_BARCODE_DIR); $(MAKE) distclean + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/src/bc-gnubarcode.c b/glabels2/src/bc-gnubarcode.c new file mode 100644 index 0000000..8199ecf --- /dev/null +++ b/glabels2/src/bc-gnubarcode.c @@ -0,0 +1,239 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc-gnubarcode.c: front-end to GNU-barcode-library module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * Some of this code is borrowed from the postscript renderer (ps.c) + * from the GNU barcode library: + * + * Copyright (C) 1999 Alessaandro Rubini (rubini@gnu.org) + * Copyright (C) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <ctype.h> +#include <string.h> + +#include "bc.h" +#include "bc-gnubarcode.h" + +#include "barcode.h" + +#include "debug.h" + +#define SHRINK_AMOUNT 0.15 /* shrink bars to account for ink spreading */ +#define FONT_SCALE 0.95 /* Shrink fonts just a hair */ + +static glBarcode *render_pass1 (struct Barcode_Item *bci, + gboolean text_flag, + gdouble scale); + +/*****************************************************************************/ +/* Generate intermediate representation of barcode. */ +/*****************************************************************************/ +glBarcode * +gl_barcode_gnubarcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits) +{ + glBarcode *gbc; + struct Barcode_Item *bci; + gint flags; + + bci = Barcode_Create (digits); + + /* First encode using GNU Barcode library */ + switch (style) { + case GL_BARCODE_STYLE_EAN: + flags = BARCODE_EAN; + break; + case GL_BARCODE_STYLE_UPC: + flags = BARCODE_UPC; + break; + case GL_BARCODE_STYLE_ISBN: + flags = BARCODE_ISBN; + break; + case GL_BARCODE_STYLE_39: + flags = BARCODE_39; + break; + case GL_BARCODE_STYLE_128: + flags = BARCODE_128; + break; + case GL_BARCODE_STYLE_128C: + flags = BARCODE_128C; + break; + case GL_BARCODE_STYLE_128B: + flags = BARCODE_128B; + break; + case GL_BARCODE_STYLE_I25: + flags = BARCODE_I25; + break; + case GL_BARCODE_STYLE_CBR: + flags = BARCODE_CBR; + break; + case GL_BARCODE_STYLE_MSI: + flags = BARCODE_MSI; + break; + case GL_BARCODE_STYLE_PLS: + flags = BARCODE_PLS; + break; + default: + g_warning( "Illegal barcode style %d", style ); + flags = BARCODE_ANY; + break; + } + Barcode_Encode (bci, flags); + if (!bci->partial || !bci->textinfo) { + g_warning ("Barcode Data Invalid"); + Barcode_Delete (bci); + return NULL; + } + + /* now render with our custom back-end, + to create appropriate intermdediate format */ + gbc = render_pass1 (bci, text_flag, scale); + + Barcode_Delete (bci); + return gbc; +} + +/*-------------------------------------------------------------------------- + * PRIVATE. Render to glBarcode intermediate representation of barcode. + * + * Some of this code is borrowed from the postscript renderer (ps.c) + * from the GNU barcode library: + * + * Copyright (C) 1999 Alessaandro Rubini (rubini@gnu.org) + * Copyright (C) 1999 Prosa Srl. (prosa@prosa.it) + * + *--------------------------------------------------------------------------*/ +static glBarcode * +render_pass1 (struct Barcode_Item *bci, + gboolean text_flag, + gdouble scale) +{ + glBarcode *gbc; + glBarcodeLine *line; + glBarcodeChar *bchar; + gdouble x; + gint i, j, barlen; + gdouble f1, f2; + gint mode = '-'; /* text below bars */ + gdouble x0, y0, yr; + guchar *p, c; + + /* First calculate barlen */ + barlen = bci->partial[0] - '0'; + for (p = bci->partial + 1; *p != 0; p++) { + if (isdigit (*p)) { + barlen += *p - '0'; + } else { + if ((*p != '+') && (*p != '-')) { + barlen += *p - 'a' + 1; + } + } + } + + /* The width defaults to "just enough" */ + bci->width = barlen * scale + 1; + + /* The height defaults to 80 points (rescaled) */ + if (!bci->height) + bci->height = 80 * scale; + + gbc = g_new0 (glBarcode, 1); + + /* Now traverse the code string and create a list of lines */ + x = bci->margin + (bci->partial[0] - '0') * scale; + for (p = bci->partial + 1, i = 1; *p != 0; p++, i++) { + /* special cases: '+' and '-' */ + if (*p == '+' || *p == '-') { + mode = *p; /* don't count it */ + i++; + continue; + } + /* j is the width of this bar/space */ + if (isdigit (*p)) + j = *p - '0'; + else + j = *p - 'a' + 1; + if (i % 2) { /* bar */ + x0 = x + (j * scale) / 2; + y0 = bci->margin; + yr = bci->height; + if (text_flag) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 or 5 points */ + yr -= (isdigit (*p) ? 10 : 5) * scale; + } else { /* '+' */ + /* above bars: 10 or 0 from bottom, + and 10 from top */ + y0 += 10 * scale; + yr -= (isdigit (*p) ? 20 : 10) * scale; + } + } + line = g_new0 (glBarcodeLine, 1); + line->x = x0; + line->y = y0; + line->length = yr; + line->width = (j * scale) - SHRINK_AMOUNT; + gbc->lines = g_list_append (gbc->lines, line); + } + x += j * scale; + + } + + /* Now the text */ + mode = '-'; /* reinstantiate default */ + if (text_flag) { + for (p = bci->textinfo; p; p = strchr (p, ' ')) { + while (*p == ' ') + p++; + if (!*p) + break; + if (*p == '+' || *p == '-') { + mode = *p; + continue; + } + if (sscanf (p, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + g_warning ("impossible data: %s", p); + continue; + } + bchar = g_new0 (glBarcodeChar, 1); + bchar->x = f1 * scale + bci->margin; + if (mode == '-') { + bchar->y = + bci->margin + bci->height - 8 * scale; + } else { + bchar->y = bci->margin; + } + bchar->fsize = f2 * FONT_SCALE * scale; + bchar->c = c; + gbc->chars = g_list_append (gbc->chars, bchar); + } + } + + /* Fill in other info */ + gbc->height = bci->height + 2.0 * bci->margin; + gbc->width = bci->width + 2.0 * bci->margin; + + return gbc; +} diff --git a/glabels2/src/bc-gnubarcode.h b/glabels2/src/bc-gnubarcode.h new file mode 100644 index 0000000..4cedd61 --- /dev/null +++ b/glabels2/src/bc-gnubarcode.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_gnubarcode.h: front-end to GNU-barcode-library module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_GNUBARCODE_H__ +#define __BC_GNUBARCODE_H__ + +#include "bc.h" + +extern glBarcode *gl_barcode_gnubarcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits); + +#endif diff --git a/glabels2/src/bc-postnet.c b/glabels2/src/bc-postnet.c new file mode 100644 index 0000000..90b463d --- /dev/null +++ b/glabels2/src/bc-postnet.c @@ -0,0 +1,150 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_postnet.c: GLabels POSTNET barcode module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This module implements the POSTNET barcode specified in the USPS + * publication 25, Mar 2001. + */ + +#include <config.h> + +#include <ctype.h> + +#include "bc.h" +#include "bc-postnet.h" + +#include "debug.h" + +static gchar *symbols[] = { + /* 0 */ "11000", + /* 1 */ "00011", + /* 2 */ "00101", + /* 3 */ "00110", + /* 4 */ "01001", + /* 5 */ "01010", + /* 6 */ "01100", + /* 7 */ "10001", + /* 8 */ "10010", + /* 9 */ "10100", +}; + +static gchar *frame_symbol = "1"; + +#define POSTNET_BAR_WIDTH 1.25 +#define POSTNET_FULLBAR_HEIGHT 9.00 +#define POSTNET_HALFBAR_HEIGHT 3.50 +#define POSTNET_BAR_PITCH 3.25 +#define POSTNET_HORIZ_MARGIN 9.00 +#define POSTNET_VERT_MARGIN 3.00 + +static gchar *postnet_code (gchar * digits); + +/****************************************************************************/ +/* Generate list of lines that form the barcode for the given digits. */ +/****************************************************************************/ +glBarcode * +gl_barcode_postnet_new (gchar * digits) +{ + gchar *code, *p; + glBarcode *gbc; + glBarcodeLine *line; + gdouble x; + + gbc = g_new0 (glBarcode, 1); + + /* First get code string */ + code = postnet_code (digits); + if (code == NULL) { + return NULL; + } + + /* Now traverse the code string and create a list of lines */ + x = POSTNET_HORIZ_MARGIN; + for (p = code; *p != 0; p++) { + line = g_new0 (glBarcodeLine, 1); + line->x = x; + line->y = POSTNET_VERT_MARGIN; + if (*p == '0') { + line->y += + POSTNET_FULLBAR_HEIGHT - POSTNET_HALFBAR_HEIGHT; + line->length = POSTNET_HALFBAR_HEIGHT; + } else { + line->length = POSTNET_FULLBAR_HEIGHT; + } + line->width = POSTNET_BAR_WIDTH; + + gbc->lines = g_list_append (gbc->lines, line); + + x += POSTNET_BAR_PITCH; + } + + g_free (code); + + gbc->width = x + POSTNET_HORIZ_MARGIN; + gbc->height = POSTNET_FULLBAR_HEIGHT + 2 * POSTNET_VERT_MARGIN; + + gbc->chars = NULL; + + return gbc; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Generate string of symbols, representing barcode. */ +/*--------------------------------------------------------------------------*/ +static gchar * +postnet_code (gchar * digits) +{ + gchar *p; + gint len; + gint d, sum; + GString *code; + gchar *ret; + + /* Left frame bar */ + code = g_string_new (frame_symbol); + + sum = 0; + for (p = digits, len = 0; (*p != 0) && (len < 11); p++) { + if (isdigit (*p)) { + /* Only translate valid characters (0-9) */ + d = (*p) - '0'; + sum += d; + code = g_string_append (code, symbols[d]); + len++; + } + } + if ((len != 5) && (len != 9) && (len != 11)) { + g_warning ("Invalid POSTNET length %d, should be 5(ZIP), 9(ZIP+4), or 11(DPBC)", len); + } + + /* Create correction character */ + d = (10 - (sum % 10)) % 10; + code = g_string_append (code, symbols[d]); + + /* Right frame bar */ + code = g_string_append (code, frame_symbol); + + ret = g_strdup (code->str); + g_string_free (code, TRUE); + + return ret; +} diff --git a/glabels2/src/bc-postnet.h b/glabels2/src/bc-postnet.h new file mode 100644 index 0000000..c54a31c --- /dev/null +++ b/glabels2/src/bc-postnet.h @@ -0,0 +1,29 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_postnet.h: GLabels POSTNET barcode module header file + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_POSTNET_H__ +#define __BC_POSTNET_H__ + +#include <glib.h> + +glBarcode *gl_barcode_postnet_new (gchar * digits); + +#endif diff --git a/glabels2/src/bc.c b/glabels2/src/bc.c new file mode 100644 index 0000000..a83a333 --- /dev/null +++ b/glabels2/src/bc.c @@ -0,0 +1,201 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc.c: GLabels barcode module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include "bc.h" +#include "bc-postnet.h" +#include "bc-gnubarcode.h" + +#include "debug.h" + +/*****************************************************************************/ +/* Call appropriate barcode backend to create barcode in intermediate format.*/ +/*****************************************************************************/ +glBarcode * +gl_barcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits) +{ + glBarcode *gbc; + + switch (style) { + + case GL_BARCODE_STYLE_POSTNET: + /* Use the POSTNET backend module */ + gbc = gl_barcode_postnet_new (digits); + break; + + default: + /* Use the GNU barcode library backend */ + gbc = gl_barcode_gnubarcode_new (style, text_flag, scale, digits); + break; + + } + return gbc; +} + +/*****************************************************************************/ +/* Free previously created barcode. */ +/*****************************************************************************/ +void +gl_barcode_free (glBarcode ** gbc) +{ + GList *p; + + if (*gbc != NULL) { + + for (p = (*gbc)->lines; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + g_list_free ((*gbc)->lines); + (*gbc)->lines = NULL; + + for (p = (*gbc)->chars; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + g_list_free ((*gbc)->chars); + (*gbc)->chars = NULL; + + g_free (*gbc); + *gbc = NULL; + } +} + +/*****************************************************************************/ +/* Return an appropriate set of digits for the given barcode style. */ +/*****************************************************************************/ +gchar * +gl_barcode_default_digits (glBarcodeStyle style) +{ + switch (style) { + + case GL_BARCODE_STYLE_POSTNET: + return g_strdup ("000000000"); + case GL_BARCODE_STYLE_EAN: + return g_strdup ("000000000000 00000"); + case GL_BARCODE_STYLE_UPC: + return g_strdup ("00000000000 00000"); + case GL_BARCODE_STYLE_ISBN: + return g_strdup ("0-00000-000-0 00000"); + case GL_BARCODE_STYLE_39: + case GL_BARCODE_STYLE_128: + case GL_BARCODE_STYLE_128C: + case GL_BARCODE_STYLE_128B: + case GL_BARCODE_STYLE_I25: + case GL_BARCODE_STYLE_CBR: + case GL_BARCODE_STYLE_MSI: + case GL_BARCODE_STYLE_PLS: + return g_strdup ("0000000000"); + default: + return g_strdup ("0"); + } + +} + +/*****************************************************************************/ +/* Convert style to text. */ +/*****************************************************************************/ +const gchar * +gl_barcode_style_to_text (glBarcodeStyle style) +{ + switch (style) { + case GL_BARCODE_STYLE_POSTNET: + return "POSTNET"; + case GL_BARCODE_STYLE_EAN: + return "EAN"; + case GL_BARCODE_STYLE_UPC: + return "UPC"; + case GL_BARCODE_STYLE_ISBN: + return "ISBN"; + case GL_BARCODE_STYLE_39: + return "Code39"; + case GL_BARCODE_STYLE_128: + return "Code128"; + case GL_BARCODE_STYLE_128C: + return "Code128C"; + case GL_BARCODE_STYLE_128B: + return "Code128B"; + case GL_BARCODE_STYLE_I25: + return "I25"; + case GL_BARCODE_STYLE_CBR: + return "CBR"; + case GL_BARCODE_STYLE_MSI: + return "MSI"; + case GL_BARCODE_STYLE_PLS: + return "PLS"; + default: + g_warning( "Illegal barcode style %d", style ); + return "?"; + } +} + +/*****************************************************************************/ +/* Convert text to style. */ +/*****************************************************************************/ +glBarcodeStyle +gl_barcode_text_to_style (const gchar * text) +{ + + if (g_strcasecmp (text, "POSTNET") == 0) { + return GL_BARCODE_STYLE_POSTNET; + } + if (g_strcasecmp (text, "EAN") == 0) { + return GL_BARCODE_STYLE_EAN; + } + if (g_strcasecmp (text, "UPC") == 0) { + return GL_BARCODE_STYLE_UPC; + } + if (g_strcasecmp (text, "ISBN") == 0) { + return GL_BARCODE_STYLE_ISBN; + } + if (g_strcasecmp (text, "Code39") == 0) { + return GL_BARCODE_STYLE_39; + } + if (g_strcasecmp (text, "Code128") == 0) { + return GL_BARCODE_STYLE_128; + } + if (g_strcasecmp (text, "Code128C") == 0) { + return GL_BARCODE_STYLE_128C; + } + if (g_strcasecmp (text, "Code128B") == 0) { + return GL_BARCODE_STYLE_128B; + } + if (g_strcasecmp (text, "I25") == 0) { + return GL_BARCODE_STYLE_I25; + } + if (g_strcasecmp (text, "CBR") == 0) { + return GL_BARCODE_STYLE_CBR; + } + if (g_strcasecmp (text, "MSI") == 0) { + return GL_BARCODE_STYLE_MSI; + } + if (g_strcasecmp (text, "PLS") == 0) { + return GL_BARCODE_STYLE_PLS; + } else { + g_warning( "Unknown barcode style text \"%s\"", text ); + return GL_BARCODE_STYLE_POSTNET; + } + +} diff --git a/glabels2/src/bc.h b/glabels2/src/bc.h new file mode 100644 index 0000000..01b3b89 --- /dev/null +++ b/glabels2/src/bc.h @@ -0,0 +1,73 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc.h: GLabels barcode module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_H__ +#define __BC_H__ + +#include <glib.h> + +typedef enum { + GL_BARCODE_STYLE_POSTNET, + GL_BARCODE_STYLE_EAN, + GL_BARCODE_STYLE_UPC, + GL_BARCODE_STYLE_ISBN, + GL_BARCODE_STYLE_39, + GL_BARCODE_STYLE_128, + GL_BARCODE_STYLE_128C, + GL_BARCODE_STYLE_128B, + GL_BARCODE_STYLE_I25, + GL_BARCODE_STYLE_128RAW, + GL_BARCODE_STYLE_CBR, + GL_BARCODE_STYLE_MSI, + GL_BARCODE_STYLE_PLS, +} glBarcodeStyle; + +typedef struct { + gdouble x, y, length, width; +} glBarcodeLine; + +typedef struct { + gdouble x, y, fsize; + gchar c; +} glBarcodeChar; + +typedef struct { + gdouble width, height; + GList *lines; /* List of glBarcodeLine */ + GList *chars; /* List of glBarcodeChar */ +} glBarcode; + +#define GL_BARCODE_FONT_FAMILY "Helvetica" +#define GL_BARCODE_FONT_WEIGHT GNOME_FONT_BOOK + +extern glBarcode *gl_barcode_new (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits); + +extern void + gl_barcode_free (glBarcode ** bc); + +extern gchar *gl_barcode_default_digits (glBarcodeStyle style); +extern const gchar *gl_barcode_style_to_text (glBarcodeStyle style); +extern glBarcodeStyle gl_barcode_text_to_style (const gchar * text); + +#endif diff --git a/glabels2/src/bonobo-mdi-child.c b/glabels2/src/bonobo-mdi-child.c new file mode 100644 index 0000000..09dd381 --- /dev/null +++ b/glabels2/src/bonobo-mdi-child.c @@ -0,0 +1,316 @@ +/* + * bonobo-mdi-child.c - implementation of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +#include "bonobo-mdi-child.h" + +struct _BonoboMDIChildPrivate +{ + GObject *parent; + + gchar *name; + GList *views; +}; + +enum { + NAME_CHANGED, + LAST_SIGNAL +}; + +static void bonobo_mdi_child_class_init (BonoboMDIChildClass *klass); +static void bonobo_mdi_child_instance_init (BonoboMDIChild *); +static void bonobo_mdi_child_finalize (GObject *); + +static GtkWidget *bonobo_mdi_child_set_label (BonoboMDIChild *, GtkWidget *, gpointer); +static GtkWidget *bonobo_mdi_child_create_view (BonoboMDIChild *); + +static void bonobo_mdi_child_real_name_changed (BonoboMDIChild *child, gchar* old_name); + +static GObjectClass *parent_class = NULL; +static guint mdi_child_signals [LAST_SIGNAL] = { 0 }; + +GType +bonobo_mdi_child_get_type (void) +{ + static GType bonobo_mdi_child_type = 0; + + if (bonobo_mdi_child_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (BonoboMDIChildClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) bonobo_mdi_child_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (BonoboMDIChild), + 0, /* n_preallocs */ + (GInstanceInitFunc) bonobo_mdi_child_instance_init + }; + + bonobo_mdi_child_type = g_type_register_static (G_TYPE_OBJECT, + "BonoboMDIChild", + &our_info, + 0); + } + + return bonobo_mdi_child_type; +} + +static void +bonobo_mdi_child_class_init (BonoboMDIChildClass *klass) +{ + GObjectClass *gobject_class; + + parent_class = g_type_class_peek_parent (klass); + + gobject_class = (GObjectClass*)klass; + + gobject_class->finalize = bonobo_mdi_child_finalize; + + klass->create_view = NULL; + klass->get_config_string = NULL; + klass->set_label = bonobo_mdi_child_set_label; + + klass->name_changed = bonobo_mdi_child_real_name_changed; + + mdi_child_signals[NAME_CHANGED] = + g_signal_new ("name_changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (BonoboMDIChildClass, name_changed), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, + G_TYPE_STRING); +} + +static void +bonobo_mdi_child_instance_init (BonoboMDIChild *mdi_child) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + + mdi_child->priv = g_new0 (BonoboMDIChildPrivate, 1); + + mdi_child->priv->name = NULL; + mdi_child->priv->parent = NULL; + mdi_child->priv->views = NULL; +} + + +/* the default set_label function: returns a GtkLabel with child->priv->name + * if you provide your own, it should return a new widget if its old_label + * parameter is NULL and modify and return the old widget otherwise. it + * should (obviously) NOT call the parent class handler! + */ +static GtkWidget * +bonobo_mdi_child_set_label (BonoboMDIChild *child, GtkWidget *old_label, gpointer data) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), NULL); + g_return_val_if_fail (child->priv != NULL, NULL); + + if (old_label != NULL) + { + gtk_label_set_text (GTK_LABEL (old_label), child->priv->name); + return old_label; + } + else + { + GtkWidget *label; + + label = gtk_label_new (child->priv->name); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + + return label; + } +} + +static void +bonobo_mdi_child_finalize (GObject *obj) +{ + BonoboMDIChild *mdi_child; + + g_return_if_fail (BONOBO_IS_MDI_CHILD (obj)); + + mdi_child = BONOBO_MDI_CHILD (obj); + g_return_if_fail (mdi_child->priv != NULL); + + while (mdi_child->priv->views) + bonobo_mdi_child_remove_view (mdi_child, + GTK_WIDGET (mdi_child->priv->views->data)); + + if (mdi_child->priv->name != NULL) + g_free (mdi_child->priv->name); + + if (mdi_child->priv != NULL) + g_free (mdi_child->priv); + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize)(obj); +} + +/** + * bonobo_mdi_child_add_view: + * @mdi_child: A pointer to a BonoboMDIChild object. + * + * Description: + * Creates a new view of a child (a GtkWidget) adds it to the list + * of the views and returns a pointer to it. Virtual function + * that has to be specified for classes derived from BonoboMDIChild + * is used to create the new view. + * + * Return value: + * A pointer to the new view. + **/ +GtkWidget * +bonobo_mdi_child_add_view (BonoboMDIChild *mdi_child) +{ + GtkWidget *view = NULL; + + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + view = bonobo_mdi_child_create_view (mdi_child); + + if (view) { + mdi_child->priv->views = g_list_append (mdi_child->priv->views, view); + + g_object_set_data (G_OBJECT (view), "BonoboMDIChild", mdi_child); + } + + return view; +} + +/** + * bonobo_mdi_child_remove_view: + * @mdi_child: A pointer to a BonoboMDIChild object. + * @view: View to be removed. + * + * Description: + * Removes view @view from the list of @mdi_child's views and + * unrefs it. + **/ +void +bonobo_mdi_child_remove_view (BonoboMDIChild *mdi_child, GtkWidget *view) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + g_return_if_fail (mdi_child->priv != NULL); + g_return_if_fail (GTK_IS_WIDGET (view)); + + mdi_child->priv->views = g_list_remove (mdi_child->priv->views, view); + + g_object_unref (G_OBJECT (view)); +} + +/** + * bonobo_mdi_child_set_name: + * @mdi_child: A pointer to a BonoboMDIChild object. + * @name: String containing the new name for the child. + * + * Description: + * Changes name of @mdi_child to @name. @name is duplicated and stored + * in @mdi_child. If @mdi_child has already been added to BonoboMDI, + * it also takes care of updating it. + **/ +void +bonobo_mdi_child_set_name (BonoboMDIChild *mdi_child, const gchar *name) +{ + gchar *old_name; + + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + g_return_if_fail (mdi_child->priv != NULL); + + old_name = mdi_child->priv->name; + + if (old_name == name) + return; + + mdi_child->priv->name = (gchar *)g_strdup (name); + + g_signal_emit (G_OBJECT (mdi_child), + mdi_child_signals [NAME_CHANGED], 0, + old_name); + + if (old_name) + g_free (old_name); +} + +static GtkWidget * +bonobo_mdi_child_create_view (BonoboMDIChild *child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), NULL); + + if (BONOBO_MDI_CHILD_GET_CLASS (child)->create_view) + return BONOBO_MDI_CHILD_GET_CLASS (child)->create_view (child, NULL); + + return NULL; +} + +static void +bonobo_mdi_child_real_name_changed (BonoboMDIChild *child, gchar* old_name) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (child)); + + return; +} + +gchar * +bonobo_mdi_child_get_name (const BonoboMDIChild *mdi_child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + if (mdi_child->priv->name) + return g_strdup (mdi_child->priv->name); + else + return NULL; +} + +GList * +bonobo_mdi_child_get_views (const BonoboMDIChild *mdi_child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + return mdi_child->priv->views; +} + +GObject * +bonobo_mdi_child_get_parent (const BonoboMDIChild *mdi_child) +{ + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (mdi_child), NULL); + g_return_val_if_fail (mdi_child->priv != NULL, NULL); + + return G_OBJECT (mdi_child->priv->parent); + +} + +void +bonobo_mdi_child_set_parent (BonoboMDIChild *mdi_child, GObject *parent) +{ + g_return_if_fail (BONOBO_IS_MDI_CHILD (mdi_child)); + g_return_if_fail (mdi_child->priv != NULL); + + mdi_child->priv->parent = parent; +} diff --git a/glabels2/src/bonobo-mdi-child.h b/glabels2/src/bonobo-mdi-child.h new file mode 100644 index 0000000..49d9b66 --- /dev/null +++ b/glabels2/src/bonobo-mdi-child.h @@ -0,0 +1,101 @@ +/* + * bonobo-mdi-child.h - definition of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +#ifndef _BONOBO_MDI_CHILD_H_ +#define _BONOBO_MDI_CHILD_H_ + +#include <gtk/gtk.h> +#include <bonobo/bonobo-window.h> + +#define BONOBO_TYPE_MDI_CHILD (bonobo_mdi_child_get_type ()) +#define BONOBO_MDI_CHILD(obj) (GTK_CHECK_CAST ((obj), BONOBO_TYPE_MDI_CHILD, BonoboMDIChild)) +#define BONOBO_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_MDI_CHILD, BonoboMDIChildClass)) +#define BONOBO_IS_MDI_CHILD(obj) (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_MDI_CHILD)) +#define BONOBO_IS_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_MDI_CHILD)) +#define BONOBO_MDI_CHILD_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), BONOBO_TYPE_MDI_CHILD, BonoboMDIChildClass)) + +/* BonoboMDIChild + * is an abstract class. In order to use it, you have to either derive a + * new class from it and set the proper virtual functions in its parent + * BonoboMDIChildClass structure or use the BonoboMDIGenericChild class + * that allows to specify the relevant functions on a per-instance basis + * and can directly be used with BonoboMDI. + */ + +typedef struct _BonoboMDIChildPrivate BonoboMDIChildPrivate; + +typedef struct +{ + GObject object; + + BonoboMDIChildPrivate *priv; +} BonoboMDIChild; + + +typedef GtkWidget *(*BonoboMDIChildViewCreator) (BonoboMDIChild *, gpointer); +typedef GList *(*BonoboMDIChildMenuCreator) (BonoboMDIChild *, GtkWidget *, gpointer); +typedef gchar *(*BonoboMDIChildConfigFunc) (BonoboMDIChild *, gpointer); +typedef GtkWidget *(*BonoboMDIChildLabelFunc) (BonoboMDIChild *, GtkWidget *, gpointer); + +/* + * Note that if you override the set_label virtual function, it should return + * a new widget if its GtkWidget* parameter is NULL and modify and return the + * old widget otherwise. + * (see bonobo-mdi-child.c/bonobo_mdi_child_set_book_label() for an example). + */ + +typedef struct +{ + GObjectClass parent_class; + + /* Virtual functions */ + BonoboMDIChildViewCreator create_view; + BonoboMDIChildConfigFunc get_config_string; + BonoboMDIChildLabelFunc set_label; + + void (* name_changed) (BonoboMDIChild *mdi_child, gchar* old_name); + +} BonoboMDIChildClass; + +GType bonobo_mdi_child_get_type (void) G_GNUC_CONST; + +GtkWidget *bonobo_mdi_child_add_view (BonoboMDIChild *mdi_child); +void bonobo_mdi_child_remove_view (BonoboMDIChild *mdi_child, + GtkWidget *view); + +GList *bonobo_mdi_child_get_views (const BonoboMDIChild *mdi_child); + +void bonobo_mdi_child_set_name (BonoboMDIChild *mdi_child, + const gchar *name); +gchar *bonobo_mdi_child_get_name (const BonoboMDIChild *mdi_child); + +void bonobo_mdi_child_set_parent (BonoboMDIChild *mdi_child, + GObject *parent); +GObject *bonobo_mdi_child_get_parent (const BonoboMDIChild *mdi_child); + +G_END_DECLS + +#endif /* _BONOBO_MDI_CHILD_H_ */ + + + diff --git a/glabels2/src/bonobo-mdi.c b/glabels2/src/bonobo-mdi.c new file mode 100644 index 0000000..fb30969 --- /dev/null +++ b/glabels2/src/bonobo-mdi.c @@ -0,0 +1,2197 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * bonobo-mdi.c - implementation of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +/* + * Modified by the gedit Team, 2001-2002. See the AUTHORS file for a + * list of people on the gedit Team. + * See the ChangeLog files for a list of changes. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "bonobo-mdi.h" + +#include <bonobo/bonobo-i18n.h> +#include <marshal.h> +#include <bonobo/bonobo-dock-layout.h> +#include <bonobo/bonobo-ui-util.h> + +#include "debug.h" + +#include <string.h> +#include <time.h> +#include <unistd.h> + +#define BONOBO_MDI_KEY "BonoboMDI" +#define BONOBO_MDI_CHILD_KEY "BonoboMDIChild" +#define UI_COMPONENT_KEY "UIComponent" +#define BOOK_KEY "Book" +#define WINDOW_INFO_KEY "BonoboMDIWindowInfo" + +static void bonobo_mdi_class_init (BonoboMDIClass *); +static void bonobo_mdi_instance_init (BonoboMDI *); +static void bonobo_mdi_finalize (GObject *); +static void child_list_menu_create (BonoboMDI *, BonoboWindow *); + +static void child_list_activated_cb (BonoboUIComponent *uic, gpointer user_data, + const gchar* verbname); + +void child_list_menu_remove_item(BonoboMDI *, BonoboMDIChild *); +void child_list_menu_add_item (BonoboMDI *, BonoboMDIChild *); + +static void app_create (BonoboMDI *, gchar *, const char *); +static void app_clone (BonoboMDI *, BonoboWindow *, const char *); +static void app_destroy (BonoboWindow *, BonoboMDI *); +static void app_set_view (BonoboMDI *, BonoboWindow *, GtkWidget *); + +static gboolean app_close_book (BonoboWindow *, GdkEventAny *, BonoboMDI *); + +static GtkWidget *book_create (BonoboMDI *); +static void book_switch_page (GtkNotebook *, GtkNotebookPage *, + gint, BonoboMDI *); +static gboolean book_motion (GtkWidget *widget, GdkEventMotion *e, + gpointer data); +static gboolean book_button_press (GtkWidget *widget, GdkEventButton *e, + gpointer data); +static gboolean book_button_release (GtkWidget *widget, GdkEventButton *e, + gpointer data); +static void book_add_view (GtkNotebook *, GtkWidget *); +static void set_page_by_widget (GtkNotebook *, GtkWidget *); + +static gboolean toplevel_focus (BonoboWindow *, GdkEventFocus *, BonoboMDI *); + +static void set_active_view (BonoboMDI *, GtkWidget *); + +/* convenience functions that call child's "virtual" functions */ +static GtkWidget *child_set_label (BonoboMDIChild *, GtkWidget *); + +static void child_name_changed (BonoboMDIChild *mdi_child, + gchar* old_name, + BonoboMDI *mdi); +static void bonobo_mdi_update_child (BonoboMDI *mdi, BonoboMDIChild *child); + +static gchar* escape_underscores (const gchar* text); + +static GtkWidget* get_book_from_window (BonoboWindow *window); + +static GdkCursor *drag_cursor = NULL; + +enum { + ADD_CHILD, + REMOVE_CHILD, + ADD_VIEW, + REMOVE_VIEW, + CHILD_CHANGED, + VIEW_CHANGED, + TOP_WINDOW_CREATED, + TOP_WINDOW_DESTROY, + ALL_WINDOWS_DESTROYED, + LAST_SIGNAL +}; + + +struct _BonoboMDIPrivate +{ + GtkPositionType tab_pos; + + guint signal_id; + gint in_drag : 1; + + gchar *mdi_name; + gchar *title; + + gchar *ui_xml; + gchar *ui_file_name; + BonoboUIVerb *verbs; + + /* Probably only one of these would do, but... redundancy rules ;) */ + BonoboMDIChild *active_child; + GtkWidget *active_view; + BonoboWindow *active_window; + + GList *windows; /* toplevel windows - BonoboWindow widgets */ + GList *children; /* children - BonoboMDIChild objects*/ + + GSList *registered; /* see comment for bonobo_mdi_(un)register() functions + * below for an explanation. */ + + /* Paths for insertion of mdi-child list menu via */ + gchar *child_list_path; + + gint default_window_height; + gint default_window_width; +}; + +typedef gboolean (*BonoboMDISignal1) (GObject *, gpointer, gpointer); +typedef void (*BonoboMDISignal2) (GObject *, gpointer, gpointer); + +static GObjectClass *parent_class = NULL; +static guint mdi_signals [LAST_SIGNAL] = { 0 }; + +GType +bonobo_mdi_get_type (void) +{ + static GType bonobo_mdi_type = 0; + + if (bonobo_mdi_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (BonoboMDIClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) bonobo_mdi_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (BonoboMDI), + 0, /* n_preallocs */ + (GInstanceInitFunc) bonobo_mdi_instance_init + }; + + bonobo_mdi_type = g_type_register_static (G_TYPE_OBJECT, + "BonoboMDI", + &our_info, + 0); + } + + return bonobo_mdi_type; +} + +static void +bonobo_mdi_class_init (BonoboMDIClass *class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass*) class; + + object_class->finalize = bonobo_mdi_finalize; + + mdi_signals[ADD_CHILD] = + g_signal_new ("add_child", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, add_child), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + BONOBO_TYPE_MDI_CHILD); + + mdi_signals[REMOVE_CHILD] = + g_signal_new ("remove_child", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, remove_child), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + BONOBO_TYPE_MDI_CHILD); + + mdi_signals[ADD_VIEW] = + g_signal_new ("add_view", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, add_view), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + GTK_TYPE_WIDGET); + + mdi_signals[REMOVE_VIEW] = + g_signal_new ("remove_view", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, remove_view), + NULL, NULL, + gl_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, + 1, + GTK_TYPE_WIDGET); + + mdi_signals[CHILD_CHANGED] = + g_signal_new ("child_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, child_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + BONOBO_TYPE_MDI_CHILD); + + mdi_signals[VIEW_CHANGED] = + g_signal_new ("view_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BonoboMDIClass, view_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + GTK_TYPE_WIDGET); + + mdi_signals[TOP_WINDOW_CREATED] = + g_signal_new ("top_window_created", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, top_window_created), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + BONOBO_TYPE_WINDOW); + + mdi_signals[TOP_WINDOW_DESTROY] = + g_signal_new ("top_window_destroy", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, top_window_destroy), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + BONOBO_TYPE_WINDOW); + + mdi_signals[ALL_WINDOWS_DESTROYED] = + g_signal_new ("all_windows_destroyed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BonoboMDIClass, all_windows_destroyed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + + class->add_child = NULL; + class->remove_child = NULL; + class->add_view = NULL; + class->remove_view = NULL; + class->child_changed = NULL; + class->view_changed = NULL; + class->top_window_created = NULL; + + parent_class = gtk_type_class (G_TYPE_OBJECT); +} + +static void +bonobo_mdi_finalize (GObject *object) +{ + BonoboMDI *mdi; + + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (BONOBO_IS_MDI (object)); + + mdi = BONOBO_MDI (object); + g_return_if_fail (mdi->priv != NULL); + + bonobo_mdi_remove_all (mdi, TRUE); + + if (mdi->priv->child_list_path != NULL) + g_free (mdi->priv->child_list_path); + + if (mdi->priv->mdi_name != NULL) + g_free (mdi->priv->mdi_name); + + if (mdi->priv->title != NULL) + g_free (mdi->priv->title); + + if (mdi->priv->ui_xml != NULL) + g_free (mdi->priv->ui_xml); + + if (mdi->priv->ui_file_name != NULL) + g_free (mdi->priv->ui_file_name); + + g_free (mdi->priv); + mdi->priv = NULL; + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize)(object); + + gl_debug (DEBUG_MDI, "END"); +} + + +static void +bonobo_mdi_instance_init (BonoboMDI *mdi) +{ + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (BONOBO_IS_MDI (mdi)); + + mdi->priv = g_new0 (BonoboMDIPrivate, 1); + g_return_if_fail (mdi->priv != NULL); + + mdi->priv->tab_pos = GTK_POS_TOP; + + mdi->priv->signal_id = 0; + mdi->priv->in_drag = FALSE; + + mdi->priv->children = NULL; + mdi->priv->windows = NULL; + mdi->priv->registered = NULL; + + mdi->priv->active_child = NULL; + mdi->priv->active_window = NULL; + mdi->priv->active_view = NULL; + + mdi->priv->ui_xml = NULL; + mdi->priv->ui_file_name = NULL; + mdi->priv->verbs = NULL; + + mdi->priv->child_list_path = NULL; + + gl_debug (DEBUG_MDI, "END"); +} + + +/** + * bonobo_mdi_new: + * @mdi_name: Application name as used in filenames and paths. + * @title: Title of the application windows. + * + * Description: + * Creates a new MDI object. @mdi_name and @title are used for + * MDI's calling bonobo_window_new (). + * + * Return value: + * A pointer to a new BonoboMDI object. + **/ +GObject* +bonobo_mdi_new (const gchar *mdi_name, const gchar *title, + gint default_window_width, gint default_window_height) +{ + BonoboMDI *mdi; + + gl_debug (DEBUG_MDI, ""); + + mdi = g_object_new (BONOBO_TYPE_MDI, NULL); + + mdi->priv->mdi_name = g_strdup (mdi_name); + mdi->priv->title = g_strdup (title); + + mdi->priv->default_window_width = default_window_width; + mdi->priv->default_window_height = default_window_height; + + gl_debug (DEBUG_MDI, "END"); + + return G_OBJECT (mdi); +} + +static GtkWidget * +child_set_label (BonoboMDIChild *child, GtkWidget *label) +{ + GtkWidget *w; + w = BONOBO_MDI_CHILD_GET_CLASS (child)->set_label (child, label, NULL); + + return w; +} + +static void +set_page_by_widget (GtkNotebook *book, GtkWidget *view) +{ + gint i; + + i = gtk_notebook_page_num (book, view); + + if (gtk_notebook_get_current_page (book) != i) + gtk_notebook_set_current_page (book, i); +} + +static void +child_list_activated_cb (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname) +{ + BonoboMDI* mdi; + BonoboMDIChild *child = BONOBO_MDI_CHILD (user_data); + g_return_if_fail (child != NULL); + + gl_debug (DEBUG_MDI, ""); + + mdi = BONOBO_MDI (g_object_get_data (G_OBJECT (child), BONOBO_MDI_KEY)); + g_return_if_fail (mdi != NULL); + + if (child && (child != mdi->priv->active_child)) + { + GList *views = bonobo_mdi_child_get_views (child); + + if (views) + bonobo_mdi_set_active_view (mdi, views->data); + else + bonobo_mdi_add_view (mdi, child); + } + + gl_debug (DEBUG_MDI, "END"); +} + +static gchar* +escape_underscores (const gchar* text) +{ + GString *str; + gint length; + const gchar *p; + const gchar *end; + + g_return_val_if_fail (text != NULL, NULL); + + length = strlen (text); + + str = g_string_new (""); + + p = text; + end = text + length; + + while (p != end) + { + const gchar *next; + next = g_utf8_next_char (p); + + switch (*p) + { + case '_': + g_string_append (str, "__"); + break; + default: + g_string_append_len (str, p, next - p); + break; + } + + p = next; + } + + return g_string_free (str, FALSE); +} + +static void +child_list_menu_create (BonoboMDI *mdi, BonoboWindow *win) +{ + GList *child; + BonoboUIComponent *ui_component; + + if (mdi->priv->child_list_path == NULL) + return; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win), UI_COMPONENT_KEY)); + + child = mdi->priv->children; + + bonobo_ui_component_freeze (ui_component, NULL); + + while (child) + { + gchar *xml = NULL; + gchar *cmd = NULL; + gchar *verb_name = NULL; + gchar *tip; + gchar *escaped_name; + gchar *safe_name; + gchar *child_name = bonobo_mdi_child_get_name (BONOBO_MDI_CHILD (child->data)); + + safe_name = g_markup_escape_text (child_name, strlen (child_name)); + g_return_if_fail (safe_name != NULL); + + escaped_name = escape_underscores (safe_name); + g_return_if_fail (escaped_name != NULL); + + tip = g_strdup_printf (_("Activate %s"), safe_name); + verb_name = g_strdup_printf ("Child_%p", child->data); + xml = g_strdup_printf ("<menuitem name=\"%s\" verb=\"%s\"" + " _label=\"%s\"/>", verb_name, verb_name, escaped_name); + cmd = g_strdup_printf ("<cmd name = \"%s\" _label=\"%s\"" + " _tip=\"%s\"/>", verb_name, escaped_name, tip); + + g_free (tip); + g_free (child_name); + g_free (safe_name); + g_free (escaped_name); + + bonobo_ui_component_set_translate (ui_component, mdi->priv->child_list_path, xml, NULL); + bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL); + bonobo_ui_component_add_verb (ui_component, verb_name, child_list_activated_cb, child->data); + + g_free (xml); + g_free (cmd); + g_free (verb_name); + + child = g_list_next (child); + } + + bonobo_ui_component_thaw (ui_component, NULL); +} + + +void +child_list_menu_remove_item (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GList *win_node; + gchar *path, *cmd, *verb_name; + + gl_debug (DEBUG_MDI, ""); + + if(mdi->priv->child_list_path == NULL) + return; + + win_node = mdi->priv->windows; + + verb_name = g_strdup_printf ("Child_%p", child); + path = g_strdup_printf ("%s%s", mdi->priv->child_list_path, verb_name); + cmd = g_strdup_printf ("/commands/%s", verb_name); + + while (win_node) + { + BonoboUIComponent *ui_component; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win_node->data), UI_COMPONENT_KEY)); + + bonobo_ui_component_remove_verb (ui_component, verb_name); + bonobo_ui_component_rm (ui_component, path, NULL); + bonobo_ui_component_rm (ui_component, cmd, NULL); + win_node = g_list_next (win_node); + } + + g_free (path); + g_free (cmd); + g_free (verb_name); + + gl_debug (DEBUG_MDI, "END"); +} + + +void +child_list_menu_add_item (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GList *win_node; + gchar *child_name, *escaped_name, *safe_name; + gchar* xml, *cmd, *verb_name, *tip; + int accel_num; + + if(mdi->priv->child_list_path == NULL) + return; + + accel_num = g_list_length (mdi->priv->children); + + win_node = mdi->priv->windows; + + child_name = bonobo_mdi_child_get_name (child); + + safe_name = g_markup_escape_text (child_name, strlen (child_name)); + g_return_if_fail (safe_name != NULL); + + escaped_name = escape_underscores (safe_name); + g_return_if_fail (escaped_name != NULL); + + verb_name = g_strdup_printf ("Child_%p", child); + + tip = g_strdup_printf (_("Activate %s"), safe_name); + xml = g_strdup_printf ("<menuitem name=\"%s\" verb=\"%s\"" + " _label=\"%s\"/>", verb_name, verb_name, escaped_name); + + if (accel_num > 9) + cmd = g_strdup_printf ("<cmd name = \"%s\" _label=\"%s\"" + " _tip=\"%s\"/>", verb_name, escaped_name, tip); + else + cmd = g_strdup_printf ("<cmd name = \"%s\" _label=\"%s\"" + " _tip=\"%s\" accel=\"*Alt*%d\"/>", verb_name, + escaped_name, tip, accel_num); + + + while (win_node) + { + BonoboUIComponent *ui_component; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win_node->data), UI_COMPONENT_KEY)); + + + bonobo_ui_component_set_translate (ui_component, mdi->priv->child_list_path, xml, NULL); + bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL); + bonobo_ui_component_add_verb (ui_component, verb_name, child_list_activated_cb, child); + + win_node = g_list_next (win_node); + } + + g_free (tip); + g_free (escaped_name); + g_free (child_name); + g_free (xml); + g_free (cmd); + g_free (verb_name); + g_free (safe_name); +} + +static gboolean +book_motion (GtkWidget *widget, GdkEventMotion *e, gpointer data) +{ + BonoboMDI *mdi; + + mdi = BONOBO_MDI (data); + + if (!drag_cursor) + drag_cursor = gdk_cursor_new (GDK_HAND2); + + if (e->window == GTK_NOTEBOOK (widget)->event_window) + { + mdi->priv->in_drag = TRUE; + gtk_grab_add (widget); + gdk_pointer_grab (widget->window, FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK, NULL, + drag_cursor, GDK_CURRENT_TIME); + if (mdi->priv->signal_id) + { + g_signal_handler_disconnect (G_OBJECT (widget), + mdi->priv->signal_id); + mdi->priv->signal_id = 0; + } + } + + return FALSE; +} + +static gboolean +book_button_press (GtkWidget *widget, GdkEventButton *e, gpointer data) +{ + BonoboMDI *mdi; + + mdi = BONOBO_MDI (data); + + if ((e->button == 1) && (e->window == GTK_NOTEBOOK (widget)->event_window)) + mdi->priv->signal_id = g_signal_connect ( + G_OBJECT (widget), + "motion_notify_event", + G_CALLBACK (book_motion), + mdi); + + return FALSE; +} + +static gboolean +book_button_release (GtkWidget *widget, GdkEventButton *e, gpointer data) +{ + gint x = e->x_root, y = e->y_root; + BonoboMDI *mdi; + + mdi = BONOBO_MDI(data); + + if (mdi->priv->signal_id) + { + g_signal_handler_disconnect (G_OBJECT (widget), mdi->priv->signal_id); + mdi->priv->signal_id = 0; + } + + if ((e->button == 1) && mdi->priv->in_drag) + { + GdkWindow *window; + GList *child; + BonoboWindow *win; + GtkWidget *view, *new_book; + GtkNotebook *old_book = GTK_NOTEBOOK (widget); + + mdi->priv->in_drag = FALSE; + gdk_pointer_ungrab (GDK_CURRENT_TIME); + gtk_grab_remove (widget); + + window = gdk_window_at_pointer (&x, &y); + if (window) + window = gdk_window_get_toplevel (window); + + child = mdi->priv->windows; + + while (child) + { + if (window == GTK_WIDGET (child->data)->window) + { + int cur_page; + + /* page was dragged to another notebook */ + + old_book = GTK_NOTEBOOK(widget); + new_book = get_book_from_window (BONOBO_WINDOW (child->data)); + + if (old_book == (GtkNotebook *) new_book) + /* page has been dropped on the source notebook */ + return FALSE; + + cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (old_book)); + + if (cur_page >= 0) + { + view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (old_book), cur_page); + gtk_container_remove (GTK_CONTAINER(old_book), view); + + book_add_view (GTK_NOTEBOOK (new_book), view); + + win = bonobo_mdi_get_window_from_view (view); + gdk_window_raise (GTK_WIDGET(win)->window); + + mdi->priv->active_window = win; + + cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (old_book)); + + if (cur_page < 0) + { + mdi->priv->active_window = win; + win = BONOBO_WINDOW (gtk_widget_get_toplevel ( + GTK_WIDGET (old_book))); + mdi->priv->windows = g_list_remove(mdi->priv->windows, win); + gtk_widget_destroy (GTK_WIDGET (win)); + } + + g_signal_emit (G_OBJECT (mdi), + mdi_signals [CHILD_CHANGED], + 0, + NULL); + + g_signal_emit (G_OBJECT (mdi), + mdi_signals [VIEW_CHANGED], + 0, + view); + } + + return FALSE; + } + + child = child->next; + } + + if (g_list_length (old_book->children) == 1) + return FALSE; + + /* create a new toplevel */ + if (old_book->cur_page) + { + gint width, height; + int cur_page = gtk_notebook_get_current_page (old_book); + + view = gtk_notebook_get_nth_page (old_book, cur_page); + + win = bonobo_mdi_get_window_from_view (view); + + gtk_window_get_size (GTK_WINDOW (win), &width, &height); + + gtk_container_remove (GTK_CONTAINER (old_book), view); + + app_clone (mdi, win, NULL); + + new_book = book_create (mdi); + + book_add_view (GTK_NOTEBOOK (new_book), view); + + gtk_window_set_position (GTK_WINDOW (mdi->priv->active_window), GTK_WIN_POS_MOUSE); + + gtk_window_set_default_size (GTK_WINDOW (mdi->priv->active_window), width, height); + + if (!GTK_WIDGET_VISIBLE (mdi->priv->active_window)) + gtk_widget_show (GTK_WIDGET (mdi->priv->active_window)); + } + } + + return FALSE; +} + +static GtkWidget * +book_create (BonoboMDI *mdi) +{ + GtkWidget *us; + GtkWidget *vbox; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi->priv->active_window != NULL, NULL); + + vbox = gtk_vbox_new (FALSE, 0); + us = gtk_notebook_new (); + + gtk_notebook_set_tab_pos (GTK_NOTEBOOK (us), mdi->priv->tab_pos); + + gtk_box_pack_start (GTK_BOX (vbox), us, TRUE, TRUE, 0); + + gtk_widget_show_all (vbox); + + bonobo_window_set_contents (mdi->priv->active_window, vbox); + g_object_set_data (G_OBJECT (mdi->priv->active_window), BOOK_KEY, us); + + gtk_widget_add_events (us, GDK_BUTTON1_MOTION_MASK); + + g_signal_connect (G_OBJECT (us), "switch_page", + G_CALLBACK (book_switch_page), mdi); + + g_signal_connect (G_OBJECT (us), "button_press_event", + G_CALLBACK (book_button_press), mdi); + g_signal_connect (G_OBJECT (us), "button_release_event", + G_CALLBACK (book_button_release), mdi); + + gtk_notebook_set_scrollable (GTK_NOTEBOOK (us), TRUE); + + gl_debug (DEBUG_MDI, "END"); + + return us; +} + +static void +book_add_view (GtkNotebook *book, GtkWidget *view) +{ + BonoboMDIChild *child; + GtkWidget *title; + + gl_debug (DEBUG_MDI, ""); + + child = bonobo_mdi_get_child_from_view (view); + + title = child_set_label (child, NULL); + + gtk_notebook_append_page (book, view, title); + + if (g_list_length (book->children) > 1) + set_page_by_widget (book, view); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +book_switch_page (GtkNotebook *book, GtkNotebookPage *pg, gint page_num, BonoboMDI *mdi) +{ + BonoboWindow *win; + GtkWidget *page; + + gl_debug (DEBUG_MDI, ""); + + win = BONOBO_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (book))); + + page = gtk_notebook_get_nth_page (book, page_num); + + if (page != NULL) + { + if (page != mdi->priv->active_view) + app_set_view (mdi, win, page); + } + else + app_set_view (mdi, win, NULL); + + gl_debug (DEBUG_MDI, "END"); + +} + +static GtkWidget* +get_book_from_window (BonoboWindow *window) +{ + gpointer *book; + + g_return_val_if_fail (window != NULL, NULL); + + book = g_object_get_data (G_OBJECT (window), BOOK_KEY); + + return (book != NULL) ? GTK_WIDGET (book) : NULL; +} + +static gboolean +toplevel_focus (BonoboWindow *win, GdkEventFocus *event, BonoboMDI *mdi) +{ + GtkWidget *contents; + + gl_debug (DEBUG_MDI, ""); + + /* updates active_view and active_child when a new toplevel receives focus */ + g_return_val_if_fail (BONOBO_IS_WINDOW (win), FALSE); + + mdi->priv->active_window = win; + + contents = get_book_from_window (win); + + if (GTK_NOTEBOOK (contents)->cur_page) + { + int cur_page; + GtkWidget *child; + + cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (contents)); + child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (contents), cur_page); + set_active_view (mdi, child); + } + else + set_active_view (mdi, NULL); + + gl_debug (DEBUG_MDI, "END"); + + return FALSE; +} + +static gboolean +app_configure_event_handler (GtkWidget *widget, GdkEventConfigure *event) +{ + BonoboMDIWindowInfo *window_info; + + g_return_val_if_fail (BONOBO_IS_WINDOW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + window_info = (BonoboMDIWindowInfo*) + g_object_get_data (G_OBJECT (widget), WINDOW_INFO_KEY); + g_return_val_if_fail (window_info != NULL, FALSE); + + window_info->width = event->width; + window_info->height = event->height; + + return FALSE; +} + +static gboolean +app_window_state_event_handler (GtkWidget *widget, GdkEventWindowState *event) +{ + BonoboMDIWindowInfo *window_info; + + g_return_val_if_fail (BONOBO_IS_WINDOW (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + window_info = (BonoboMDIWindowInfo*) + g_object_get_data (G_OBJECT (widget), WINDOW_INFO_KEY); + g_return_val_if_fail (window_info != NULL, FALSE); + + window_info->state = event->new_window_state; + + return FALSE; +} + + +static void +app_clone (BonoboMDI *mdi, BonoboWindow *win, const char *window_role) +{ + gl_debug (DEBUG_MDI, ""); + + app_create (mdi, NULL, window_role); + + if (win != NULL) + { + const BonoboMDIWindowInfo *window_info = bonobo_mdi_get_window_info (win); + g_return_if_fail (window_info != NULL); + + if ((window_info->state & GDK_WINDOW_STATE_MAXIMIZED) != 0) + gtk_window_maximize (GTK_WINDOW (mdi->priv->active_window)); + else + { + gtk_window_set_default_size (GTK_WINDOW (mdi->priv->active_window), + window_info->width, + window_info->height); + + gtk_window_unmaximize (GTK_WINDOW (mdi->priv->active_window)); + } + + if ((window_info->state & GDK_WINDOW_STATE_STICKY ) != 0) + gtk_window_stick (GTK_WINDOW (mdi->priv->active_window)); + else + gtk_window_unstick (GTK_WINDOW (mdi->priv->active_window)); + } + + gl_debug (DEBUG_MDI, "END"); +} + + +static gboolean +app_close_book (BonoboWindow *win, GdkEventAny *event, BonoboMDI *mdi) +{ + BonoboMDIChild *child; + GtkWidget *view; + gint handler_ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + if (g_list_length (mdi->priv->windows) == 1) + { + if (!bonobo_mdi_remove_all (mdi, FALSE)) + { + gl_debug (DEBUG_MDI, "END1"); + + return TRUE; + } + + mdi->priv->windows = g_list_remove (mdi->priv->windows, win); + gtk_widget_destroy (GTK_WIDGET (win)); + + /* only emit al_windows_destroyed signal if there are no non-MDI windows registered + with it. */ + if (mdi->priv->registered == NULL) + g_signal_emit (G_OBJECT (mdi), mdi_signals [ALL_WINDOWS_DESTROYED], 0); + } + else + { + GList *children = gtk_container_get_children ( + GTK_CONTAINER (get_book_from_window (win))); + GList *li; + + if (children == NULL) + { + mdi->priv->windows = g_list_remove (mdi->priv->windows, win); + gtk_widget_destroy (GTK_WIDGET (win)); + + gl_debug (DEBUG_MDI, "END2"); + + return FALSE; + } + + /* first check if all the children in this notebook can be removed */ + for (li = children; li != NULL; li = li->next) + { + GList *node; + view = li->data; + + child = bonobo_mdi_get_child_from_view (view); + + node = bonobo_mdi_child_get_views (child); + + while (node) + { + if (bonobo_mdi_get_window_from_view (node->data) != win) + break; + + node = node->next; + } + + if (node == NULL) + { + /* all the views reside in this BonoboWindow */ + g_signal_emit (G_OBJECT(mdi), + mdi_signals [REMOVE_CHILD], + 0, + child, + &handler_ret); + + if (handler_ret == FALSE) + { + g_list_free (children); + + gl_debug (DEBUG_MDI, "END3"); + + return TRUE; + } + } + } + + /* now actually remove all children/views! */ + for (li = children; li != NULL; li = li->next) + { + view = li->data; + + child = bonobo_mdi_get_child_from_view (view); + + /* if this is the last view, remove the child */ + if (g_list_length (bonobo_mdi_child_get_views (child)) == 1) + bonobo_mdi_remove_child (mdi, child, TRUE); + else + bonobo_mdi_remove_view (mdi, view, TRUE); + } + + g_list_free (children); + } + + gl_debug (DEBUG_MDI, "END"); + + return FALSE; +} + +static void +app_set_view (BonoboMDI *mdi, BonoboWindow *win, GtkWidget *view) +{ + gl_debug (DEBUG_MDI, ""); + + gtk_window_set_title (GTK_WINDOW (win), mdi->priv->title); + + set_active_view (mdi, view); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +app_destroy (BonoboWindow *win, BonoboMDI *mdi) +{ + gl_debug (DEBUG_MDI, ""); + + if (mdi->priv->active_window == win) + mdi->priv->active_window = + (mdi->priv->windows != NULL) ? BONOBO_WINDOW (mdi->priv->windows->data) : NULL; + + g_signal_emit (G_OBJECT (mdi), mdi_signals [TOP_WINDOW_DESTROY], 0, win); + + gl_debug (DEBUG_MDI, "END"); +} + +/* Generates a unique string for a window role. + * + * Taken from EOG. + */ +static char * +gen_role (void) +{ + char *ret; + static char *hostname; + time_t t; + static int serial; + + t = time (NULL); + + if (!hostname) { + static char buffer [512]; + + if ((gethostname (buffer, sizeof (buffer) - 1) == 0) && + (buffer [0] != 0)) + hostname = buffer; + else + hostname = "localhost"; + } + + ret = g_strdup_printf ("bonobo-mdi-window-%d-%d-%d-%ld-%d@%s", + getpid (), + getgid (), + getppid (), + (long) t, + serial++, + hostname); + + return ret; +} + +static void +app_create (BonoboMDI *mdi, gchar *layout_string, const char *window_role) +{ + GtkWidget *window; + BonoboWindow *bw; + gchar* config_path; + BonoboUIContainer *ui_container = NULL; + BonoboUIComponent *ui_component = NULL; + BonoboMDIWindowInfo *window_info = NULL; + + gl_debug (DEBUG_MDI, ""); + + window = bonobo_window_new (mdi->priv->mdi_name, mdi->priv->title); + g_return_if_fail (window != NULL); + + gtk_window_set_default_size (GTK_WINDOW (window), + mdi->priv->default_window_width, + mdi->priv->default_window_height); + + if (window_role) + gtk_window_set_role (GTK_WINDOW (window), window_role); + else { + char *role; + + role = gen_role (); + gtk_window_set_role (GTK_WINDOW (window), role); + g_free (role); + } + + bw = BONOBO_WINDOW (window); + + mdi->priv->windows = g_list_append (mdi->priv->windows, window); + + g_signal_connect (G_OBJECT (window), "delete_event", + G_CALLBACK (app_close_book), mdi); + g_signal_connect (G_OBJECT (window), "focus_in_event", + G_CALLBACK (toplevel_focus), mdi); + g_signal_connect (G_OBJECT (window), "destroy", + G_CALLBACK (app_destroy), mdi); + g_signal_connect (G_OBJECT (window), "configure_event", + G_CALLBACK (app_configure_event_handler), NULL); + g_signal_connect (G_OBJECT (window), "window_state_event", + G_CALLBACK (app_window_state_event_handler), NULL); + + /* Create Container: */ + ui_container = bonobo_window_get_ui_container (bw); + + config_path = g_strdup_printf ("/%s/UIConfig/kvps", mdi->priv->mdi_name); + + bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (bw), + config_path); + g_free (config_path); + + /* Create a UI component with which to communicate with the window */ + ui_component = bonobo_ui_component_new_default (); + + /* Associate the BonoboUIComponent with the container */ + bonobo_ui_component_set_container ( + ui_component, BONOBO_OBJREF (ui_container), NULL); + + /* set up UI */ + if (mdi->priv->ui_xml != NULL) + { + bonobo_ui_component_set_translate (ui_component, + "/", mdi->priv->ui_xml, NULL); + } + else + if (mdi->priv->ui_file_name) + { + bonobo_ui_util_set_ui (ui_component, "", mdi->priv->ui_file_name, + mdi->priv->mdi_name, NULL); + } + + if (mdi->priv->verbs) + bonobo_ui_component_add_verb_list_with_data (ui_component, + mdi->priv->verbs, mdi); + + mdi->priv->active_window = bw; + mdi->priv->active_child = NULL; + mdi->priv->active_view = NULL; + + window_info = g_new0 (BonoboMDIWindowInfo, 1); + + g_object_set_data (G_OBJECT (bw), UI_COMPONENT_KEY, ui_component); + g_object_set_data_full (G_OBJECT (bw), WINDOW_INFO_KEY, window_info, g_free); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [TOP_WINDOW_CREATED], 0, window); + + child_list_menu_create (mdi, bw); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +set_active_view (BonoboMDI *mdi, GtkWidget *view) +{ + BonoboMDIChild *old_child; + GtkWidget *old_view; + + gl_debug (DEBUG_MDI, ""); + + old_child = mdi->priv->active_child; + old_view = mdi->priv->active_view; + + mdi->priv->active_view = view; + + if (!view) + mdi->priv->active_child = NULL; + else + { + + mdi->priv->active_child = bonobo_mdi_get_child_from_view (view); + mdi->priv->active_window = bonobo_mdi_get_window_from_view (view); + + gtk_widget_grab_focus (GTK_WIDGET (view)); + } + + if (view == old_view) + { + gl_debug (DEBUG_MDI, "END1"); + + return; + } + + if (mdi->priv->active_child != old_child) + { + gl_debug (DEBUG_MDI, "Emit child_changed"); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [CHILD_CHANGED], 0, old_child); + } + + gl_debug (DEBUG_MDI, "Emit view_changed"); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [VIEW_CHANGED], 0, old_view); + + gl_debug (DEBUG_MDI, "END2"); +} + +/** + * bonobo_mdi_set_active_view: + * @mdi: A pointer to an MDI object. + * @view: A pointer to the view that is to become the active one. + * + * Description: + * Sets the active view to @view. It also raises the window containing it + * and gives it focus. + **/ +void +bonobo_mdi_set_active_view (BonoboMDI *mdi, GtkWidget *view) +{ + GtkWindow *window; + + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (view != NULL); + g_return_if_fail (GTK_IS_WIDGET (view)); + + set_page_by_widget (GTK_NOTEBOOK (view->parent), view); + + window = GTK_WINDOW (bonobo_mdi_get_window_from_view (view)); + + gtk_window_present (window); + + set_active_view (mdi, view); + + gl_debug (DEBUG_MDI, "END"); +} + +/** + * bonobo_mdi_add_view: + * @mdi: A pointer to a BonoboMDI object. + * @child: A pointer to a child. + * + * Description: + * Creates a new view of the child and adds it to the MDI. BonoboMDIChild + * @child has to be added to the MDI with a call to bonobo_mdi_add_child + * before its views are added to the MDI. + * An "add_view" signal is emitted to the MDI after the view has been + * created, but before it is shown and added to the MDI, with a pointer to + * the created view as its parameter. The view is added to the MDI only if + * the signal handler (if it exists) returns %TRUE. If the handler returns + * %FALSE, the created view is destroyed and not added to the MDI. + * + * Return value: + * %TRUE if adding the view succeeded and %FALSE otherwise. + **/ +gboolean +bonobo_mdi_add_view (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GtkWidget *view; + GtkWidget *book; + gint ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + view = bonobo_mdi_child_add_view (child); + + g_return_val_if_fail (view != NULL, FALSE); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [ADD_VIEW], 0, view, &ret); + + if (!ret) + { + bonobo_mdi_child_remove_view (child, view); + + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + if (mdi->priv->active_window == NULL) + { + app_create (mdi, NULL, NULL); + gtk_widget_show (GTK_WIDGET (mdi->priv->active_window)); + } + + + if (!GTK_WIDGET_VISIBLE (view)) + gtk_widget_show (view); + + book = get_book_from_window (mdi->priv->active_window); + + if (book == NULL) + book = book_create (mdi); + + book_add_view (GTK_NOTEBOOK (book), view); + + /* this reference will compensate the view's unrefing + when removed from its parent later, as we want it to + stay valid until removed from the child with a call + to bonobo_mdi_child_remove_view() */ + g_object_ref (G_OBJECT (view)); + gtk_object_sink (GTK_OBJECT (view)); + + g_object_set_data (G_OBJECT (view), BONOBO_MDI_CHILD_KEY, child); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_add_toplevel_view: + * @mdi: A pointer to a BonoboMDI object. + * @child: A pointer to a BonoboMDIChild object to be added to the MDI. + * @window_role: X window role to use for the window, for session-management + * purposes. If this is %NULL, a unique role string will be automatically + * generated. + * + * Description: + * Creates a new view of the child and adds it to the MDI; it behaves the + * same way as bonobo_mdi_add_view in %BONOBO_MDI_MODAL and %BONOBO_MDI_TOPLEVEL + * modes, but in %BONOBO_MDI_NOTEBOOK mode, the view is added in a new + * toplevel window unless the active one has no views in it. + * + * Return value: + * %TRUE if adding the view succeeded and %FALSE otherwise. + **/ +gboolean +bonobo_mdi_add_toplevel_view (BonoboMDI *mdi, BonoboMDIChild *child, const char *window_role) +{ + GtkWidget *view; + gint ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + view = bonobo_mdi_child_add_view (child); + + g_return_val_if_fail (view != NULL, FALSE); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [ADD_VIEW], 0, view, &ret); + + if (ret == FALSE) + { + bonobo_mdi_child_remove_view (child, view); + + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + bonobo_mdi_open_toplevel (mdi, window_role); + + if (!GTK_WIDGET_VISIBLE (view)) + gtk_widget_show (view); + + book_add_view (GTK_NOTEBOOK (get_book_from_window (mdi->priv->active_window)), view); + + /* this reference will compensate the view's unrefing + when removed from its parent later, as we want it to + stay valid until removed from the child with a call + to bonobo_mdi_child_remove_view() */ + g_object_ref (G_OBJECT (view)); + gtk_object_sink (GTK_OBJECT (view)); + + g_object_set_data (G_OBJECT (view), BONOBO_MDI_CHILD_KEY, child); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_remove_view: + * @mdi: A pointer to a BonoboMDI object. + * @view: View to remove. + * @force: If TRUE, the "remove_view" signal is not emitted. + * + * Description: + * Removes a view from an MDI. + * A "remove_view" signal is emitted to the MDI before actually removing + * view. The view is removed only if the signal handler (if it exists and + * the @force is set to %FALSE) returns %TRUE. + * + * Return value: + * %TRUE if the view was removed and %FALSE otherwise. + **/ +gboolean +bonobo_mdi_remove_view (BonoboMDI *mdi, GtkWidget *view, gint force) +{ + GtkWidget *book; + BonoboWindow *window; + BonoboMDIChild *child; + gint ret = TRUE; + gint pn; + gboolean was_active_window = FALSE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (view != NULL, FALSE); + g_return_val_if_fail (GTK_IS_WIDGET (view), FALSE); + + if (!force) + g_signal_emit (G_OBJECT (mdi), mdi_signals [REMOVE_VIEW], 0, view, &ret); + + if (ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + was_active_window = (view == mdi->priv->active_view); + + child = bonobo_mdi_get_child_from_view (view); + window = bonobo_mdi_get_window_from_view (view); + + book = get_book_from_window (window); + g_return_val_if_fail (book != NULL, TRUE); + + if (g_list_length (GTK_NOTEBOOK (book)->children) == 1) + app_set_view (mdi, window, NULL); + + bonobo_mdi_child_remove_view (child, view); + + pn = gtk_notebook_page_num (GTK_NOTEBOOK (book), view); + gtk_notebook_remove_page (GTK_NOTEBOOK (book), pn); + + if (GTK_NOTEBOOK (book)->cur_page == NULL) + { + if ((g_list_length (mdi->priv->windows) > 1) || + (mdi->priv->registered != NULL)) + { + gl_debug (DEBUG_VIEW, "Destroy window"); + + /* if this is NOT the last toplevel or a registered object + exists, destroy the toplevel */ + mdi->priv->windows = g_list_remove (mdi->priv->windows, window); + gtk_widget_destroy (GTK_WIDGET (window)); + + if (mdi->priv->active_window && was_active_window) + mdi->priv->active_view = bonobo_mdi_get_view_from_window ( + mdi, + mdi->priv->active_window); + } + } + else + { + pn = gtk_notebook_get_current_page (GTK_NOTEBOOK (book)); + app_set_view (mdi, window, gtk_notebook_get_nth_page (GTK_NOTEBOOK (book), pn)); + } + + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +static void +child_name_changed (BonoboMDIChild *mdi_child, gchar* old_name, BonoboMDI *mdi) +{ + bonobo_mdi_update_child (mdi, mdi_child); +} + +/** + * bonobo_mdi_add_child: + * @mdi: A pointer to a BonoboMDI object. + * @child: A pointer to a BonoboMDIChild to add to the MDI. + * + * Description: + * Adds a new child to the MDI. No views are added: this has to be done with + * a call to bonobo_mdi_add_view. + * First an "add_child" signal is emitted to the MDI with a pointer to the + * child as its parameter. The child is added to the MDI only if the signal + * handler (if it exists) returns %TRUE. If the handler returns %FALSE, the + * child is not added to the MDI. + * + * Return value: + * %TRUE if the child was added successfully and %FALSE otherwise. + **/ +gint +bonobo_mdi_add_child (BonoboMDI *mdi, BonoboMDIChild *child) +{ + gint ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + g_signal_emit (G_OBJECT (mdi), mdi_signals [ADD_CHILD], 0, child, &ret); + + if (ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + bonobo_mdi_child_set_parent (child, G_OBJECT (mdi)); + + mdi->priv->children = g_list_append (mdi->priv->children, child); + + g_signal_connect (G_OBJECT (child), "name_changed", + G_CALLBACK (child_name_changed), mdi); + + child_list_menu_add_item (mdi, child); + + g_object_set_data (G_OBJECT (child), BONOBO_MDI_KEY, mdi); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_remove_child: + * @mdi: A pointer to a BonoboMDI object. + * @child: Child to remove. + * @force: If TRUE, the "remove_child" signal is not emitted + * + * Description: + * Removes a child and all of its views from the MDI. + * A "remove_child" signal is emitted to the MDI with @child as its parameter + * before actually removing the child. The child is removed only if the signal + * handler (if it exists and the @force is set to %FALSE) returns %TRUE. + * + * Return value: + * %TRUE if the removal was successful and %FALSE otherwise. + **/ +gint +bonobo_mdi_remove_child (BonoboMDI *mdi, BonoboMDIChild *child, gint force) +{ + gint ret = TRUE; + GList *view_node; + GtkWidget *view; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI_CHILD (child), FALSE); + + /* if force is set to TRUE, don't call the remove_child handler (ie there is no way for the + user to stop removal of the child) */ + + if (!force) + g_signal_emit (G_OBJECT (mdi), mdi_signals [REMOVE_CHILD], 0, child, &ret); + + if (ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + view_node = bonobo_mdi_child_get_views (child); + + while (view_node) + { + view = GTK_WIDGET (view_node->data); + view_node = view_node->next; + bonobo_mdi_remove_view (mdi, GTK_WIDGET (view), TRUE); + } + + mdi->priv->children = g_list_remove (mdi->priv->children, child); + + child_list_menu_remove_item (mdi, child); + + if (child == mdi->priv->active_child) + mdi->priv->active_child = NULL; + + bonobo_mdi_child_set_parent (child, NULL); + + g_signal_handlers_disconnect_by_func (G_OBJECT (child), G_CALLBACK (child_name_changed), mdi); + + g_object_unref (G_OBJECT (child)); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_remove_all: + * @mdi: A pointer to a BonoboMDI object. + * @force: If TRUE, the "remove_child" signal is not emitted + * + * Description: + * Removes all children and all views from the MDI. + * A "remove_child" signal is emitted to the MDI for each child before + * actually trying to remove any. If signal handlers for all children (if + * they exist and the @force is set to %FALSE) return %TRUE, all children + * and their views are removed and none otherwise. + * + * Return value: + * %TRUE if the removal was successful and %FALSE otherwise. + **/ +gint +bonobo_mdi_remove_all (BonoboMDI *mdi, gint force) +{ + GList *child_node; + gint handler_ret = TRUE; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, FALSE); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + + /* first check if removal of any child will be prevented by the + remove_child signal handler */ + if (!force) + { + child_node = mdi->priv->children; + while (child_node) + { + g_signal_emit (G_OBJECT (mdi), + mdi_signals [REMOVE_CHILD], + 0, + child_node->data, + &handler_ret); + + /* if any of the children may not be removed, none will be */ + if (handler_ret == FALSE) + { + gl_debug (DEBUG_MDI, "END1"); + + return FALSE; + } + + child_node = child_node->next; + } + } + + /* remove all the children with force arg set to true so that remove_child + handlers are not called again */ + while (mdi->priv->children) + bonobo_mdi_remove_child (mdi, BONOBO_MDI_CHILD (mdi->priv->children->data), TRUE); + + gl_debug (DEBUG_MDI, "END2"); + + return TRUE; +} + +/** + * bonobo_mdi_open_toplevel: + * @mdi: A pointer to a BonoboMDI object. + * @window_role: X window role to use for the window, for session-management + * purposes. If this is %NULL, a unique role string will be automatically + * generated. + * + * Description: + * Opens a new toplevel window. This is usually used only for opening + * the initial window on startup (just before calling gtkmain()) if no + * windows were open because a session was restored or children were added + * because of command line args). + **/ +void +bonobo_mdi_open_toplevel (BonoboMDI *mdi, const char *window_role) +{ + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + + app_clone (mdi, mdi->priv->active_window, window_role); + + book_create (mdi); + + gtk_widget_show (GTK_WIDGET (mdi->priv->active_window)); + + gl_debug (DEBUG_MDI, "END1"); +} + +/** + * bonobo_mdi_update_child: + * @mdi: A pointer to a BonoboMDI object. + * @child: Child to update. + * + * Description: + * Updates all notebook labels of @child's views and their window titles + * after its name changes. It is not required if bonobo_mdi_child_set_name() + * is used for setting the child's name. + **/ +static void +bonobo_mdi_update_child (BonoboMDI *mdi, BonoboMDIChild *child) +{ + GtkWidget *view, *title; + GList *view_node; + GList *win_node; + gchar* child_name, *path, *path_cmd, *tip, *escaped_name; + + gl_debug (DEBUG_MDI, ""); + + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (child != NULL); + g_return_if_fail (BONOBO_IS_MDI_CHILD (child)); + + view_node = bonobo_mdi_child_get_views (child); + + while (view_node) + { + view = GTK_WIDGET (view_node->data); + + title = child_set_label (child, NULL); + + gtk_notebook_set_tab_label (GTK_NOTEBOOK (view->parent), view, title); + + view_node = g_list_next (view_node); + } + + /* Update child list menus */ + if(mdi->priv->child_list_path == NULL) + { + gl_debug (DEBUG_MDI, "END1"); + + return; + } + + win_node = mdi->priv->windows; + + child_name = bonobo_mdi_child_get_name (child); + escaped_name = escape_underscores (child_name); + path = g_strdup_printf ("%sChild_%p", mdi->priv->child_list_path, child); + path_cmd = g_strdup_printf ("/commands/Child_%p", child); + tip = g_strdup_printf (_("Activate %s"), child_name); + + while (win_node) + { + BonoboUIComponent *ui_component; + + ui_component = BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win_node->data), UI_COMPONENT_KEY)); + + bonobo_ui_component_set_prop (ui_component, path, "label", escaped_name, NULL); + bonobo_ui_component_set_prop (ui_component, path, "tip", tip, NULL); + + win_node = g_list_next (win_node); + } + + g_free (escaped_name); + g_free (path); + g_free (path_cmd); + g_free (tip); + g_free (child_name); + + gl_debug (DEBUG_MDI, "END2"); +} + +/** + * bonobo_mdi_find_child: + * @mdi: A pointer to a BonoboMDI object. + * @name: A string with a name of the child to find. + * + * Description: + * Finds a child named @name. + * + * Return value: + * A pointer to the BonoboMDIChild object if the child was found and NULL + * otherwise. + **/ +BonoboMDIChild * +bonobo_mdi_find_child (BonoboMDI *mdi, const gchar *name) +{ + GList *child_node; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + child_node = mdi->priv->children; + while (child_node) + { + gchar* child_name = bonobo_mdi_child_get_name (BONOBO_MDI_CHILD (child_node->data)); + + if (strcmp (child_name, name) == 0) + { + g_free (child_name); + + gl_debug (DEBUG_MDI, "END1"); + + return BONOBO_MDI_CHILD (child_node->data); + } + + g_free (child_name); + + child_node = g_list_next (child_node); + } + + gl_debug (DEBUG_MDI, "END2"); + + return NULL; +} + +/** + * bonobo_mdi_get_active_child: + * @mdi: A pointer to a BonoboMDI object. + * + * Description: + * Returns a pointer to the active BonoboMDIChild object. + * + * Return value: + * A pointer to the active BonoboMDIChild object. %NULL, if there is none. + **/ +BonoboMDIChild * +bonobo_mdi_get_active_child (BonoboMDI *mdi) +{ + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + if (mdi->priv->active_view) + return (bonobo_mdi_get_child_from_view (mdi->priv->active_view)); + + return NULL; +} + +/** + * bonobo_mdi_get_active_view: + * @mdi: A pointer to a BonoboMDI object. + * + * Description: + * Returns a pointer to the active view (the one with the focus). + * + * Return value: + * A pointer to a GtkWidget *. + **/ +GtkWidget * +bonobo_mdi_get_active_view (BonoboMDI *mdi) +{ + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + return mdi->priv->active_view; +} + +/** + * bonobo_mdi_get_active_window: + * @mdi: A pointer to a BonoboMDI object. + * + * Description: + * Returns a pointer to the toplevel window containing the active view. + * + * Return value: + * A pointer to a BonoboWindow that has the focus. + **/ +BonoboWindow * +bonobo_mdi_get_active_window (BonoboMDI *mdi) +{ + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + + return mdi->priv->active_window; +} + +void +bonobo_mdi_set_ui_template (BonoboMDI *mdi, const gchar *xml, BonoboUIVerb verbs[]) +{ + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (xml != NULL); + + if (mdi->priv->ui_xml != NULL) + g_free (mdi->priv->ui_xml); + + mdi->priv->ui_xml = g_strdup (xml); + + /* FIXME */ + mdi->priv->verbs = verbs; +} + +void +bonobo_mdi_set_ui_template_file (BonoboMDI *mdi, const gchar *file_name, BonoboUIVerb verbs[]) +{ + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + g_return_if_fail (file_name != NULL); + + if (mdi->priv->ui_file_name != NULL) + g_free (mdi->priv->ui_file_name); + + mdi->priv->ui_file_name = g_strdup (file_name); + + /* FIXME */ + mdi->priv->verbs = verbs; +} + +/** + * bonobo_mdi_set_child_list_path: + * @mdi: A pointer to a BonoboMDI object. + * @path: A menu path where the child list menu should be inserted + * + * Description: + * Sets the position for insertion of menu items used to activate the MDI + * children that were added to the MDI. See gnome_app_find_menu_pos for + * details on menu paths. If the path is not set or set to %NULL, these menu + * items aren't going to be inserted in the MDI menu structure. Note that if + * you want all menu items to be inserted in their own submenu, you have to + * create that submenu (and leave it empty, of course). + **/ +void +bonobo_mdi_set_child_list_path (BonoboMDI *mdi, const gchar *path) +{ + g_return_if_fail (mdi != NULL); + g_return_if_fail (BONOBO_IS_MDI (mdi)); + + if (mdi->priv->child_list_path) + g_free (mdi->priv->child_list_path); + + mdi->priv->child_list_path = g_strdup (path); +} + +/** + * bonobo_mdi_register: + * @mdi: A pointer to a BonoboMDI object. + * @object: Object to register. + * + * Description: + * Registers GObject @object with MDI. + * This is mostly intended for applications that open other windows besides + * those opened by the MDI and want to continue to run even when no MDI + * windows exist (an example of this would be GIMP's window with tools, if + * the pictures were MDI children). As long as there is an object registered + * with the MDI, the MDI will not destroy itself when the last of its windows + * is closed. If no objects are registered, closing the last MDI window + * results in MDI being destroyed. + **/ +void +bonobo_mdi_register (BonoboMDI *mdi, GObject *object) +{ + if (!g_slist_find (mdi->priv->registered, object)) + mdi->priv->registered = g_slist_append (mdi->priv->registered, object); +} + +/** + * bonobo_mdi_unregister: + * @mdi: A pointer to a BonoboMDI object. + * @object: Object to unregister. + * + * Description: + * Removes GObject @object from the list of registered objects. + **/ +void +bonobo_mdi_unregister (BonoboMDI *mdi, GObject *object) +{ + mdi->priv->registered = g_slist_remove (mdi->priv->registered, object); +} + +/** + * bonobo_mdi_get_child_from_view: + * @view: A pointer to a GtkWidget. + * + * Description: + * Returns a child that @view is a view of. + * + * Return value: + * A pointer to the BonoboMDIChild the view belongs to. + **/ +BonoboMDIChild * +bonobo_mdi_get_child_from_view (GtkWidget *view) +{ + return BONOBO_MDI_CHILD (g_object_get_data (G_OBJECT(view), BONOBO_MDI_CHILD_KEY)); +} + +/** + * bonobo_mdi_get_window_from_view: + * @view: A pointer to a GtkWidget. + * + * Description: + * Returns the toplevel window for this view. + * + * Return value: + * A pointer to the BonoboWindow containg the specified view. + **/ +BonoboWindow * +bonobo_mdi_get_window_from_view (GtkWidget *view) +{ + return BONOBO_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))); +} + +/** + * bonobo_mdi_get_view_from_window: + * @mdi: A pointer to a BonoboMDI object. + * @win: A pointer to a BonoboWindow widget. + * + * Description: + * Returns the pointer to the view in the MDI toplevel window @win. + * If the mode is set to %GNOME_MDI_NOTEBOOK, the view in the current + * page is returned. + * + * Return value: + * A pointer to a view. + **/ +GtkWidget * +bonobo_mdi_get_view_from_window (BonoboMDI *mdi, BonoboWindow *win) +{ + GtkWidget *book; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (mdi != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_MDI (mdi), NULL); + g_return_val_if_fail (win != NULL, NULL); + g_return_val_if_fail (BONOBO_IS_WINDOW (win), NULL); + + book = get_book_from_window (win); + g_return_val_if_fail (book != NULL, NULL); + + if (GTK_NOTEBOOK (book)->cur_page) + { + int cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (book)); + + gl_debug (DEBUG_MDI, "END1"); + + return gtk_notebook_get_nth_page (GTK_NOTEBOOK (book), cur_page); + } + else + { + gl_debug (DEBUG_MDI, "END2"); + + return NULL; + } +} + +void +bonobo_mdi_construct (BonoboMDI *mdi, const gchar* name, const gchar* title, + gint default_window_width, gint default_window_height) +{ + g_return_if_fail (mdi->priv->mdi_name == NULL); + g_return_if_fail (mdi->priv->title == NULL); + + g_return_if_fail (name != NULL); + g_return_if_fail (title != NULL); + + mdi->priv->mdi_name = g_strdup (name); + mdi->priv->title = g_strdup (title); + + mdi->priv->default_window_width = default_window_width; + mdi->priv->default_window_height = default_window_height; + +} + +GList * +bonobo_mdi_get_children (BonoboMDI *mdi) +{ + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + + return mdi->priv->children; +} + +GList * +bonobo_mdi_get_windows (BonoboMDI *mdi) +{ + g_return_val_if_fail (BONOBO_IS_MDI (mdi), FALSE); + + return mdi->priv->windows; +} + + + +BonoboUIComponent* +bonobo_mdi_get_ui_component_from_window (BonoboWindow* win) +{ + return BONOBO_UI_COMPONENT ( + g_object_get_data (G_OBJECT (win), UI_COMPONENT_KEY)); +} + +const BonoboMDIWindowInfo * +bonobo_mdi_get_window_info (BonoboWindow *win) +{ + return (const BonoboMDIWindowInfo *) + g_object_get_data (G_OBJECT (win), WINDOW_INFO_KEY); +} diff --git a/glabels2/src/bonobo-mdi.h b/glabels2/src/bonobo-mdi.h new file mode 100644 index 0000000..9355687 --- /dev/null +++ b/glabels2/src/bonobo-mdi.h @@ -0,0 +1,204 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * bonobo-mdi.h - definition of a BonoboMDI object + * + * Copyright (C) 2001-2002 Free Software Foundation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Paolo Maggi + */ + +/* + * Modified by the gedit Team, 2001-2002. See the AUTHORS file for a + * list of people on the gedit Team. + * See the ChangeLog files for a list of changes. + */ + +#ifndef _BONOBO_MDI_H_ +#define _BONOBO_MDI_H_ + +#include <gtk/gtk.h> +#include <bonobo/bonobo-window.h> +#include <bonobo/bonobo-ui-component.h> + + +#include "bonobo-mdi-child.h" + +#define BONOBO_TYPE_MDI (bonobo_mdi_get_type ()) +#define BONOBO_MDI(obj) (GTK_CHECK_CAST ((obj), BONOBO_TYPE_MDI, BonoboMDI)) +#define BONOBO_MDI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_MDI, BonoboMDIClass)) +#define BONOBO_IS_MDI(obj) (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_MDI)) +#define BONOBO_IS_MDI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), BONOBO_TYPE_MDI)) +#define BONOBO_MDI_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), BONOBO_TYPE_MDI, BonoboMDIClass)) + +typedef struct _BonoboMDIPrivate BonoboMDIPrivate; + +typedef struct { + GObject object; + + BonoboMDIPrivate *priv; +} BonoboMDI; + +typedef struct { + GObjectClass parent_class; + + /* Signals */ + gboolean (*add_child) (BonoboMDI *mdi, BonoboMDIChild *child); + gboolean (*remove_child) (BonoboMDI *mdi, BonoboMDIChild *child); + gboolean (*add_view) (BonoboMDI *mdi, GtkWidget *view); + gboolean (*remove_view) (BonoboMDI *mdi, GtkWidget *view); + void (*child_changed) (BonoboMDI *mdi, BonoboMDIChild *child); + void (*view_changed) (BonoboMDI *mdi, GtkWidget *view); + void (*top_window_created) (BonoboMDI *mdi, BonoboWindow *window); + void (*top_window_destroy) (BonoboMDI *mdi, BonoboWindow *window); + void (*all_windows_destroyed)(BonoboMDI *mdi); +} BonoboMDIClass; + +typedef struct _BonoboMDIWindowInfo BonoboMDIWindowInfo; + +struct _BonoboMDIWindowInfo { + gint width; + gint height; + + GdkWindowState state; +}; + +/* + * description of BonoboMDI signals: + * + * gboolean add_child(BonoboMDI *, BonoboMDIChild *) + * gboolean add_view(BonoboMDI *, GtkWidget *) + * are called before actually adding a mdi_child or a view to the MDI. if the handler returns + * TRUE, the action proceeds otherwise the mdi_child or view are not added. + * + * gboolean remove_child(BonoboMDI *, BonoboMDIChild *) + * gboolean remove_view(BonoboMDI *, GtkWidget *) + * are called before removing mdi_child or view. the handler should return true if the object + * is to be removed from MDI + * + * void child_changed(BonoboMDI *, BonoboMDIChild *) + * gets called each time when active child is changed with the second argument + * pointing to the old child. mdi->active_view and mdi->active_child still already + * hold the new values + * + * void view_changed(BonoboMDI *, GtkWidget *) + * is emitted whenever a view is changed, regardless of it being the view of the same child as + * the old view or not. the second argument points to the old view, mdi->active_view and + * mdi->active_child hold the new values. if the child has also been changed, this signal is + * emitted after the child_changed signal. + * + * void top_window_created(BonoboMDI *, BonoboWindow *) + * is called with each newly created BonoboWindow to allow the MDI user to customize it (add a + * statusbar, toolbars or menubar if the method with ui templates is not sufficient, + * etc.). + * no contents may be set since BonoboMDI uses them for storing either a view of a child + * or a notebook + */ + +GType bonobo_mdi_get_type (void); + +GObject *bonobo_mdi_new (const gchar *mdi_name, + const gchar *title, + gint default_window_width, + gint default_window_height); + +void bonobo_mdi_construct (BonoboMDI *mdi, + const gchar *name, + const gchar *title, + gint default_window_width, + gint default_window_height); + +/* setting the ui template*/ +void bonobo_mdi_set_ui_template (BonoboMDI *mdi, + const gchar *xml, + BonoboUIVerb verbs[]); +void bonobo_mdi_set_ui_template_file (BonoboMDI *mdi, + const gchar *file_name, + BonoboUIVerb verbs[]); + +void bonobo_mdi_set_child_list_path (BonoboMDI *mdi, + const gchar *path); + +/* manipulating views */ +gboolean bonobo_mdi_add_view (BonoboMDI *mdi, + BonoboMDIChild *child); +gboolean bonobo_mdi_add_toplevel_view (BonoboMDI *mdi, + BonoboMDIChild *child, + const char *window_role); +gboolean bonobo_mdi_remove_view (BonoboMDI *mdi, + GtkWidget *view, + gboolean force); + +GtkWidget *bonobo_mdi_get_active_view (BonoboMDI *mdi); +void bonobo_mdi_set_active_view (BonoboMDI *mdi, + GtkWidget *view); + +/* manipulating children */ +gint bonobo_mdi_add_child (BonoboMDI *mdi, + BonoboMDIChild *child); +gint bonobo_mdi_remove_child (BonoboMDI *mdi, + BonoboMDIChild *child, + gboolean force); +gint bonobo_mdi_remove_all (BonoboMDI *mdi, + gboolean force); + +void bonobo_mdi_open_toplevel (BonoboMDI *mdi, + const char *window_role); + +BonoboMDIChild *bonobo_mdi_get_active_child (BonoboMDI *mdi); +BonoboMDIChild *bonobo_mdi_find_child (BonoboMDI *mdi, + const gchar *name); + +BonoboWindow *bonobo_mdi_get_active_window (BonoboMDI *mdi); + +/* + * the following two functions are here to make life easier if an application + * creates objects (like opening a window) that should "keep the application + * alive" even if there are no MDI windows open. any such windows should be + * registered with the MDI: as long as there is a window registered, the MDI + * will not destroy itself (even if the last of its windows is closed). on the + * other hand, closing the last MDI window when no objects are registered + * with the MDI will result in MDI being gtk_object_destroy()ed. + */ +void bonobo_mdi_register (BonoboMDI *mdi, + GObject *object); +void bonobo_mdi_unregister (BonoboMDI *mdi, + GObject *object); + +/* + * convenience functions for retrieveing BonoboMDIChild and BonoboApp + * objects associated with a particular view and for retrieveing the + * visible view of a certain BonoboWindow. + */ +BonoboWindow *bonobo_mdi_get_window_from_view (GtkWidget *view); +BonoboMDIChild *bonobo_mdi_get_child_from_view (GtkWidget *view); +GtkWidget *bonobo_mdi_get_view_from_window (BonoboMDI *mdi, + BonoboWindow *window); + +GList *bonobo_mdi_get_children (BonoboMDI *mdi); +GList *bonobo_mdi_get_windows (BonoboMDI *mdi); + +BonoboUIComponent *bonobo_mdi_get_ui_component_from_window (BonoboWindow *win); + +/* Utility function to generate unique window roles */ +char *bonobo_mdi_generate_window_role (void); + +const BonoboMDIWindowInfo *bonobo_mdi_get_window_info (BonoboWindow *win); + +#endif /* _BONOBO_MDI_H_ */ + + diff --git a/glabels2/src/canvas-hacktext.c b/glabels2/src/canvas-hacktext.c new file mode 100644 index 0000000..75ccd4f --- /dev/null +++ b/glabels2/src/canvas-hacktext.c @@ -0,0 +1,587 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * gnome-canvas-hacktext.c: Hacktext item type for GnomeCanvas widget + * This is mainly used for gnome-print preview context + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Authors: + * Federico Mena <federico@nuclecu.unam.mx> + * Raph Levien <raph@acm.org> + * Lauris Kaplinski <lauris@helixcode.com> + * + * Copyright (C) 1998-1999 The Free Software Foundation + * Copyright (C) 2000-2002 Ximian Inc. + * + */ + +/* + * TODO: + * - Clipping + */ + +#include <config.h> + +#include <math.h> +#include <string.h> +#include <libgnomeprint/gnome-font.h> +#include <libgnomeprint/gnome-rfont.h> +#include <libgnomeprint/gnome-pgl.h> +#include "canvas-hacktext.h" + +enum { + ARG_0, + ARG_TEXT, + ARG_GLYPHLIST, + ARG_FILL_COLOR, + ARG_FILL_COLOR_RGBA, + ARG_FONT, + ARG_X, + ARG_Y +}; + + +static void gl_canvas_hacktext_class_init (glCanvasHacktextClass *class); +static void gl_canvas_hacktext_init (glCanvasHacktext *hacktext); +static void gl_canvas_hacktext_destroy (GtkObject *object); +static void gl_canvas_hacktext_set_arg (GObject *object, + guint arg_id, + const GValue *value, + GParamSpec *pspec); +static void gl_canvas_hacktext_get_arg (GObject *object, + guint arg_id, + GValue *value, + GParamSpec *pspec); + +static void gl_canvas_hacktext_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags); +static void gl_canvas_hacktext_realize (GnomeCanvasItem *item); +static void gl_canvas_hacktext_unrealize (GnomeCanvasItem *item); +static double gl_canvas_hacktext_point (GnomeCanvasItem *item, double x, double y, + int cx, int cy, GnomeCanvasItem **actual_item); +static void gl_canvas_hacktext_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2); +static void gl_canvas_hacktext_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); +static void gl_canvas_hacktext_req_repaint (glCanvasHacktext *hacktext, ArtIRect *bbox); + + +static GnomeCanvasItemClass *parent_class; + +struct _glCanvasHacktextPriv { + GnomeFont * font; + + GnomeGlyphList * glyphlist; + GnomePosGlyphList * pgl; + double affine[6]; /* the text to world transform (NB! mirrored Y) */ +}; + +GType +gl_canvas_hacktext_get_type (void) +{ + static GType hacktext_type = 0; + + if (!hacktext_type) { + static const GTypeInfo hacktext_info = { + sizeof (glCanvasHacktextClass), + NULL, + NULL, + (GClassInitFunc) gl_canvas_hacktext_class_init, + NULL, + NULL, + sizeof (glCanvasHacktext), + 0, + (GInstanceInitFunc) gl_canvas_hacktext_init, + NULL + }; + + hacktext_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, + "glCanvasHacktext", + &hacktext_info, 0); + } + + return hacktext_type; +} + +static void +gl_canvas_hacktext_class_init (glCanvasHacktextClass *class) +{ + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GnomeCanvasItemClass *item_class; + + gobject_class = (GObjectClass *) class; + object_class = (GtkObjectClass *) class; + item_class = (GnomeCanvasItemClass *) class; + + parent_class = g_type_class_peek_parent (class); + + gobject_class->set_property = gl_canvas_hacktext_set_arg; + gobject_class->get_property = gl_canvas_hacktext_get_arg; + + g_object_class_install_property + (gobject_class, + ARG_TEXT, + g_param_spec_string ("text", NULL, NULL, + NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_GLYPHLIST, + g_param_spec_pointer ("glyphlist", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_FILL_COLOR, + g_param_spec_string ("fill_color", NULL, NULL, + NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_FILL_COLOR_RGBA, + g_param_spec_uint ("fill_color_rgba", NULL, NULL, + 0, G_MAXUINT, 0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_FONT, + g_param_spec_pointer ("font", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_X, + g_param_spec_double ("x", NULL, NULL, + -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + ARG_Y, + g_param_spec_double ("y", NULL, NULL, + -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + + object_class->destroy = gl_canvas_hacktext_destroy; + + item_class->update = gl_canvas_hacktext_update; + item_class->realize = gl_canvas_hacktext_realize; + item_class->unrealize = gl_canvas_hacktext_unrealize; + item_class->point = gl_canvas_hacktext_point; + item_class->bounds = gl_canvas_hacktext_bounds; + item_class->render = gl_canvas_hacktext_render; +} + +static void +gl_canvas_hacktext_init (glCanvasHacktext *hacktext) +{ + hacktext->text = NULL; + hacktext->priv = g_new (glCanvasHacktextPriv, 1); + hacktext->priv->font = NULL; + hacktext->priv->glyphlist = NULL; + hacktext->priv->pgl = NULL; + + art_affine_identity (hacktext->priv->affine); +} + +static void +gl_canvas_hacktext_destroy (GtkObject *object) +{ + glCanvasHacktext *hacktext; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_CANVAS_HACKTEXT (object)); + + hacktext = GL_CANVAS_HACKTEXT (object); + + if (hacktext->text) { + g_free (hacktext->text); + hacktext->text = NULL; + } + + if (hacktext->priv) { + if (hacktext->priv->font) gnome_font_unref (hacktext->priv->font); + if (hacktext->priv->glyphlist) gnome_glyphlist_unref (hacktext->priv->glyphlist); + if (hacktext->priv->pgl) gnome_pgl_destroy (hacktext->priv->pgl); + g_free (hacktext->priv); + hacktext->priv = NULL; + } + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + +static void +art_drect_hacktext (ArtDRect *bbox, glCanvasHacktext *hacktext) +{ + g_assert (bbox != NULL); + g_assert (hacktext != NULL); + + g_return_if_fail (hacktext->priv); + + if (GTK_OBJECT_FLAGS (hacktext) & GNOME_CANVAS_UPDATE_REQUESTED) { + gnome_canvas_update_now (GNOME_CANVAS_ITEM (hacktext)->canvas); + } + + if (!hacktext->priv->pgl) return; + + gnome_pgl_bbox (hacktext->priv->pgl, bbox); +} + +/* Computes the bounding box of the hacktext. Assumes that the number of points in the hacktext is + * not zero. + */ +static void +get_bounds (glCanvasHacktext *hacktext, double *bx1, double *by1, double *bx2, double *by2) +{ + ArtDRect bbox; + + /* Compute bounds of hacktext */ + art_drect_hacktext (&bbox, hacktext); + + /* Done */ + + *bx1 = bbox.x0; + *by1 = bbox.y0; + *bx2 = bbox.x1; + *by2 = bbox.y1; +} + +#ifdef IFED_OUT_BY_CHEMA_TO_KILL_COMPILE_WARNING +/* Convenience function to set a GC's foreground color to the specified pixel value */ +static void +set_gc_foreground (GdkGC *gc, gulong pixel) +{ + GdkColor c; + + if (!gc) + return; + + c.pixel = pixel; + gdk_gc_set_foreground (gc, &c); +} +#endif + +static void +gl_canvas_hacktext_set_arg (GObject *object, + guint arg_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeCanvasItem *item; + glCanvasHacktext *bp; + char *text; + GnomeGlyphList * gl; + GdkColor color; + GnomeFont * font; + + item = GNOME_CANVAS_ITEM (object); + bp = GL_CANVAS_HACKTEXT (object); + + switch (arg_id) { + case ARG_TEXT: + if (bp->text) { + g_free (bp->text); + bp->text = NULL; + } + + if (bp->priv->glyphlist) { + gnome_glyphlist_unref (bp->priv->glyphlist); + bp->priv->glyphlist = NULL; + } + + if (text) bp->text = g_value_dup_string (value); + + gnome_canvas_item_request_update (item); + break; + + case ARG_GLYPHLIST: + gl = g_value_get_pointer (value); + + if (bp->text) { + g_free (bp->text); + bp->text = NULL; + } + + if (bp->priv->glyphlist) { + gnome_glyphlist_unref (bp->priv->glyphlist); + bp->priv->glyphlist = NULL; + } + + /* fixme: should be duplicate() */ + + if (gl) gnome_glyphlist_ref (gl); + + bp->priv->glyphlist = gl; + + gnome_canvas_item_request_update (item); + + break; + + case ARG_FILL_COLOR: + if (gnome_canvas_get_color (item->canvas, g_value_get_string(value), &color)) { + bp->fill_set = TRUE; + bp->fill_pixel = color.pixel; + bp->fill_rgba = + ((color.red & 0xff00) << 16) | + ((color.green & 0xff00) << 8) | + (color.blue & 0xff00) | + 0xff; + } else { + bp->fill_set = FALSE; + bp->fill_rgba = 0; + } + + gnome_canvas_item_request_update (item); + break; + + case ARG_FILL_COLOR_RGBA: + bp->fill_set = TRUE; + bp->fill_rgba = g_value_get_uint (value); + + /* should probably request repaint on the fill_svp */ + gnome_canvas_item_request_update (item); + + break; + + case ARG_FONT: + font = g_value_get_pointer (value); + if (font) gnome_font_ref (font); + if (bp->priv->font) gnome_font_unref (bp->priv->font); + bp->priv->font = font; + bp->size = gnome_font_get_size (bp->priv->font); + gnome_canvas_item_request_update (item); + break; + + case ARG_X: + bp->x = g_value_get_double (value); + gnome_canvas_item_request_update (item); + break; + + case ARG_Y: + bp->y = g_value_get_double (value); + gnome_canvas_item_request_update (item); + break; + + default: + break; + } +} + +static void +gl_canvas_hacktext_get_arg (GObject *object, + guint arg_id, + GValue *value, + GParamSpec *pspec) +{ + glCanvasHacktext *bp; + + bp = GL_CANVAS_HACKTEXT (object); + + switch (arg_id) { + case ARG_TEXT: + if (bp->text) { + g_value_set_string (value, g_strdup (bp->text)); + } else + g_value_set_string (value, NULL); + break; + case ARG_FILL_COLOR_RGBA: + g_value_set_uint (value, bp->fill_color); + break; + + case ARG_FONT: + g_value_set_pointer (value, bp->priv->font); + break; + + case ARG_X: + g_value_set_double (value, bp->x); + break; + + case ARG_Y: + g_value_set_double (value, bp->y); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, arg_id, pspec); + break; + } +} + +static void +gl_canvas_hacktext_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) +{ + glCanvasHacktext *hacktext; + ArtIRect ibbox = {0, 0, 0, 0}; + + hacktext = (glCanvasHacktext *) item; + + if (parent_class->update) + (* parent_class->update) (item, affine, clip_path, flags); + + if (hacktext->priv->pgl) gl_canvas_hacktext_req_repaint (hacktext, NULL); + + gnome_canvas_item_reset_bounds (item); + + hacktext->priv->affine[0] = affine[0]; + hacktext->priv->affine[1] = affine[1]; + hacktext->priv->affine[2] = -affine[2]; + hacktext->priv->affine[3] = -affine[3]; + hacktext->priv->affine[4] = affine[4] + hacktext->x * affine[0] + hacktext->y * affine[2]; + hacktext->priv->affine[5] = affine[5] + hacktext->x * affine[1] + hacktext->y * affine[3]; + + if (hacktext->text) { + if (hacktext->priv->glyphlist) { + gnome_glyphlist_unref (hacktext->priv->glyphlist); + hacktext->priv->glyphlist = NULL; + } + + if (!hacktext->priv->font) return; + + hacktext->priv->glyphlist = gnome_glyphlist_from_text_dumb (hacktext->priv->font, hacktext->fill_rgba, + 0.0, 0.0, + hacktext->text); + } + + if (hacktext->priv->glyphlist) { + GnomePosGlyphList * pgl; + + pgl = gnome_pgl_from_gl (hacktext->priv->glyphlist, hacktext->priv->affine, GNOME_PGL_RENDER_DEFAULT); + + if (hacktext->priv->pgl) gnome_pgl_destroy (hacktext->priv->pgl); + + hacktext->priv->pgl = pgl; + } + + gl_canvas_hacktext_req_repaint (hacktext, &ibbox); + + hacktext->item.x1 = ibbox.x0; + hacktext->item.y1 = ibbox.y0; + hacktext->item.x2 = ibbox.x1; + hacktext->item.y2 = ibbox.y1; +} + +static void +gl_canvas_hacktext_realize (GnomeCanvasItem *item) +{ + glCanvasHacktext *hacktext; + + hacktext = (glCanvasHacktext *) item; + + if (parent_class->realize) + (* parent_class->realize) (item); +} + +static void +gl_canvas_hacktext_unrealize (GnomeCanvasItem *item) +{ + glCanvasHacktext *hacktext; + + hacktext = (glCanvasHacktext *) item; + + if (parent_class->unrealize) + (* parent_class->unrealize) (item); +} + +static double +gl_canvas_hacktext_point (GnomeCanvasItem *item, double mx, double my, + int cx, int cy, GnomeCanvasItem **actual_item) +{ + glCanvasHacktext * hacktext; + + hacktext = (glCanvasHacktext *) item; + + if (!hacktext->priv->pgl) return 1e18; + + *actual_item = item; + + if (gnome_pgl_test_point (hacktext->priv->pgl, cx, cy)) return 0.0; + + return 1e18; +} + +static void +gl_canvas_hacktext_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) +{ + glCanvasHacktext *hacktext; + + g_return_if_fail (item != NULL); + g_return_if_fail (GL_IS_CANVAS_HACKTEXT (item)); + + hacktext = GL_CANVAS_HACKTEXT (item); + + if (hacktext->text == NULL) { + *x1 = *y1 = *x2 = *y2 = 0.0; + return; + } + + get_bounds (hacktext, x1, y1, x2, y2); +} + +static void +gl_canvas_hacktext_req_repaint (glCanvasHacktext *hacktext, + ArtIRect *bbox) +{ + ArtDRect gbbox; + + g_return_if_fail (hacktext->priv); + + if (!hacktext->priv->pgl) return; + + if (gnome_pgl_bbox (hacktext->priv->pgl, &gbbox)) { + ArtIRect ibox; + art_drect_to_irect (&ibox, &gbbox); + gnome_canvas_request_redraw (hacktext->item.canvas, ibox.x0, ibox.y0, ibox.x1, ibox.y1); + if (bbox) art_irect_union (bbox, bbox, &ibox); + } +} + +static void +gl_canvas_hacktext_render (GnomeCanvasItem *item, + GnomeCanvasBuf *buf) +{ + glCanvasHacktext * hacktext; + + hacktext = (glCanvasHacktext *) item; + + g_return_if_fail (hacktext->priv); + + if (!hacktext->priv->pgl) return; + + gnome_canvas_buf_ensure_buf (buf); + buf->is_buf = TRUE; + buf->is_bg = FALSE; + + gnome_rfont_render_pgl_rgb8 (hacktext->priv->pgl, + -buf->rect.x0, -buf->rect.y0, + buf->buf, + buf->rect.x1 - buf->rect.x0, + buf->rect.y1 - buf->rect.y0, + buf->buf_rowstride, + GNOME_RFONT_RENDER_DEFAULT); +} + + + + + + + + + + + + diff --git a/glabels2/src/canvas-hacktext.h b/glabels2/src/canvas-hacktext.h new file mode 100644 index 0000000..fcb4d5a --- /dev/null +++ b/glabels2/src/canvas-hacktext.h @@ -0,0 +1,71 @@ +#ifndef __GL_CANVAS_HACKTEXT_H__ +#define __GL_CANVAS_HACKTEXT_H__ + +/* Hacktext item type for GnomeCanvas widget + * + * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is + * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. + * + * Copyright (C) 1998,1999 The Free Software Foundation + * + * Authors: Federico Mena <federico@nuclecu.unam.mx> + * Raph Levien <raph@acm.org> + */ + +#include <glib.h> + +G_BEGIN_DECLS + +/* Hacktext item for the canvas. The API is totally unstable - it needs to be replaced with one + * that supports Unicode and the merged GnomeText/GScript API. However, I need a text item now, + * and the GnomeText/GScript integration is going to take a bit more effort. + * + * The following object arguments are available: + * + * name type read/write description + * ------------------------------------------------------------------------------------------ + * text char * RW The string of the text item. + * glyphlist GnomeGlyphList * W Glyphlist + * fill_color string W X color specification for fill color, + * or NULL pointer for no color (transparent). + * fill_color_gdk GdkColor* RW Allocated GdkColor for fill. + */ + +#define GL_TYPE_CANVAS_HACKTEXT (gl_canvas_hacktext_get_type ()) +#define GL_CANVAS_HACKTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_CANVAS_HACKTEXT, glCanvasHacktext)) +#define GL_CANVAS_HACKTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_CANVAS_HACKTEXT, glCanvasHacktextClass)) +#define GL_IS_CANVAS_HACKTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_CANVAS_HACKTEXT)) +#define GL_IS_CANVAS_HACKTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_CANVAS_HACKTEXT)) + +typedef struct _glCanvasHacktext glCanvasHacktext; +typedef struct _glCanvasHacktextPriv glCanvasHacktextPriv; +typedef struct _glCanvasHacktextClass glCanvasHacktextClass; + +#include <libgnomecanvas/libgnomecanvas.h> + +struct _glCanvasHacktext { + GnomeCanvasItem item; + + char *text; /* String of the text item */ + guint fill_color; /* Fill color, RGBA */ + gulong fill_pixel; /* Color for fill */ + guint fill_set : 1; /* Is fill color set? */ + + double size; /* size in user units */ + double x, y; /* x, y coords of text origin */ + /* Antialiased specific stuff follows */ + guint32 fill_rgba; /* RGBA color for filling */ + glCanvasHacktextPriv *priv; /* Private data */ +}; + +struct _glCanvasHacktextClass { + GnomeCanvasItemClass parent_class; +}; + + +GType gl_canvas_hacktext_get_type (void); + + +G_END_DECLS + +#endif diff --git a/glabels2/src/commands.c b/glabels2/src/commands.c new file mode 100644 index 0000000..cd83667 --- /dev/null +++ b/glabels2/src/commands.c @@ -0,0 +1,419 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * commands.c: GLabels commands module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gtk/gtk.h> +#include <libgnome/libgnome.h> +#include <libgnomeui/libgnomeui.h> + +#include "commands.h" +#include "glabels.h" +#include "mdi-child.h" +#include "view.h" +#include "file.h" +#include "print.h" +#include "prefs.h" +#include "prefs-dialog.h" +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define LOGO_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-about-logo.png") +#else +#define LOGO_PIXMAP gnome_pixmap_file("glabels/glabels-about-logo.png") +#endif + + +/****************************************************************************/ +/* File->New command. */ +/****************************************************************************/ +void +gl_cmd_file_new (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + gl_debug (DEBUG_COMMANDS, "verbname: %s", verbname); + + gl_file_new (); +} + +/****************************************************************************/ +/* File->Open command. */ +/****************************************************************************/ +void +gl_cmd_file_open (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + BonoboMDIChild *active_child; + + gl_debug (DEBUG_COMMANDS, ""); + + active_child = bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)); + + gl_file_open ((glMDIChild*) active_child); +} + +/****************************************************************************/ +/* File->Save command. */ +/****************************************************************************/ +void +gl_cmd_file_save (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glMDIChild *active_child; + + gl_debug (DEBUG_COMMANDS, ""); + + active_child = GL_MDI_CHILD (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi))); + if (active_child == NULL) + return; + + gl_file_save (active_child); +} + +/****************************************************************************/ +/* File->Save_as command. */ +/****************************************************************************/ +void +gl_cmd_file_save_as (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glMDIChild *active_child; + + gl_debug (DEBUG_COMMANDS, ""); + + active_child = GL_MDI_CHILD (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi))); + if (active_child == NULL) + return; + + gl_file_save_as (active_child); +} + +/****************************************************************************/ +/* File->Print command. */ +/****************************************************************************/ +void +gl_cmd_file_print (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glLabel *label = glabels_get_active_label (); + BonoboWindow *win = glabels_get_active_window (); + + gl_debug (DEBUG_COMMANDS, ""); + + g_return_if_fail (label != NULL); + g_return_if_fail (win != NULL); + + gl_print_dialog (label, win); + +} + +/****************************************************************************/ +/* File->Close command. */ +/****************************************************************************/ +void +gl_cmd_file_close (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + GtkWidget *active_view; + + gl_debug (DEBUG_COMMANDS, ""); + + active_view = bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi)); + + if (active_view == NULL) + return; + + glabels_close_x_button_pressed = TRUE; + + gl_file_close (active_view); + + glabels_close_x_button_pressed = FALSE; +} + +/****************************************************************************/ +/* File->Close_all command. */ +/****************************************************************************/ +void +gl_cmd_file_close_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + gl_debug (DEBUG_COMMANDS, ""); + + glabels_close_x_button_pressed = TRUE; + + gl_file_close_all (); + + glabels_close_x_button_pressed = FALSE; +} + +/****************************************************************************/ +/* File->Exit command. */ +/****************************************************************************/ +void +gl_cmd_file_exit (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + gl_debug (DEBUG_COMMANDS, ""); + + glabels_exit_button_pressed = TRUE; + + gl_file_exit (); + + glabels_exit_button_pressed = FALSE; +} + + +/****************************************************************************/ +/* Edit->Cut command. */ +/****************************************************************************/ +void +gl_cmd_edit_cut (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_cut (active_view); +} + +/****************************************************************************/ +/* Edit->Copy command. */ +/****************************************************************************/ +void +gl_cmd_edit_copy (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_copy (active_view); +} + +/****************************************************************************/ +/* Edit->Paste command. */ +/****************************************************************************/ +void +gl_cmd_edit_paste (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_paste (active_view); +} + + +/****************************************************************************/ +/* Edit->Delete command. */ +/****************************************************************************/ +void +gl_cmd_edit_delete (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi))); + g_return_if_fail (active_view); + + gl_view_delete_selection (active_view); +} + + +/****************************************************************************/ +/* Edit->Select_all command. */ +/****************************************************************************/ +void +gl_cmd_edit_select_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = + GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI(glabels_mdi))); + + g_return_if_fail (active_view); + + gl_view_select_all (active_view); +} + +/****************************************************************************/ +/* Edit->Select_all command. */ +/****************************************************************************/ +void +gl_cmd_edit_unselect_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView* active_view; + + active_view = + GL_VIEW (bonobo_mdi_get_active_view (BONOBO_MDI(glabels_mdi))); + + g_return_if_fail (active_view); + + gl_view_unselect_all (active_view); +} + +/****************************************************************************/ +/* Settings->Preferences command. */ +/****************************************************************************/ +void +gl_cmd_settings_preferences (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + static GtkWidget *dlg = NULL; + + gl_debug (DEBUG_COMMANDS, ""); + + if (dlg != NULL) + { + gtk_window_present (GTK_WINDOW (dlg)); + gtk_window_set_transient_for (GTK_WINDOW (dlg), + GTK_WINDOW (glabels_get_active_window ())); + + return; + } + + dlg = gl_prefs_dialog_new (GTK_WINDOW (glabels_get_active_window ())); + + g_signal_connect (G_OBJECT (dlg), "destroy", + G_CALLBACK (gtk_widget_destroyed), &dlg); + + gtk_widget_show (dlg); +} + +/****************************************************************************/ +/* Help->Contents command. */ +/****************************************************************************/ +void +gl_cmd_help_contents (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + GError *error = NULL; + + gl_debug (DEBUG_COMMANDS, ""); + + gnome_help_display_with_doc_id (NULL, NULL, "glabels.xml", NULL, &error); + + if (error != NULL) + { + g_warning (error->message); + + g_error_free (error); + } +} + +/****************************************************************************/ +/* Help->About command. */ +/****************************************************************************/ +void +gl_cmd_help_about (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + static GtkWidget *about = NULL; + GdkPixbuf* pixbuf = NULL; + + gchar *copy_text = "Copyright 2001-2002 Jim Evins"; + gchar *about_text = + _("A label and business card creation program for GNOME.\n" + " \n" + "Glabels is free software; you can redistribute it and/or modify it " + "under the terms of the GNU General Public License as published by " + "the Free Software Foundation; either version 2 of the License, or " + "(at your option) any later version.\n" " \n" + "This program is distributed in the hope that it will be useful, but " + "WITHOUT ANY WARRANTY; without even the implied warranty of " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU " + "General Public License for more details.\n"); + + gchar *authors[] = { + _("Author:"), + "\tJim Evins <evins@snaught.com>", + "", + _("See the file AUTHORS for additional acknowledgments,"), + _("or visit http://snaught.com/glabels"), + NULL + }; + + gchar *documenters[] = { + "", + NULL + }; + + gchar *translator_credits = _(""); + + gl_debug (DEBUG_COMMANDS, ""); + + if (about != NULL) + { + gdk_window_show (about->window); + gdk_window_raise (about->window); + return; + } + + pixbuf = gdk_pixbuf_new_from_file ( LOGO_PIXMAP, NULL); + + about = gnome_about_new (_("glabels"), VERSION, + copy_text, + about_text, + (const char **)authors, + (const char **)documenters, + (const char *)translator_credits, + pixbuf); + + gtk_window_set_transient_for (GTK_WINDOW (about), + GTK_WINDOW (glabels_get_active_window ())); + + gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE); + + if (pixbuf != NULL) + g_object_unref (pixbuf); + + g_signal_connect (G_OBJECT (about), "destroy", + G_CALLBACK (gtk_widget_destroyed), &about); + + gtk_widget_show (about); +} + + diff --git a/glabels2/src/commands.h b/glabels2/src/commands.h new file mode 100644 index 0000000..8bc19c7 --- /dev/null +++ b/glabels2/src/commands.h @@ -0,0 +1,111 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * commands.h: GLabels commands module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __COMMANDS_H__ +#define __COMMANDS_H__ + +#include <bonobo/bonobo-ui-component.h> + +extern void gl_cmd_file_new (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_open (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_save (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_save_as (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_print (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_print_preview (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_close (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_close_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_file_exit (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + + +extern void gl_cmd_edit_undo (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_redo (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_cut (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_copy (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_paste (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_delete (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_select_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_edit_unselect_all (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + + +extern void gl_cmd_settings_preferences (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + + +extern void gl_cmd_help_contents (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_cmd_help_about (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +#endif /* __COMMANDS_H__ */ diff --git a/glabels2/src/debug.c b/glabels2/src/debug.c new file mode 100644 index 0000000..de92fea --- /dev/null +++ b/glabels2/src/debug.c @@ -0,0 +1,93 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * debug.c: GLabels debug module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-debug.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#include <glib.h> + +#include "debug.h" + +/* External debug options, used here and in glabels.c */ +gint gl_debug_all = 0; +gint gl_debug_view = 0; +gint gl_debug_item = 0; +gint gl_debug_prefs = 0; +gint gl_debug_print = 0; +gint gl_debug_file = 0; +gint gl_debug_label = 0; +gint gl_debug_template = 0; +gint gl_debug_xml = 0; +gint gl_debug_merge = 0; +gint gl_debug_commands = 0; +gint gl_debug_undo = 0; +gint gl_debug_recent = 0; +gint gl_debug_mdi = 0; +gint gl_debug_media_select = 0; +gint gl_debug_mini_preview = 0; +gint gl_debug_wdgt = 0; + +/****************************************************************************/ +/* Print debugging information. */ +/****************************************************************************/ +void +gl_debug (gint section, + gchar *file, + gint line, + gchar* function, + gchar* format, + ...) +{ + va_list args; + gchar *msg; + + g_return_if_fail (format != NULL); + + va_start (args, format); + msg = g_strdup_vprintf (format, args); + va_end (args); + + if (gl_debug_all || + (gl_debug_view && section == GL_DEBUG_VIEW) || + (gl_debug_item && section == GL_DEBUG_ITEM) || + (gl_debug_print && section == GL_DEBUG_PRINT) || + (gl_debug_prefs && section == GL_DEBUG_PREFS) || + (gl_debug_file && section == GL_DEBUG_FILE) || + (gl_debug_label && section == GL_DEBUG_LABEL) || + (gl_debug_template && section == GL_DEBUG_TEMPLATE) || + (gl_debug_xml && section == GL_DEBUG_XML) || + (gl_debug_merge && section == GL_DEBUG_MERGE) || + (gl_debug_commands && section == GL_DEBUG_COMMANDS) || + (gl_debug_undo && section == GL_DEBUG_UNDO) || + (gl_debug_recent && section == GL_DEBUG_RECENT) || + (gl_debug_mdi && section == GL_DEBUG_MDI) || + (gl_debug_media_select && section == GL_DEBUG_MEDIA_SELECT) || + (gl_debug_mini_preview && section == GL_DEBUG_MINI_PREVIEW) || + (gl_debug_wdgt && section == GL_DEBUG_WDGT) ) + g_print ("%s:%d (%s) %s\n", file, line, function, msg); + + g_free (msg); +} diff --git a/glabels2/src/debug.h b/glabels2/src/debug.h new file mode 100644 index 0000000..b9023cf --- /dev/null +++ b/glabels2/src/debug.h @@ -0,0 +1,94 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * debug.h: GLabels debug module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-debug.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +typedef enum { + GL_DEBUG_VIEW, + GL_DEBUG_ITEM, + GL_DEBUG_PRINT, + GL_DEBUG_PREFS, + GL_DEBUG_FILE, + GL_DEBUG_LABEL, + GL_DEBUG_TEMPLATE, + GL_DEBUG_XML, + GL_DEBUG_MERGE, + GL_DEBUG_UNDO, + GL_DEBUG_RECENT, + GL_DEBUG_COMMANDS, + GL_DEBUG_MDI, + GL_DEBUG_MEDIA_SELECT, + GL_DEBUG_MINI_PREVIEW, + GL_DEBUG_WDGT, +} glDebugSection; + +extern gint gl_debug_all; +extern gint gl_debug_view; +extern gint gl_debug_item; +extern gint gl_debug_print; +extern gint gl_debug_prefs; +extern gint gl_debug_file; +extern gint gl_debug_label; +extern gint gl_debug_template; +extern gint gl_debug_xml; +extern gint gl_debug_merge; +extern gint gl_debug_commands; +extern gint gl_debug_undo; +extern gint gl_debug_recent; +extern gint gl_debug_mdi; +extern gint gl_debug_media_select; +extern gint gl_debug_mini_preview; +extern gint gl_debug_wdgt; + +#ifndef __GNUC__ +#define __FUNCTION__ "" +#endif + +#define DEBUG_VIEW GL_DEBUG_VIEW, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_ITEM GL_DEBUG_ITEM, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_PRINT GL_DEBUG_PRINT, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_PREFS GL_DEBUG_PREFS, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_FILE GL_DEBUG_FILE, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_LABEL GL_DEBUG_LABEL, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_TEMPLATE GL_DEBUG_TEMPLATE,__FILE__, __LINE__, __FUNCTION__ +#define DEBUG_XML GL_DEBUG_XML, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MERGE GL_DEBUG_MERGE, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_UNDO GL_DEBUG_UNDO, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_RECENT GL_DEBUG_RECENT, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_COMMANDS GL_DEBUG_COMMANDS,__FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MDI GL_DEBUG_MDI, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MEDIA_SELECT GL_DEBUG_MEDIA_SELECT, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_MINI_PREVIEW GL_DEBUG_MINI_PREVIEW, __FILE__, __LINE__, __FUNCTION__ +#define DEBUG_WDGT GL_DEBUG_WDGT, __FILE__, __LINE__, __FUNCTION__ + +extern void gl_debug (gint section, gchar *file, + gint line, gchar* function, gchar* format, ...); + +#endif /* __DEBUG_H__ */ diff --git a/glabels2/src/file.c b/glabels2/src/file.c new file mode 100644 index 0000000..f607b0a --- /dev/null +++ b/glabels2/src/file.c @@ -0,0 +1,715 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * file.c: FILE menu dialog module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> +#include <string.h> + +#include "glabels.h" +#include "xml-label.h" +#include "file.h" +#include "mdi.h" +#include "recent.h" +#include "util.h" +#include "wdgt-media-select.h" +#include "wdgt-rotate-label.h" +#include "debug.h" + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/* Saved state for new dialog */ +static gchar *page_size = NULL; +static gchar *sheet_name = NULL; +static gboolean rotate_flag = FALSE; + +/* Saved state of file selectors */ +static gchar *open_path = NULL; +static gchar *save_path = NULL; + +/*===========================================*/ +/* Local function prototypes. */ +/*===========================================*/ +static void create_new_dialog_widgets (GtkDialog *dlg); +static void new_template_changed (glWdgtMediaSelect *select, + gpointer data); +static void new_response (GtkDialog *dlg, + gint response, + gpointer user_data); +static void open_ok (GtkWidget * widget, + GtkFileSelection * fsel); + +static void save_as_ok_cb (GtkWidget * widget, GtkFileSelection * fsel); +static void save_as_cancel_cb (GtkWidget * widget, GtkFileSelection * fsel); +static void save_as_destroy_cb (GtkWidget * widget, gboolean * destroy_flag); + + +/*****************************************************************************/ +/* "New" menu callback. */ +/*****************************************************************************/ +void +gl_file_new (void) +{ + GtkWidget *dlg; + BonoboWindow *win = glabels_get_active_window (); + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (glabels_mdi != NULL); + g_return_if_fail (win != NULL); + + dlg = gtk_dialog_new_with_buttons (_("New Label or Card"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); + + create_new_dialog_widgets (GTK_DIALOG (dlg)); + + g_signal_connect (G_OBJECT(dlg), "response", + G_CALLBACK (new_response), dlg); + + gtk_widget_show_all (GTK_WIDGET (dlg)); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create widgets. */ +/*---------------------------------------------------------------------------*/ +static void +create_new_dialog_widgets (GtkDialog * dlg) +{ + GtkWidget *wframe, *wvbox, *template_entry, *rotate_sel; + + gl_debug (DEBUG_FILE, "START"); + + wframe = gtk_frame_new (_("Media Type")); + gtk_box_pack_start (GTK_BOX (dlg->vbox), wframe, FALSE, FALSE, 0); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox); + + template_entry = gl_wdgt_media_select_new (); + gtk_container_add (GTK_CONTAINER (wvbox), template_entry); + + wframe = gtk_frame_new (_("Label orientation")); + gtk_box_pack_start (GTK_BOX (dlg->vbox), wframe, FALSE, FALSE, 0); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox); + + rotate_sel = gl_wdgt_rotate_label_new (); + gtk_box_pack_start (GTK_BOX (wvbox), rotate_sel, FALSE, FALSE, 0); + + g_object_set_data (G_OBJECT (dlg), "template_entry", + template_entry); + g_object_set_data (G_OBJECT (dlg), "rotate_sel", rotate_sel); + + g_signal_connect (G_OBJECT (template_entry), "changed", + G_CALLBACK (new_template_changed), rotate_sel); + + if (page_size != NULL) { + gl_wdgt_media_select_set_page_size (GL_WDGT_MEDIA_SELECT (template_entry), + page_size); + } + if (sheet_name != NULL) { + gl_wdgt_media_select_set_name (GL_WDGT_MEDIA_SELECT (template_entry), + sheet_name); + gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL + (rotate_sel), sheet_name); + } else { + sheet_name = + gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry)); + gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL + (rotate_sel), sheet_name); + } + gl_wdgt_rotate_label_set_state (GL_WDGT_ROTATE_LABEL (rotate_sel), rotate_flag); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. New template changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +new_template_changed (glWdgtMediaSelect * select, + gpointer data) +{ + glWdgtRotateLabel *rotate_sel = GL_WDGT_ROTATE_LABEL (data); + gchar *name; + + gl_debug (DEBUG_FILE, "START"); + + name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select)); + + gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (rotate_sel), + name); + + g_free (name); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. New "ok" button callback. */ +/*---------------------------------------------------------------------------*/ +static void +new_response (GtkDialog *dlg, + gint response, + gpointer user_data) +{ + GtkWidget *template_entry, *rotate_sel; + glMDIChild *new_child = NULL; + gint ret; + + gl_debug (DEBUG_FILE, "START"); + + switch (response) { + case GTK_RESPONSE_OK: + template_entry = + GTK_WIDGET (g_object_get_data (G_OBJECT (dlg), + "template_entry")); + rotate_sel = GTK_WIDGET (g_object_get_data (G_OBJECT (dlg), + "rotate_sel")); + + if (page_size != NULL) + g_free (page_size); + page_size = + gl_wdgt_media_select_get_page_size (GL_WDGT_MEDIA_SELECT (template_entry)); + + if (sheet_name != NULL) + g_free (sheet_name); + sheet_name = + gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry)); + + rotate_flag = + gl_wdgt_rotate_label_get_state (GL_WDGT_ROTATE_LABEL (rotate_sel)); + + new_child = gl_mdi_child_new (sheet_name, rotate_flag); + gl_debug (DEBUG_FILE, "template set."); + + ret = bonobo_mdi_add_child (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "Child added."); + + ret = bonobo_mdi_add_view (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "View added."); + + gtk_widget_grab_focus (GTK_WIDGET (glabels_get_active_view ())); + break; + } + + gtk_widget_destroy (GTK_WIDGET (dlg)); + + gl_debug (DEBUG_FILE, "END"); +} + +/*****************************************************************************/ +/* "Open" menu callback. */ +/*****************************************************************************/ +void +gl_file_open (glMDIChild *active_child) +{ + GtkFileSelection *fsel; + BonoboWindow *app = glabels_get_active_window (); + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (app != NULL); + + fsel = GTK_FILE_SELECTION (gtk_file_selection_new (_("Open"))); + gtk_window_set_transient_for (GTK_WINDOW (fsel), GTK_WINDOW (app)); + gtk_window_set_title (GTK_WINDOW (fsel), _("Open label")); + + g_signal_connect (G_OBJECT (fsel->ok_button), "clicked", + G_CALLBACK (open_ok), fsel); + + g_signal_connect_swapped (G_OBJECT (fsel->cancel_button), "clicked", + G_CALLBACK (gtk_widget_destroy), + G_OBJECT (fsel)); + + /* Recover state of open dialog */ + if (open_path != NULL) { + gtk_file_selection_set_filename (fsel, open_path); + } + + /* show the dialog */ + gtk_widget_show (GTK_WIDGET (fsel)); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Open "O.K." button callback. */ +/*---------------------------------------------------------------------------*/ +static void +open_ok (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *filename; + GtkWidget *dlg; + glMDIChild *new_child = NULL; + gint ret; + GnomeRecentModel *recent; + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + /* get the filename */ + filename = g_strdup (gtk_file_selection_get_filename (fsel)); + if (filename) { + if ( gl_file_open_real (filename, GTK_WINDOW(fsel)) ) { + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + } + + g_free (filename); + + gl_debug (DEBUG_FILE, "END"); +} + +/*****************************************************************************/ +/* "Open recent" menu callback. */ +/*****************************************************************************/ +gboolean +gl_file_open_recent (GnomeRecentView *view, + const gchar *filename, + BonoboWindow *win) +{ + gl_debug (DEBUG_FILE, ""); + + return gl_file_open_real (filename, GTK_WINDOW(win)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Open a file. */ +/*---------------------------------------------------------------------------*/ +gboolean +gl_file_open_real (const gchar *filename, + GtkWindow *win) +{ + gchar *abs_filename; + glMDIChild *new_child = NULL; + GtkWidget *dlg; + GnomeRecentModel *recent; + gint ret; + + gl_debug (DEBUG_FILE, "START"); + + abs_filename = gl_util_make_absolute (filename); + new_child = gl_mdi_child_new_with_uri (filename, NULL); + if (!new_child) { + + gl_debug (DEBUG_FILE, "couldn't open file"); + + dlg = gtk_message_dialog_new (GTK_WINDOW(win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Cannot open file '%s'"), + filename); + gtk_dialog_run (GTK_DIALOG (dlg)); + gtk_widget_destroy (dlg); + + g_free (abs_filename); + + gl_debug (DEBUG_FILE, "END false"); + + return FALSE; + + } else { + + ret = bonobo_mdi_add_child (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "Child added."); + + ret = bonobo_mdi_add_view (BONOBO_MDI (glabels_mdi), + BONOBO_MDI_CHILD (new_child)); + g_return_if_fail (ret != FALSE); + gl_debug (DEBUG_FILE, "View added."); + + gtk_widget_grab_focus (GTK_WIDGET (glabels_get_active_view ())); + + recent = gl_recent_get_model (); + gnome_recent_model_add (recent, abs_filename); + + if (open_path != NULL) + g_free (open_path); + open_path = g_path_get_dirname (abs_filename); + if (open_path != NULL) + open_path = g_strconcat (open_path, "/", NULL); + + g_free (abs_filename); + + gl_debug (DEBUG_FILE, "END true"); + + return TRUE; + + } +} + +/*****************************************************************************/ +/* "Save" menu callback. */ +/*****************************************************************************/ +gboolean +gl_file_save (glMDIChild *child) +{ + glXMLLabelStatus status; + glLabel *label = NULL; + GError *error = NULL; + gchar *filename = NULL; + GnomeRecentModel *recent; + + gl_debug (DEBUG_FILE, ""); + + g_return_val_if_fail (child != NULL, FALSE); + + label = child->label; + g_return_val_if_fail (label != NULL, FALSE); + + if (gl_label_is_untitled (label)) + { + gl_debug (DEBUG_FILE, "Untitled"); + + return gl_file_save_as (child); + } + + if (!gl_label_is_modified (label)) + { + gl_debug (DEBUG_FILE, "Not modified"); + + return TRUE; + } + + filename = gl_label_get_filename (label); + g_return_val_if_fail (filename != NULL, FALSE); + + gl_xml_label_save (label, filename, &status); + + if (status != XML_LABEL_OK) + { + GtkWidget *dialog; + + gl_debug (DEBUG_FILE, "FAILED"); + + dialog = gtk_message_dialog_new (GTK_WINDOW(glabels_get_active_window()), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Error saving file '%s'"), + filename); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + g_free (filename); + + return FALSE; + } + else + { + gl_debug (DEBUG_FILE, "OK"); + + recent = gl_recent_get_model (); + gnome_recent_model_add (recent, filename); + + g_free (filename); + + return TRUE; + } +} + +/*****************************************************************************/ +/* "Save As" menu callback. */ +/*****************************************************************************/ +gboolean +gl_file_save_as (glMDIChild *child) +{ + GtkFileSelection *fsel; + BonoboWindow *app = glabels_get_active_window (); + gboolean saved_flag = FALSE; + gboolean destroy_flag = FALSE; + + gl_debug (DEBUG_FILE, "START"); + + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (app != NULL, FALSE); + + + fsel = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save label as"))); + gtk_window_set_modal (GTK_WINDOW (fsel), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (fsel), GTK_WINDOW (app)); + + g_object_set_data (G_OBJECT (fsel), "child", child); + g_object_set_data (G_OBJECT (fsel), "saved_flag", &saved_flag); + + g_signal_connect (G_OBJECT (fsel->ok_button), "clicked", + G_CALLBACK (save_as_ok_cb), fsel); + + g_signal_connect (G_OBJECT (fsel->cancel_button), "clicked", + G_CALLBACK (save_as_cancel_cb), fsel); + + g_signal_connect (G_OBJECT (fsel), "destroy", + G_CALLBACK (save_as_destroy_cb), &destroy_flag); + + /* Recover proper state of save-as dialog */ + if (save_path != NULL) { + gtk_file_selection_set_filename (fsel, save_path); + } + + /* show the dialog */ + gtk_widget_show (GTK_WIDGET (fsel)); + + /* Hold here and process events until we are done with this dialog. */ + gtk_main (); + + /* Destroy dialog if not already destroyed. */ + if (!destroy_flag) { + /* Disconnect our destroy callback first, so that we don't kill the + * current gtk_main() loop. */ + g_signal_handlers_disconnect_by_func (GTK_OBJECT (fsel), + G_CALLBACK (save_as_destroy_cb), + &destroy_flag); + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + + gl_debug (DEBUG_FILE, "END"); + + /* Return flag as set by one of the above callbacks, TRUE = saved */ + return saved_flag; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" ok button callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_ok_cb (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *raw_filename, *filename; + GtkWidget *dlg; + glMDIChild *child; + glLabel *label; + glXMLLabelStatus status; + GnomeRecentModel *recent; + gboolean *saved_flag; + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + child = g_object_get_data (G_OBJECT(fsel), "child"); + saved_flag = g_object_get_data (G_OBJECT(fsel), "saved_flag"); + + g_return_if_fail (child != NULL); + g_return_if_fail (GL_IS_MDI_CHILD (child)); + gl_debug (DEBUG_FILE, "Got child"); + + label = child->label; + + /* get the filename */ + raw_filename = g_strdup (gtk_file_selection_get_filename (fsel)); + + gl_debug (DEBUG_FILE, "raw_filename = \"%s\"", raw_filename); + + if (!raw_filename || (raw_filename[strlen (raw_filename) - 1] == '/')) { + + dlg = gtk_message_dialog_new (GTK_WINDOW(fsel), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_CLOSE, + _("Must supply file name")); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + filename = gl_util_add_extension (raw_filename); + + gl_debug (DEBUG_FILE, "filename = \"%s\"", filename); + + gl_xml_label_save (label, filename, &status); + + gl_debug (DEBUG_FILE, "status of save = %d", status); + + if ( status != XML_LABEL_OK ) { + + dlg = gtk_message_dialog_new (GTK_WINDOW(fsel), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Error writing file '%s'"), + filename); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + *saved_flag = TRUE; + + recent = gl_recent_get_model (); + gnome_recent_model_add (recent, filename); + + if (save_path != NULL) + g_free (save_path); + save_path = g_path_get_dirname (filename); + if (save_path != NULL) + save_path = g_strconcat (save_path, "/", NULL); + + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + + g_free (filename); + } + + g_free (raw_filename); + + gl_debug (DEBUG_FILE, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" cancel button callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_cancel_cb (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gboolean *saved_flag = g_object_get_data (G_OBJECT (fsel), "saved_flag"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + *saved_flag = FALSE; + gtk_widget_hide (GTK_WIDGET (fsel)); + gtk_main_quit (); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" destroy callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_destroy_cb (GtkWidget * widget, + gboolean * destroy_flag) +{ + *destroy_flag = TRUE; + gtk_main_quit (); +} + + +/*****************************************************************************/ +/* "Close" menu callback. */ +/*****************************************************************************/ +void +gl_file_close (GtkWidget * view) +{ + gint ret; + BonoboMDIChild* child; + + gl_debug (DEBUG_FILE, "START"); + + g_return_if_fail (view != NULL); + + child = bonobo_mdi_get_child_from_view (view); + g_return_if_fail (child != NULL); + + if (g_list_length (bonobo_mdi_child_get_views (child)) > 1) + { + ret = bonobo_mdi_remove_view (BONOBO_MDI (glabels_mdi), view, FALSE); + gl_debug (DEBUG_FILE, "View removed."); + } + else + { + ret = bonobo_mdi_remove_child (BONOBO_MDI (glabels_mdi), child, FALSE); + gl_debug (DEBUG_FILE, "Child removed."); + } + + if (ret) + gl_mdi_set_active_window_title (BONOBO_MDI (glabels_mdi)); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) == NULL) + { + gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + } + + gl_debug (DEBUG_FILE, "END"); +} + +/*****************************************************************************/ +/* "Close all" */ +/*****************************************************************************/ +gboolean +gl_file_close_all (void) +{ + gboolean ret; + gl_debug (DEBUG_FILE, ""); + + gl_debug (DEBUG_FILE, "START"); + + ret = bonobo_mdi_remove_all (BONOBO_MDI (glabels_mdi), FALSE); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) == NULL) + { + gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + } + + gl_debug (DEBUG_FILE, "END"); + + return ret; +} + +/*****************************************************************************/ +/* "Exit" menu callback. */ +/*****************************************************************************/ +void +gl_file_exit (void) +{ + gl_debug (DEBUG_FILE, ""); + + if (!gl_file_close_all ()) + return; + + gl_debug (DEBUG_FILE, "All files closed."); + + /* We need to disconnect the signal because mdi "destroy" event + is connected to gl_file_exit ( i.e. this function ). */ + g_signal_handlers_disconnect_by_func (G_OBJECT (glabels_mdi), + G_CALLBACK (gl_file_exit), NULL); + + gl_prefs_save_settings (); + + gl_debug (DEBUG_FILE, "Unref glabels_mdi."); + + g_object_unref (G_OBJECT (glabels_mdi)); + + gl_debug (DEBUG_FILE, "Unref glabels_mdi: DONE"); + + gtk_main_quit (); + + gl_debug (DEBUG_FILE, "END"); +} diff --git a/glabels2/src/file.h b/glabels2/src/file.h new file mode 100644 index 0000000..4d3709c --- /dev/null +++ b/glabels2/src/file.h @@ -0,0 +1,45 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * file.h: FILE menu dialog module header file + * + * Copyright (C) 2000 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __FILE_H__ +#define __FILE_H__ + +#include "mdi-child.h" +#include "gnome-recent-view.h" + +extern void gl_file_new (void); + +extern void gl_file_open (glMDIChild *active_child); +extern gboolean gl_file_open_recent (GnomeRecentView *view, + const gchar *filename, + BonoboWindow *win); +extern gboolean gl_file_open_real (const gchar *filename, + GtkWindow *win); + +extern gboolean gl_file_save (glMDIChild *child); +extern gboolean gl_file_save_as (glMDIChild *child); + +extern void gl_file_close (GtkWidget *view); +extern gboolean gl_file_close_all (void); +extern void gl_file_exit (void); + +#endif /* __FILE_H__ */ diff --git a/glabels2/src/glabels-batch.c b/glabels2/src/glabels-batch.c new file mode 100644 index 0000000..68bfaf8 --- /dev/null +++ b/glabels2/src/glabels-batch.c @@ -0,0 +1,152 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.c: main program module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> +#include <libgnomeprint/gnome-print-master.h> + +#include "merge.h" +#include "xml-label.h" +#include "template.h" +#include "print.h" +#include "util.h" + +/*============================================*/ +/* Private globals */ +/*============================================*/ +static gboolean help_flag = FALSE; +static gboolean version_flag = FALSE; +static gchar *output = "output.ps"; +static gint n_copies = 1; +static gint n_sheets = 1; +static gboolean outline_flag = FALSE; +static gboolean reverse_flag = FALSE; + +static struct poptOption options[] = { + {"help", 'h', POPT_ARG_NONE, &help_flag, 1, + N_("print this message"), NULL}, + {"version", 'v', POPT_ARG_NONE, &version_flag, 0, + N_("print the version of glabels-batch being used"), NULL}, + {"output", 'o', POPT_ARG_STRING, &output, 0, + N_("set output filename (default=\"output.ps\")"), N_("filename")}, + {"sheets", 's', POPT_ARG_INT, &n_sheets, 0, + N_("number of sheets (default=1)"), N_("sheets")}, + {"copies", 'c', POPT_ARG_INT, &n_copies, 0, + N_("number of copies (default=1)"), N_("copies")}, + {"outline", 'l', POPT_ARG_NONE, &outline_flag, 0, + N_("print outlines (to test printer alignment)"), NULL}, + {"reverse", 'r', POPT_ARG_NONE, &reverse_flag, 0, + N_("print in reverse (i.e. a mirror image)"), NULL}, + {NULL, '\0', 0, NULL, 0, NULL, NULL} +}; + + + +/*****************************************************************************/ +/* Main */ +/*****************************************************************************/ +int +main (int argc, + char *argv[]) +{ + poptContext pctx; + gchar **args; + gint rc; + GSList *p, *file_list = NULL; + gint n_files; + GnomePrintMaster *master = NULL; + gchar *abs_fn; + GnomePrintConfig *config = NULL; + glLabel *label = NULL; + glXMLLabelStatus status; + + bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR); + textdomain (PACKAGE); + + gtk_type_init (); + + /* argument parsing */ + pctx = poptGetContext (NULL, argc, argv, options, 0); + poptSetOtherOptionHelp (pctx, _("[OPTION...] GLABELS_FILE...") ); + if ( (rc = poptGetNextOpt(pctx)) < -1 ) { + fprintf (stderr, "%s: %s\n", + poptBadOption (pctx,0), poptStrerror(rc)); + poptPrintUsage (pctx, stderr, 0); + return -1; + } + if ( version_flag ) { + fprintf ( stderr, "glabels-batch %s\n", VERSION ); + } + if ( help_flag ) { + poptPrintHelp (pctx, stderr, 0); + return -1; + } + args = (char **) poptGetArgs (pctx); + for (n_files = 0; args && args[n_files]; n_files++) { + file_list = g_slist_append (file_list, args[n_files]); + } + if ( !n_files ) { + fprintf ( stderr, _("missing glabels file\n") ); + poptPrintHelp (pctx, stderr, 0); + return -1; + } + poptFreeContext (pctx); + + /* initialize components */ + gl_merge_init (); + gl_template_init (); + + /* now print the files */ + for (p = file_list; p; p = p->next) { + gl_xml_label_open (p->data, &status); + if ( status == XML_LABEL_OK ) { + + if ( master == NULL ) { + master = gnome_print_master_new (); + config = gnome_print_master_get_config (master); + abs_fn = gl_util_make_absolute ( output ); + gnome_print_config_set (config, + GNOME_PRINT_KEY_OUTPUT_FILENAME, + abs_fn); + g_free( abs_fn ); + } + + gl_print_batch( master, label, n_sheets, n_copies, + outline_flag, reverse_flag ); + + g_object_unref( label ); + } + else { + fprintf ( stderr, _("cannot open glabels file %s\n"), + (char *)p->data ); + } + } + if ( master != NULL ) { + gnome_print_master_print (master); + } + + g_slist_free (file_list); + + return 0; +} + diff --git a/glabels2/src/glabels-ui.xml b/glabels2/src/glabels-ui.xml new file mode 100644 index 0000000..836a082 --- /dev/null +++ b/glabels2/src/glabels-ui.xml @@ -0,0 +1,328 @@ +<Root> + +<commands> + <cmd name="FileNew" _label="New" + _tip="Create a new document" pixtype="stock" pixname="gtk-new" accel="*Control*N"/> + + <cmd name="FileOpen" _label="Open" + _tip="Open a file" pixtype="stock" pixname="gtk-open" accel="*Control*O"/> + + <cmd name="FileSave" _label="Save" + _tip="Save the current file" pixtype="stock" pixname="gtk-save" + accel="*Control*S"/> + + <cmd name="FileSaveAs" _label="Save As" + _tip="Save the current file with a different name" + pixtype="stock" pixname="gtk-save-as" + accel="*Shift**Control*S"/> + + <cmd name="FilePrint" _label="Print" + _tip="Print the current file" pixtype="stock" pixname="gtk-print" + accel="*Control*P"/> + + <cmd name="FileClose" _label="Close" + _tip="Close the current file" pixtype="stock" pixname="gtk-close" + accel="*Alt*F4"/> + + <cmd name="FileCloseAll" _label="Close All" + _tip="Close all open files" pixtype="stock" pixname="gtk-close" + accel="*Shift**Alt*F4"/> + + <cmd name="FileExit" _label="Quit" _tip="Quit the program" + pixtype="stock" pixname="gtk-quit" accel="*Control*Q"/> + + + + <cmd name="EditUndo" _label="Undo" _tip="Undo the last action" + pixtype="stock" pixname="gtk-undo" accel="*Control*Z"/> + + <cmd name="EditRedo" _label="Redo" _tip="Redo the undone action" + pixtype="stock" pixname="gtk-redo" accel="*Shift**Control*Z"/> + + <cmd name="EditCut" _label="Cut" _tip="Cut the selection" + pixtype="stock" pixname="gtk-cut" accel="*Control*X"/> + + <cmd name="EditCopy" _label="Copy" + _tip="Copy the selection" pixtype="stock" pixname="gtk-copy" accel="*Control*c"/> + + <cmd name="EditPaste" _label="Paste" + _tip="Paste the clipboard" pixtype="stock" pixname="gtk-paste" accel="*Control*v"/> + + <cmd name="EditDelete" _label="Delete" + _tip="Delete the selected objects"/> + + <cmd name="EditSelectAll" _label="Select All" _tip="Select all objects" + accel="*Control*A"/> + + <cmd name="EditUnSelectAll" _label="Un-select All" _tip="Remove all selections"/> + + <cmd name="ViewToolbar" _label="_Toolbar" type="toggle" + _tip="Change the visibility of the toolbar in the current window" state="0"/> + + <cmd name="ToolbarSystem" id="ToolbarSystem" _label="_Desktop Default" type="radio" + group="buttons" state = "1" _tip="Set toolbar button style according to desktop default"/> + + <cmd name="ToolbarIcon" id="ToolbarIcon" _label="_Icon" type="radio" + group="buttons" _tip="Only show icons in the toolbar"/> + + <cmd name="ToolbarIconText" id="ToolbarIconText" _label="Icon and _Text" type="radio" + group="buttons" _tip ="Show both icons and texts in the toolbar"/> + + <cmd name="SettingsPreferences" _label="Preferences" _tip="Configure the application" + pixtype="stock" pixname="gtk-preferences"/> + + <cmd name="ToolbarTooltips" id="ToolbarTooltips" _label="Show _Tooltips" type="toggle" + _tip="Show tooltips in the toolbar" state="1"/> + + <cmd name="BonoboCustomize" _label="Customize" _tip="Customize toolbars"/> + + + <cmd name="ToolsArrow" + _tip="Select, move and modify objects" + pixtype="stock" pixname="gl_stock_arrow"/> + + <cmd name="ToolsText" + _tip="Create text object" + pixtype="stock" pixname="gl_stock_text"/> + + <cmd name="ToolsLine" + _tip="Create line object" + pixtype="stock" pixname="gl_stock_line"/> + + <cmd name="ToolsBox" + _tip="Create box/rectangle object" + pixtype="stock" pixname="gl_stock_box"/> + + <cmd name="ToolsEllipse" + _tip="Create ellipse/circle object" + pixtype="stock" pixname="gl_stock_ellipse"/> + + <cmd name="ToolsImage" + _tip="Create image object" + pixtype="stock" pixname="gl_stock_image"/> + + <cmd name="ToolsBarcode" + _tip="Create barcode object" + pixtype="stock" pixname="gl_stock_barcode"/> + + <cmd name="ToolsZoomIn" + _tip="increase magnification" + pixtype="stock" pixname="gtk-zoom-in"/> + + <cmd name="ToolsZoomOut" + _tip="decrease magnification" + pixtype="stock" pixname="gtk-zoom-out"/> + + <cmd name="ToolsZoom1to1" + _tip="restore scale to 100%" + pixtype="stock" pixname="gtk-zoom-100"/> + + <cmd name="ToolsMergeProperties" + _tip="Edit merge properties" + pixtype="stock" pixname="gl_stock_merge"/> + + + <cmd name="HelpContents" _label="Contents" _tip="Open the gedit manual" + accel="F1"/> + + <cmd name="About" _label="About..." _tip="About this application"/> + + + <cmd name="BonoboUIDump" _label="Dump XML" _tip="Dump the UI Xml description" hidden="0"/> + +</commands> + +<menu> + +<submenu name="File" _label="_File"> + + <menuitem name="FileNew" verb="" _label="_New"/> + + <menuitem name="FileOpen" verb="" _label="_Open..."/> + + <submenu name="Recents" _label="Recent _Files"> + + </submenu> + + <separator/> + + <menuitem name="FileSave" verb="" _label="_Save"/> + + <menuitem name="FileSaveAs" verb="" _label="Save _As..."/> + + <separator/> + + <menuitem name="FilePrint" verb="" _label="_Print..."/> + + <placeholder name="FileOps_1" /> + + <placeholder name="FileOps_2" delimit="top"/> + + <separator/> + + <menuitem name="FileClose" verb="" _label="_Close"/> + + <menuitem name="FileCloseAll" verb="" _label="Clos_e All"/> + + <menuitem name="FileExit" verb="" _label="_Quit"/> + +</submenu> + +<submenu name="Edit" _label="_Edit"> + + <menuitem name="EditCut" verb="" _label="Cu_t"/> + + <menuitem name="EditCopy" verb="" _label="_Copy"/> + + <menuitem name="EditPaste" verb="" _label="_Paste"/> + + <menuitem name="EditDelete" verb="" _label="_Delete"/> + + <placeholder name="EditOps_1" /> + + <separator/> + + <placeholder name="EditOps_2" /> + + <menuitem name="EditSelectAll" verb="" _label="Select _All"/> + + <menuitem name="EditUnSelectAll" verb="" _label="U_n-select All"/> + + <placeholder name="EditOps_3" /> + + <placeholder name="EditOps_4" delimit="top"/> + + <placeholder name="EditOps_5" delimit="top"/> + + <separator/> + + <menuitem name="SettingsPreferences" verb="" _label="Pr_eferences..."/> + +</submenu> + +<submenu name="View" _label="_View" hidden="0"> + + <menuitem name="ViewToolbar" id="ViewToolbar" verb=""/> + + <separator/> + + <submenu name="CustomizeToolbar" _label="_Customize Toolbar"> + + <menuitem name="ToolbarSystem" verb=""/> + + <menuitem name="ToolbarIcon" verb=""/> + + <menuitem name="ToolbarIconText" verb=""/> + + <separator/> + + <menuitem name="ToolbarTooltips" verb=""/> + + </submenu> + + <placeholder name="ViewOps" delimit="top"/> + +</submenu> + + +<submenu name="Tools" _label="_Tools" hidden="0"> + + <menuitem name="ToolsArrow" verb="" _label="Select"/> + + <separator/> + + <menuitem name="ToolsText" verb="" _label="Text"/> + <menuitem name="ToolsBox" verb="" _label="Box"/> + <menuitem name="ToolsLine" verb="" _label="Line"/> + <menuitem name="ToolsEllipse" verb="" _label="Ellipse"/> + <menuitem name="ToolsImage" verb="" _label="Image"/> + <menuitem name="ToolsBarcode" verb="" _label="Barcode"/> + + <separator/> + + <menuitem name="ToolsZoomIn" verb="" _label="Zoom In"/> + <menuitem name="ToolsZoomOut" verb="" _label="Zoom Out"/> + <menuitem name="ToolsZoom1to1" verb="" _label="Zoom 1:1"/> + + <separator/> + + <menuitem name="ToolsMergeProperties" verb="" _label="Merge Properties"/> + +</submenu> + + +<submenu name="Documents" _label="_Documents"> + + <placeholder name="DocumentsOps_1" delimit="bottom"/> + + <placeholder name="OpenDocuments" /> + + <placeholder name="DocumentsOps_2" delimit="top"/> + +</submenu> + +<submenu name="Help" _label="_Help"> + + <menuitem name="HelpContents" verb="" _label="_Contents"/> + + <menuitem name="About" verb="" _label="_About..."/> + +</submenu> + +<submenu name="Debug" _label="_Debug" hidden="1"> + + <menuitem name="BonoboUIDump" verb=""/> + <menuitem name="BonoboCustomize" label ="Customize" verb=""/> +</submenu> + +</menu> + +<dockitem name="Toolbar" _tip="Main toolbar" config="0" + behavior = "exclusive" in_new_band="1"> + + <toolitem name="FileNew" verb=""/> + <toolitem name="FileOpen" verb=""/> + <toolitem name="FileSave" verb=""/> + <toolitem name="FileClose" verb=""/> + + <separator/> + + <toolitem name="FilePrint" verb=""/> + + <separator/> + + <toolitem name="EditCut" verb=""/> + <toolitem name="EditCopy" verb=""/> + <toolitem name="EditPaste" verb=""/> + +</dockitem> + + +<dockitem name="ToolbarTools" _tip="Tools toolbar" config="0" + behavior = "exclusive" in_new_band="1" band_num="2"> + + <toolitem name="ToolsArrow" verb=""/> + + <separator/> + + <toolitem name="ToolsText" verb=""/> + <toolitem name="ToolsBox" verb=""/> + <toolitem name="ToolsLine" verb=""/> + <toolitem name="ToolsEllipse" verb=""/> + <toolitem name="ToolsImage" verb=""/> + <toolitem name="ToolsBarcode" verb=""/> + + <separator/> + + <toolitem name="ToolsZoomIn" verb=""/> + <toolitem name="ToolsZoomOut" verb=""/> + <toolitem name="ToolsZoom1to1" verb=""/> + + <separator/> + + <toolitem name="ToolsMergeProperties" verb=""/> + +</dockitem> + +</Root> + diff --git a/glabels2/src/glabels.c b/glabels2/src/glabels.c new file mode 100644 index 0000000..c402fc6 --- /dev/null +++ b/glabels2/src/glabels.c @@ -0,0 +1,230 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.c: GLabels main module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit2.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#include <config.h> + +#include <libgnome/libgnome.h> +#include <libgnomeui/libgnomeui.h> +#include <libgnomeui/gnome-window-icon.h> + +#include "glabels.h" +#include "splash.h" +#include "stock.h" +#include "merge.h" +#include "template.h" +#include "mdi.h" +#include "prefs.h" +#include "file.h" +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define ICON_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-icon.png") +#else +#define ICON_PIXMAP gnome_pixmap_file("glabels/glabels-icon.png") +#endif + +glMDI *glabels_mdi = NULL; +gboolean glabels_close_x_button_pressed = FALSE; +gboolean glabels_exit_button_pressed = FALSE; + +static const struct poptOption options [] = +{ + { "debug-view", '\0', POPT_ARG_NONE, &gl_debug_view, 0, + N_("Show view debugging messages."), NULL }, + + { "debug-item", '\0', POPT_ARG_NONE, &gl_debug_item, 0, + N_("Show item debugging messages."), NULL }, + + { "debug-print", '\0', POPT_ARG_NONE, &gl_debug_print, 0, + N_("Show printing debugging messages."), NULL }, + + { "debug-prefs", '\0', POPT_ARG_NONE, &gl_debug_prefs, 0, + N_("Show prefs debugging messages."), NULL }, + + { "debug-file", '\0', POPT_ARG_NONE, &gl_debug_file, 0, + N_("Show file debugging messages."), NULL }, + + { "debug-label", '\0', POPT_ARG_NONE, &gl_debug_label, 0, + N_("Show document debugging messages."), NULL }, + + { "debug-template", '\0', POPT_ARG_NONE, &gl_debug_template, 0, + N_("Show template debugging messages."), NULL }, + + { "debug-xml", '\0', POPT_ARG_NONE, &gl_debug_xml, 0, + N_("Show xml debugging messages."), NULL }, + + { "debug-merge", '\0', POPT_ARG_NONE, &gl_debug_merge, 0, + N_("Show document merge debugging messages."), NULL }, + + { "debug-commands", '\0', POPT_ARG_NONE, &gl_debug_commands, 0, + N_("Show commands debugging messages."), NULL }, + + { "debug-undo", '\0', POPT_ARG_NONE, &gl_debug_undo, 0, + N_("Show undo debugging messages."), NULL }, + + { "debug-recent", '\0', POPT_ARG_NONE, &gl_debug_recent, 0, + N_("Show recent debugging messages."), NULL }, + + { "debug-mdi", '\0', POPT_ARG_NONE, &gl_debug_mdi, 0, + N_("Show mdi debugging messages."), NULL }, + + { "debug-media-select", '\0', POPT_ARG_NONE, &gl_debug_media_select, 0, + N_("Show media select widget debugging messages."), NULL }, + + { "debug-mini-preview", '\0', POPT_ARG_NONE, &gl_debug_mini_preview, 0, + N_("Show mini preview widget debugging messages."), NULL }, + + { "debug-wdgt", '\0', POPT_ARG_NONE, &gl_debug_wdgt, 0, + N_("Show widget debugging messages."), NULL }, + + { "debug", '\0', POPT_ARG_NONE, &gl_debug_all, 0, + N_("Turn on all debugging messages."), NULL }, + + {NULL, '\0', 0, NULL, 0} +}; + + +int +main (int argc, char **argv) +{ + GValue value = { 0, }; + GnomeProgram *program; + poptContext ctx; + char **args; + GList *file_list = NULL, *p; + gint i; + + bindtextdomain (GETTEXT_PACKAGE, GLABELS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + /* Initialize gnome program */ + program = gnome_program_init ("glabels", VERSION, + LIBGNOMEUI_MODULE, argc, argv, + GNOME_PARAM_POPT_TABLE, options, + NULL); + + /* Splash screen */ + gl_splash (); + + gl_stock_init(); + + /* Set default icon */ + if (!g_file_test (ICON_PIXMAP, G_FILE_TEST_EXISTS)) + { + g_warning ("Could not find %s", ICON_PIXMAP); + } + else + { + gnome_window_icon_set_default_from_file (ICON_PIXMAP); + } + + /* Load user preferences */ + gl_prefs_init (); + gl_prefs_load_settings (); + + gl_template_init(); + gl_merge_init(); + gl_merge_ui_init(); + gl_recent_init(); + + /* Parse args and build the list of files to be loaded at startup */ + g_value_init (&value, G_TYPE_POINTER); + g_object_get_property (G_OBJECT (program), + GNOME_PARAM_POPT_CONTEXT, &value); + ctx = g_value_get_pointer (&value); + g_value_unset (&value); + args = (char**) poptGetArgs(ctx); + for (i = 0; args && args[i]; i++) + { + file_list = g_list_append (file_list, args[i]); + } + + /* Create glabels_mdi and open the first top level window */ + glabels_mdi = gl_mdi_new (); + bonobo_mdi_open_toplevel (BONOBO_MDI (glabels_mdi), NULL); + + for (p = file_list; p; p = p->next) { + gl_file_open_real (p->data, + GTK_WINDOW(glabels_get_active_window())); + } + g_list_free (file_list); + + gtk_main(); + + return 0; +} + + +BonoboWindow* +glabels_get_active_window (void) +{ + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + return bonobo_mdi_get_active_window (BONOBO_MDI (glabels_mdi)); +} + +glLabel* +glabels_get_active_label (void) +{ + BonoboMDIChild *active_child; + + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + active_child = bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)); + + if (active_child == NULL) + return NULL; + + return GL_MDI_CHILD (active_child)->label; +} + +glView* +glabels_get_active_view (void) +{ + GtkWidget *active_view; + + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + active_view = bonobo_mdi_get_active_view (BONOBO_MDI (glabels_mdi)); + + if (active_view == NULL) + return NULL; + + return GL_VIEW (active_view); +} + +GList* +glabels_get_top_windows (void) +{ + g_return_val_if_fail (glabels_mdi != NULL, NULL); + + return bonobo_mdi_get_windows (BONOBO_MDI (glabels_mdi)); +} + diff --git a/glabels2/src/glabels.h b/glabels2/src/glabels.h new file mode 100644 index 0000000..2d633c5 --- /dev/null +++ b/glabels2/src/glabels.h @@ -0,0 +1,54 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.h: GLabels main module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#ifndef __GLABELS_H__ +#define __GLABELS_H__ + +#include <gmodule.h> +#include <glib/glist.h> +#include <bonobo/bonobo-window.h> + +#include "mdi.h" +#include "label.h" +#include "view.h" + +extern glMDI* glabels_mdi; +extern gboolean glabels_close_x_button_pressed; +extern gboolean glabels_exit_button_pressed; + +BonoboWindow* glabels_get_active_window (void); +glLabel* glabels_get_active_label (void); +glView* glabels_get_active_view (void); +GList* glabels_get_top_windows (void); + + +#endif /* __GLABELS_H__ */ + + + diff --git a/glabels2/src/gnome-recent-marshal.list b/glabels2/src/gnome-recent-marshal.list new file mode 100644 index 0000000..1e99a95 --- /dev/null +++ b/glabels2/src/gnome-recent-marshal.list @@ -0,0 +1 @@ +BOOL:STRING diff --git a/glabels2/src/gnome-recent-model.c b/glabels2/src/gnome-recent-model.c new file mode 100644 index 0000000..9c02705 --- /dev/null +++ b/glabels2/src/gnome-recent-model.c @@ -0,0 +1,771 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: + * James Willcox <jwillcox@cs.indiana.edu> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gtk/gtk.h> +#include <gconf/gconf-client.h> +#include <libbonoboui.h> +#include <libgnomevfs/gnome-vfs.h> +#include "gnome-recent-model.h" +#include "gnome-recent-view.h" + +#define GNOME_RECENT_MODEL_BASE_KEY "/desktop/gnome/recent_files" +#define GNOME_RECENT_MODEL_GLOBAL_LIMIT_KEY "global_limit" +#define GNOME_RECENT_MODEL_GLOBAL_LIMIT_ENV "GNOME_RECENT_MODEL_GLOBAL_LIMIT" +#define GNOME_RECENT_MODEL_GLOBAL_LIST "gnome-recent-global" + +static void gnome_recent_model_class_init (GnomeRecentModelClass * klass); +static void gnome_recent_model_init (GnomeRecentModel * recent); +static gchar *gnome_recent_model_gconf_key (GnomeRecentModel * recent); +static void gnome_recent_model_notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data); +static GSList * gnome_recent_model_delete_from_list (GnomeRecentModel *recent, + GSList *list, + const gchar *uri); +static GSList * gnome_recent_model_gconf_to_list (GConfValue* value); +static void gnome_recent_model_g_slist_deep_free (GSList *list); +static void gnome_recent_model_set_appname (GnomeRecentModel *recent, gchar *appname); + +struct _GnomeRecentModel { + GObject parent_instance; /* We emit signals */ + + gchar *appname; /* the app that owns this object */ + GConfClient *gconf_client; /* we use GConf to store stuff */ + unsigned int limit; /* maximum number of items to store */ + + GnomeRecentModel *global; /* Another GnomeRecentModel object, + * representing the global + * recent uri list + */ + + GHashTable *monitors; /* A hash table holding + * GnomeVfsMonitorHandle objects. + */ +}; + +struct _GnomeRecentModelClass { + GObjectClass parent_class; + + void (*changed) (GnomeRecentModel *recent, const GSList *list); +}; + +struct _GnomeRecentModelMenuData { + GnomeRecentModel *recent; + gchar *uri; +}; + +typedef struct _GnomeRecentModelMenuData GnomeRecentModelMenuData; + +enum { + CHANGED, + LAST_SIGNAL +}; + +/* GObject properties */ +enum { + PROP_BOGUS, + PROP_APPNAME, + PROP_LIMIT, +}; + +static GType model_signals[LAST_SIGNAL] = { 0 }; +static GObjectClass *parent_class = NULL; + +/** + * gnome_recent_model_get_type: + * @: + * + * This returns a GType representing a GnomeRecentModel object. + * + * Returns: a GType + */ +GType +gnome_recent_model_get_type (void) +{ + static GType gnome_recent_model_type = 0; + + if(!gnome_recent_model_type) { + static const GTypeInfo gnome_recent_model_info = { + sizeof (GnomeRecentModelClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc)gnome_recent_model_class_init, /* class init */ + NULL, /* class finalize */ + NULL, /* class data */ + sizeof (GnomeRecentModel), + 0, + (GInstanceInitFunc) gnome_recent_model_init + }; + + gnome_recent_model_type = g_type_register_static (G_TYPE_OBJECT, + "GnomeRecentModel", + &gnome_recent_model_info, 0); + } + + return gnome_recent_model_type; +} + +static void +gnome_recent_model_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeRecentModel *recent = GNOME_RECENT_MODEL (object); + gchar *appname; + + switch (prop_id) + { + case PROP_APPNAME: + appname = g_strdup (g_value_get_string (value)); + gnome_recent_model_set_appname (recent, appname); + break; + case PROP_LIMIT: + gnome_recent_model_set_limit (GNOME_RECENT_MODEL (recent), + g_value_get_int (value)); + break; + default: + break; + } +} + +static void +gnome_recent_model_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GnomeRecentModel *recent = GNOME_RECENT_MODEL (object); + + switch (prop_id) + { + case PROP_APPNAME: + g_value_set_string (value, recent->appname); + break; + case PROP_LIMIT: + g_value_set_int (value, recent->limit); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gnome_recent_model_class_init (GnomeRecentModelClass * klass) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->set_property = gnome_recent_model_set_property; + object_class->get_property = gnome_recent_model_get_property; + + model_signals[CHANGED] = g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeRecentModelClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + + g_object_class_install_property (object_class, + PROP_APPNAME, + g_param_spec_string ("appname", + "Application Name", + "The name of the application using this object.", + "gnome-app", + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_LIMIT, + g_param_spec_int ("limit", + "Limit", + "The maximum number of items to be allowed in the list.", + 1, + 1000, + 10, + G_PARAM_READWRITE)); + + klass->changed = NULL; +} + + +static void +gnome_recent_model_init (GnomeRecentModel * recent) +{ + int argc=0; + char **argv=NULL; + + if (!gconf_init (argc, argv, NULL)) + { + g_warning ("GConf Initialization failed."); + return; + } + + if (!gnome_vfs_init ()) { + g_warning ("gnome-vfs initialization failed."); + return; + } + + recent->gconf_client = gconf_client_get_default (); + recent->monitors = g_hash_table_new (g_str_hash, g_str_equal); +} + +static gint +gnome_recent_model_get_global_limit (GnomeRecentModel *model) +{ + char *key; + gint limit; + + key = g_strdup_printf ("%s/%s", GNOME_RECENT_MODEL_BASE_KEY, + GNOME_RECENT_MODEL_GLOBAL_LIMIT_KEY); + + + limit = gconf_client_get_int (model->gconf_client, + key, NULL); + + if (limit <= 0) { + /* ok, gconf schemas are not functioning, so assign a sane value */ + limit = 10; + } + + g_free (key); + + return limit; +} + + +/** + * gnome_recent_model_new: + * @appname: The name of your application. + * @limit: The maximum number of items allowed. + * + * This creates a new GnomeRecentModel object. + * + * Returns: a GnomeRecentModel object + */ +GnomeRecentModel * +gnome_recent_model_new (const gchar *appname, gint limit) +{ + GnomeRecentModel *model; + + g_return_val_if_fail (appname, NULL); + g_return_val_if_fail (limit > 0, NULL); + + model = GNOME_RECENT_MODEL (g_object_new (gnome_recent_model_get_type (), + "appname", + appname, + "limit", + limit, NULL)); + + g_return_val_if_fail (model, NULL); + + return model; +} + +/** + * gnome_recent_model_new_global: + * @ + * + * This creates a new GnomeRecentModel object, with the global history list. + * + * Returns: a GnomeRecentModel object + */ +GnomeRecentModel * +gnome_recent_model_new_global (void) +{ + GnomeRecentModel *model; + gint limit; + + model = GNOME_RECENT_MODEL (g_object_new(gnome_recent_model_get_type (), + "appname", + GNOME_RECENT_MODEL_GLOBAL_LIST, + NULL)); + + g_return_val_if_fail (model, NULL); + + limit = gnome_recent_model_get_global_limit (model); + gnome_recent_model_set_limit (model, limit); + + return model; +} + + + +static void +gnome_recent_model_monitor_cb (GnomeVFSMonitorHandle *handle, + const gchar *monitor_uri, + const gchar *info_uri, + GnomeVFSMonitorEventType event_type, + gpointer data) +{ + GnomeRecentModel *recent= GNOME_RECENT_MODEL (data); + + g_return_if_fail (recent); + + /* if a file was deleted, we just remove it from our list */ + switch (event_type) { + case GNOME_VFS_MONITOR_EVENT_DELETED: + gnome_recent_model_delete (recent, monitor_uri); + g_hash_table_remove (recent->monitors, monitor_uri); + break; + default: + break; + } + +} + +static void +gnome_recent_model_monitor_uri (GnomeRecentModel *recent, const gchar *uri) +{ + GnomeVFSMonitorHandle *handle=NULL; + GnomeVFSResult result; + + g_return_if_fail (recent); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + g_return_if_fail (uri); + + handle = g_hash_table_lookup (recent->monitors, uri); + if (handle == NULL) { + + /* this is a new uri, so we need to monitor it */ + result = gnome_vfs_monitor_add (&handle, + uri, + GNOME_VFS_MONITOR_FILE, + gnome_recent_model_monitor_cb, + recent); + if (result == GNOME_VFS_OK) { + g_hash_table_insert (recent->monitors, + g_strdup (uri), + handle); + } + } +} + +static void +gnome_recent_model_monitor_uri_list (GnomeRecentModel *recent, + GSList *list) +{ + GSList *p; + const gchar *uri; + + p = list; + while (p != NULL) { + uri = (const gchar *)p->data; + + gnome_recent_model_monitor_uri (recent, uri); + + p = p->next; + } +} + +#if 0 +static void +gnome_recent_model_monitor_cancel (GnomeRecentModel *recent, const gchar *uri) +{ + g_return_if_fail (recent); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + g_return_if_fail (uri); + + g_hash_table_remove (recent->monitors, uri); +} +#endif + +/** + * gnome_recent_model_add: + * @recent: A GnomeRecentModel object. + * @uri: The URI you want to add to the list. + * + * This function adds a URI to the list of recently used URIs. + * + * Returns: a gboolean + */ +gboolean +gnome_recent_model_add (GnomeRecentModel * recent, const gchar * uri) +{ + GSList *uri_lst; + gchar *gconf_key; + + g_return_val_if_fail (recent, FALSE); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), FALSE); + g_return_val_if_fail (recent->gconf_client, FALSE); + g_return_val_if_fail (uri, FALSE); + + gconf_key = gnome_recent_model_gconf_key (recent); + + + uri_lst = gconf_client_get_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, NULL); + + /* if this is already in our list, remove it */ + uri_lst = gnome_recent_model_delete_from_list (recent, uri_lst, uri); + + /* prepend the new one */ + uri_lst = g_slist_prepend (uri_lst, g_strdup (uri)); + + /* if we're over the limit, delete from the end */ + while (g_slist_length (uri_lst) > recent->limit) + { + gchar *tmp_uri; + tmp_uri = g_slist_nth_data (uri_lst, g_slist_length (uri_lst)-1); + uri_lst = g_slist_remove (uri_lst, tmp_uri); + g_free (tmp_uri); + } + + gconf_client_set_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, + uri_lst, NULL); + + gconf_client_suggest_sync (recent->gconf_client, NULL); + + /* add to the global list */ + if (recent->global) + gnome_recent_model_add (GNOME_RECENT_MODEL (recent->global), uri); + + g_free (gconf_key); + gnome_recent_model_g_slist_deep_free (uri_lst); + + return TRUE; +} + + +/** + * gnome_recent_model_delete: + * @recent: A GnomeRecentModel object. + * @uri: The URI you want to delete from the list. + * + * This function deletes a URI from the list of recently used URIs. + * + * Returns: a gboolean + */ +gboolean +gnome_recent_model_delete (GnomeRecentModel * recent, const gchar * uri) +{ + GSList *uri_lst; + GSList *new_uri_lst; + gboolean ret = FALSE; + gchar *gconf_key; + + g_return_val_if_fail (recent, FALSE); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), FALSE); + g_return_val_if_fail (recent->gconf_client, FALSE); + g_return_val_if_fail (uri, FALSE); + + gconf_key = gnome_recent_model_gconf_key (recent); + uri_lst = gconf_client_get_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, NULL); + + new_uri_lst = gnome_recent_model_delete_from_list (recent, uri_lst, uri); + + /* if it wasn't deleted, no need to cause unneeded updates */ + /* + if (new_uri_lst == uri_lst) { + return FALSE; + } + else + uri_lst = new_uri_lst; + */ + + /* delete it from gconf */ + gconf_client_set_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, + new_uri_lst, + NULL); + gconf_client_suggest_sync (recent->gconf_client, NULL); + + /* delete from the global list */ + if (recent->global) + gnome_recent_model_delete (GNOME_RECENT_MODEL (recent->global), uri); + + + g_free (gconf_key); + gnome_recent_model_g_slist_deep_free (new_uri_lst); + + return ret; +} + +/** + * gnome_recent_model_get_list: + * @recent: A GnomeRecentModel object. + * + * This returns a linked list of strings (URIs) currently held + * by this object. + * + * Returns: A GSList * + */ +GSList * +gnome_recent_model_get_list (GnomeRecentModel * recent) +{ + GSList *uri_lst; + gchar *gconf_key = gnome_recent_model_gconf_key (recent); + + g_return_val_if_fail (recent, NULL); + g_return_val_if_fail (recent->gconf_client, NULL); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), NULL); + + uri_lst = gconf_client_get_list (recent->gconf_client, + gconf_key, + GCONF_VALUE_STRING, NULL); + + g_free (gconf_key); + + /* FIXME: This sucks. */ + gnome_recent_model_monitor_uri_list (recent, uri_lst); + + return uri_lst; +} + + + +/** + * gnome_recent_model_set_limit: + * @recent: A GnomeRecentModel object. + * @limit: The maximum number of items allowed in the list. + * + * Use this function to constrain the number of items allowed in the list. + * The default is %GNOME_RECENT_MODEL_DEFAULT_LIMIT. + * + */ +void +gnome_recent_model_set_limit (GnomeRecentModel *recent, gint limit) +{ + GSList *list; + int len; + unsigned int i; + + g_return_if_fail (recent); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + g_return_if_fail (limit > 0); + recent->limit = limit; + + list = gnome_recent_model_get_list (recent); + len = g_slist_length (list); + + if (len <= limit) return; + + /* if we're over the limit, delete from the end */ + i=g_slist_length (list); + while (i > recent->limit) + { + gchar *uri = g_slist_nth_data (list, i-1); + gnome_recent_model_delete (recent, uri); + + i--; + } + + gnome_recent_model_g_slist_deep_free (list); +} + + +/** + * gnome_recent_model_get_limit: + * @recent: A GnomeRecentModel object. + * + */ +gint +gnome_recent_model_get_limit (GnomeRecentModel *recent) +{ + g_return_val_if_fail (recent, -1); + g_return_val_if_fail (GNOME_IS_RECENT_MODEL (recent), -1); + + return recent->limit; +} + + +/** + * gnome_recent_model_clear: + * @recent: A GnomeRecentModel object. + * + * This function clears the list of recently used URIs. + * + */ +void +gnome_recent_model_clear (GnomeRecentModel *recent) +{ + gchar *key; + + g_return_if_fail (recent); + g_return_if_fail (recent->gconf_client); + g_return_if_fail (GNOME_IS_RECENT_MODEL (recent)); + + key = gnome_recent_model_gconf_key (recent); + + gconf_client_unset (recent->gconf_client, key, NULL); +} + +static void +gnome_recent_model_set_appname (GnomeRecentModel *recent, gchar *appname) +{ + gchar *key; + gint notify_id; + + g_return_if_fail (recent); + g_return_if_fail (appname); + + recent->appname = appname; + + /* if this isn't the global list embed a global one */ + if (strcmp (appname, GNOME_RECENT_MODEL_GLOBAL_LIST)) { + recent->global = gnome_recent_model_new_global (); + } + + /* Set up the gconf notification stuff */ + key = gnome_recent_model_gconf_key (recent); + gconf_client_add_dir (recent->gconf_client, + GNOME_RECENT_MODEL_BASE_KEY, GCONF_CLIENT_PRELOAD_NONE, NULL); + notify_id = gconf_client_notify_add (recent->gconf_client, + key, + gnome_recent_model_notify_cb, + recent, NULL, NULL); + + + + g_free (key); +} + +static GSList * +gnome_recent_model_delete_from_list (GnomeRecentModel *recent, GSList *list, + const gchar *uri) +{ + unsigned int i; + gchar *text; + + for (i = 0; i < g_slist_length (list); i++) { + text = g_slist_nth_data (list, i); + + if (!strcmp (text, uri)) { + list = g_slist_remove (list, text); + g_free (text); + } + } + + return list; +} + +/* this takes a list of GConfValues, and returns a list of strings */ +static GSList * +gnome_recent_model_gconf_to_list (GConfValue* value) +{ + GSList* iter; + GSList *list = NULL; + + g_return_val_if_fail (value, NULL); + + iter = gconf_value_get_list(value); + + while (iter != NULL) + { + GConfValue* element = iter->data; + gchar *text = g_strdup (gconf_value_get_string (element)); + + list = g_slist_prepend (list, text); + + iter = g_slist_next(iter); + } + + list = g_slist_reverse (list); + + return list; +} + +static void +gnome_recent_model_g_slist_deep_free (GSList *list) +{ + GSList *lst; + + if (list == NULL) + return; + + lst = list; + while (lst) { + g_free (lst->data); + lst->data = NULL; + lst = lst->next; + } + + g_slist_free (list); +} + +static gchar * +gnome_recent_model_gconf_key (GnomeRecentModel * model) +{ + gchar *key; + + g_return_val_if_fail (model, NULL); + + key = g_strdup_printf ("%s/%s", GNOME_RECENT_MODEL_BASE_KEY, model->appname); + return key; +} + +/* +static void +print_list (GSList *list) +{ + while (list) { + g_print ("%s, ", (char *)list->data); + + list = list->next; + } + g_print ("\n\n"); +} +*/ + +/* this is the gconf notification callback. */ +static void +gnome_recent_model_notify_cb (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + GSList *list=NULL; + GnomeRecentModel *recent = user_data; + + if (entry->value == NULL) { + g_signal_emit (G_OBJECT(recent), model_signals[CHANGED], 0, NULL); + return; + } + + list = gnome_recent_model_gconf_to_list (entry->value); + + gnome_recent_model_monitor_uri_list (recent, list); + + g_signal_emit (G_OBJECT(recent), model_signals[CHANGED], 0, list); + + gnome_recent_model_g_slist_deep_free (list); +} + + +gchar * +gnome_recent_model_get_appname (GnomeRecentModel *model) +{ + return g_strdup (model->appname); +} diff --git a/glabels2/src/gnome-recent-model.h b/glabels2/src/gnome-recent-model.h new file mode 100644 index 0000000..1ccc67d --- /dev/null +++ b/glabels2/src/gnome-recent-model.h @@ -0,0 +1,40 @@ +/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +#ifndef __GNOME_RECENT_MODEL_H__ +#define __GNOME_RECENT_MODEL_H__ + +#include <libbonoboui.h> + +G_BEGIN_DECLS + +#define GNOME_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnome_recent_model_get_type (), GnomeRecentModel) +#define GNOME_RECENT_MODEL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnome_recent_model_get_type (), GnomeRecentModelClass) +#define GNOME_IS_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnome_recent_model_get_type ()) + +typedef struct _GnomeRecentModel GnomeRecentModel; + +typedef struct _GnomeRecentModelClass GnomeRecentModelClass; + +GType gnome_recent_model_get_type (void); + +/* constructors */ +GnomeRecentModel * gnome_recent_model_new (const gchar *appname, + gint limit); +GnomeRecentModel * gnome_recent_model_new_global (void); + + + +/* public methods */ +gboolean gnome_recent_model_add (GnomeRecentModel *recent, + const gchar *uri); +gboolean gnome_recent_model_delete (GnomeRecentModel *recent, + const gchar *uri); +void gnome_recent_model_clear (GnomeRecentModel *recent); +GSList * gnome_recent_model_get_list (GnomeRecentModel *recent); +void gnome_recent_model_set_limit (GnomeRecentModel *recent, + gint limit); +gint gnome_recent_model_get_limit (GnomeRecentModel *recent); +gchar *gnome_recent_model_get_appname (GnomeRecentModel *recent); + +G_END_DECLS + +#endif /* __GNOME_RECENT_MODEL_H__ */ diff --git a/glabels2/src/gnome-recent-util.c b/glabels2/src/gnome-recent-util.c new file mode 100644 index 0000000..c898876 --- /dev/null +++ b/glabels2/src/gnome-recent-util.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <gtk/gtk.h> +#include <string.h> +#include "gnome-recent-util.h" + +/* ripped out of gedit2 */ +gchar* +gnome_recent_util_escape_underlines (const gchar* text) +{ + GString *str; + gint length; + const gchar *p; + const gchar *end; + + g_return_val_if_fail (text != NULL, NULL); + + length = strlen (text); + + str = g_string_new (""); + + p = text; + end = text + length; + + while (p != end) + { + const gchar *next; + next = g_utf8_next_char (p); + + switch (*p) + { + case '_': + g_string_append (str, "__"); + break; + default: + g_string_append_len (str, p, next - p); + break; + } + + p = next; + } + + return g_string_free (str, FALSE); +} diff --git a/glabels2/src/gnome-recent-util.h b/glabels2/src/gnome-recent-util.h new file mode 100644 index 0000000..989c830 --- /dev/null +++ b/glabels2/src/gnome-recent-util.h @@ -0,0 +1,9 @@ + +G_BEGIN_DECLS + + +gchar *gnome_recent_util_escape_underlines (const gchar *uri); + + + +G_END_DECLS diff --git a/glabels2/src/gnome-recent-view-bonobo.c b/glabels2/src/gnome-recent-view-bonobo.c new file mode 100644 index 0000000..f5a015c --- /dev/null +++ b/glabels2/src/gnome-recent-view-bonobo.c @@ -0,0 +1,500 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: + * James Willcox <jwillcox@cs.indiana.edu> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gtk/gtk.h> +#include <gconf/gconf-client.h> +#include <libbonoboui.h> +#include <libgnomevfs/gnome-vfs.h> +#include "gnome-recent-model.h" +#include "gnome-recent-view.h" +#include "gnome-recent-view-bonobo.h" +#include "gnome-recent-util.h" +#include "gnome-recent-marshal.h" + +#define GNOME_RECENT_VERB_NAME "-uri-" + +struct _GnomeRecentViewBonobo { + GObject parent_instance; /* We emit signals */ + + BonoboUIComponent *uic; + gchar *path; /* The menu path where our stuff + * will go + */ + + gulong changed_cb_id; + + GnomeRecentModel *model; +}; + +struct _GnomeRecentViewBonoboClass { + GObjectClass parent_class; + + void (*activate) (GnomeRecentViewBonobo *view, const gchar *uri); +}; + +struct _GnomeRecentViewBonoboMenuData { + GnomeRecentViewBonobo *view; + gchar *uri; +}; + +typedef struct _GnomeRecentViewBonoboMenuData GnomeRecentViewBonoboMenuData; + +enum { + ACTIVATE, + LAST_SIGNAL +}; + +/* GObject properties */ +enum { + PROP_BOGUS, + PROP_UI_COMPONENT, + PROP_MENU_PATH +}; + +static guint gnome_recent_view_bonobo_signals[LAST_SIGNAL] = { 0 }; + +static void +gnome_recent_view_bonobo_clear (GnomeRecentView *view_parent) +{ + gint i=1; + gboolean done=FALSE; + gchar *appname; + GnomeRecentModel *model; + GnomeRecentViewBonobo *view; + + g_return_if_fail (view_parent); + view = GNOME_RECENT_VIEW_BONOBO (view_parent); + g_return_if_fail (view->uic); + + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (view)); + appname = gnome_recent_model_get_appname (model); + + while (!done) + { + gchar *verb_name = g_strdup_printf ("%s%s%d", appname,GNOME_RECENT_VERB_NAME, i); + gchar *item_path = g_strconcat (view->path, "/", verb_name, NULL); + if (bonobo_ui_component_path_exists (view->uic, item_path, NULL)) + bonobo_ui_component_rm (view->uic, item_path, NULL); + else + done=TRUE; + + g_free (item_path); + g_free (verb_name); + + i++; + } + + g_free (appname); +} + +static void +gnome_recent_view_bonobo_menu_cb (BonoboUIComponent *uic, gpointer data, const char *cname) +{ + gboolean ret; + GnomeRecentViewBonoboMenuData *md = (GnomeRecentViewBonoboMenuData *) data; + GnomeRecentModel *model; + + g_return_if_fail (md); + g_return_if_fail (md->uri); + g_return_if_fail (md->view); + g_return_if_fail (GNOME_IS_RECENT_VIEW_BONOBO (md->view)); + + ret = FALSE; + g_signal_emit (G_OBJECT(md->view), + gnome_recent_view_bonobo_signals[ACTIVATE], 0, + md->uri, &ret); + + if (!ret) { + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (md->view)); + gnome_recent_model_delete (model, md->uri); + } +} + +static void +gnome_recent_view_bonobo_menu_data_destroy_cb (gpointer data, GClosure *closure) +{ + GnomeRecentViewBonoboMenuData *md = data; + + g_free (md->uri); + g_free (md); +} + + +static void +gnome_recent_view_bonobo_set_list (GnomeRecentViewBonobo *view, GSList *list) +{ + BonoboUIComponent* ui_component; + unsigned int i; + gchar *label = NULL; + gchar *verb_name = NULL; + gchar *tip = NULL; + gchar *escaped_name = NULL; + gchar *item_path = NULL; + gchar *uri; + gchar *cmd; + gchar *appname; + GnomeRecentViewBonoboMenuData *md; + GnomeRecentModel *model; + GClosure *closure; + + g_return_if_fail (view); + + ui_component = view->uic; + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (view)); + appname = gnome_recent_model_get_appname (model); + + gnome_recent_view_bonobo_clear (GNOME_RECENT_VIEW (view)); + + bonobo_ui_component_freeze (ui_component, NULL); + + for (i = 1; i <= g_slist_length (list); ++i) + { + + /* this is what gets passed to our private "activate" callback */ + md = (GnomeRecentViewBonoboMenuData *)g_malloc (sizeof (GnomeRecentViewBonoboMenuData)); + md->view = view; + md->uri = g_strdup (g_slist_nth_data (list, i-1)); + + /* Maybe we should use a gnome-vfs call here?? */ + uri = g_path_get_basename (g_slist_nth_data (list, i - 1)); + + escaped_name = gnome_recent_util_escape_underlines (uri); + + tip = g_strdup_printf (_("Open %s"), uri); + + verb_name = g_strdup_printf ("%s%s%d", appname,GNOME_RECENT_VERB_NAME, i); + cmd = g_strdup_printf ("<cmd name = \"%s\" /> ", verb_name); + bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL); + + closure = g_cclosure_new (G_CALLBACK (gnome_recent_view_bonobo_menu_cb), + md, gnome_recent_view_bonobo_menu_data_destroy_cb); + + bonobo_ui_component_add_verb_full (ui_component, verb_name, + closure); + + if (i < 10) + label = g_strdup_printf ("_%d. %s", i, escaped_name); + else + label = g_strdup_printf ("%d. %s", i, escaped_name); + + + + item_path = g_strconcat (view->path, "/", verb_name, NULL); + + if (bonobo_ui_component_path_exists (ui_component, item_path, NULL)) + { + bonobo_ui_component_set_prop (ui_component, item_path, + "label", label, NULL); + + bonobo_ui_component_set_prop (ui_component, item_path, + "tip", tip, NULL); + } + else + { + gchar *xml; + + xml = g_strdup_printf ("<menuitem name=\"%s\" " + "verb=\"%s\"" + " _label=\"%s\" _tip=\"%s\" " + "hidden=\"0\" />", + verb_name, verb_name, label, + tip); + + bonobo_ui_component_set_translate (ui_component, view->path, xml, NULL); + + g_free (xml); + } + + g_free (label); + g_free (verb_name); + g_free (tip); + g_free (escaped_name); + g_free (item_path); + g_free (uri); + g_free (cmd); + } + + + bonobo_ui_component_thaw (ui_component, NULL); +} + +static void +model_changed_cb (GnomeRecentModel *model, GSList *list, GnomeRecentViewBonobo *view) +{ + gnome_recent_view_bonobo_set_list (view, list); +} + + + +static void +gnome_recent_view_bonobo_populate (GnomeRecentViewBonobo *view) +{ + GnomeRecentModel *model; + GSList *list; + + model = gnome_recent_view_get_model (GNOME_RECENT_VIEW (view)); + list = gnome_recent_model_get_list (model); + + gnome_recent_view_bonobo_set_list (view, list); +} + +static GnomeRecentModel * +gnome_recent_view_bonobo_get_model (GnomeRecentView *view_parent) +{ + GnomeRecentViewBonobo *view; + + g_return_val_if_fail (view_parent, NULL); + view = GNOME_RECENT_VIEW_BONOBO (view_parent); + + return view->model; +} + +static void +gnome_recent_view_bonobo_set_model (GnomeRecentView *view_parent, GnomeRecentModel *model) +{ + GnomeRecentViewBonobo *view; + + g_return_if_fail (view_parent); + view = GNOME_RECENT_VIEW_BONOBO (view_parent); + + if (view->model) + g_signal_handler_disconnect (G_OBJECT (view->model), + view->changed_cb_id); + + view->model = model; + view->changed_cb_id = g_signal_connect (G_OBJECT (model), "changed", + G_CALLBACK (model_changed_cb), view); + + gnome_recent_view_bonobo_populate (view); +} + +static void +gnome_recent_view_bonobo_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GnomeRecentViewBonobo *view = GNOME_RECENT_VIEW_BONOBO (object); + + switch (prop_id) + { + case PROP_UI_COMPONENT: + gnome_recent_view_bonobo_set_ui_component (GNOME_RECENT_VIEW_BONOBO (view), + BONOBO_UI_COMPONENT (g_value_get_object (value))); + break; + case PROP_MENU_PATH: + view->path = g_strdup (g_value_get_string (value)); + break; + default: + break; + } +} + +static void +gnome_recent_view_bonobo_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GnomeRecentViewBonobo *view = GNOME_RECENT_VIEW_BONOBO (object); + + switch (prop_id) + { + case PROP_UI_COMPONENT: + g_value_set_pointer (value, view->uic); + break; + case PROP_MENU_PATH: + g_value_set_string (value, g_strdup (view->path)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gnome_recent_view_bonobo_class_init (GnomeRecentViewBonoboClass * klass) +{ + GObjectClass *object_class; + + + object_class = G_OBJECT_CLASS (klass); + + object_class->set_property = gnome_recent_view_bonobo_set_property; + object_class->get_property = gnome_recent_view_bonobo_get_property; + + gnome_recent_view_bonobo_signals[ACTIVATE] = g_signal_new ("activate", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeRecentViewBonoboClass, activate), + NULL, NULL, + gnome_recent_BOOLEAN__STRING, + G_TYPE_BOOLEAN, 1, + G_TYPE_STRING); + + g_object_class_install_property (object_class, + PROP_UI_COMPONENT, + g_param_spec_object ("ui-component", + "UI Component", + "BonoboUIComponent for menus.", + bonobo_ui_component_get_type(), + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_MENU_PATH, + g_param_spec_string ("ui-path", + "Path", + "The path to put the menu items.", + "/menus/File/GnomeRecentDocuments", + G_PARAM_READWRITE)); + + + klass->activate = NULL; +} + +static void +gnome_recent_view_init (GnomeRecentViewClass *iface) +{ + iface->do_clear = gnome_recent_view_bonobo_clear; + iface->do_get_model = gnome_recent_view_bonobo_get_model; + iface->do_set_model = gnome_recent_view_bonobo_set_model; +} + + +static void +gnome_recent_view_bonobo_init (GnomeRecentViewBonobo * recent) +{ + /* maybe should remove this */ +} + +void +gnome_recent_view_bonobo_set_ui_component (GnomeRecentViewBonobo *view, BonoboUIComponent *uic) +{ + g_return_if_fail (view); + g_return_if_fail (uic); + + view->uic = uic; +} + +void +gnome_recent_view_bonobo_set_ui_path (GnomeRecentViewBonobo *view, const gchar *path) +{ + g_return_if_fail (view); + g_return_if_fail (path); + + view->path = g_strdup (path); +} + +BonoboUIComponent * +gnome_recent_view_bonobo_get_ui_component (GnomeRecentViewBonobo *view) +{ + g_return_val_if_fail (view, NULL); + + return view->uic; +} + +gchar * +gnome_recent_view_bonobo_get_ui_path (GnomeRecentViewBonobo *view) +{ + g_return_val_if_fail (view, NULL); + + return g_strdup (view->path); +} + +/** + * gnome_recent_view_bonobo_new: + * @appname: The name of your application. + * @limit: The maximum number of items allowed. + * + * This creates a new GnomeRecentViewBonobo object. + * + * Returns: a GnomeRecentViewBonobo object + */ +GnomeRecentViewBonobo * +gnome_recent_view_bonobo_new (BonoboUIComponent *uic, const gchar *path) +{ + GnomeRecentViewBonobo *view; + + g_return_val_if_fail (uic, NULL); + g_return_val_if_fail (path, NULL); + + view = GNOME_RECENT_VIEW_BONOBO (g_object_new (gnome_recent_view_bonobo_get_type (), + "ui-path", + path, + "ui-component", + uic, NULL)); + + g_return_val_if_fail (view, NULL); + + return view; +} + +/** + * gnome_recent_view_bonobo_get_type: + * @: + * + * This returns a GType representing a GnomeRecentViewBonobo object. + * + * Returns: a GType + */ +GType +gnome_recent_view_bonobo_get_type (void) +{ + static GType gnome_recent_view_bonobo_type = 0; + + if(!gnome_recent_view_bonobo_type) { + static const GTypeInfo gnome_recent_view_bonobo_info = { + sizeof (GnomeRecentViewBonoboClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc)gnome_recent_view_bonobo_class_init, /* class init */ + NULL, /* class finalize */ + NULL, /* class data */ + sizeof (GnomeRecentViewBonobo), + 0, + (GInstanceInitFunc) gnome_recent_view_bonobo_init + }; + + static const GInterfaceInfo view_info = + { + (GInterfaceInitFunc) gnome_recent_view_init, + NULL, + NULL + }; + + gnome_recent_view_bonobo_type = g_type_register_static (G_TYPE_OBJECT, + "GnomeRecentViewBonobo", + &gnome_recent_view_bonobo_info, 0); + g_type_add_interface_static (gnome_recent_view_bonobo_type, + GNOME_TYPE_RECENT_VIEW, + &view_info); + } + + return gnome_recent_view_bonobo_type; +} + diff --git a/glabels2/src/gnome-recent-view-bonobo.h b/glabels2/src/gnome-recent-view-bonobo.h new file mode 100644 index 0000000..92d63f1 --- /dev/null +++ b/glabels2/src/gnome-recent-view-bonobo.h @@ -0,0 +1,34 @@ +/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +#ifndef __GNOME_RECENT_VIEW_BONOBO_H__ +#define __GNOME_RECENT_VIEW_BONOBO_H__ + +#include <libbonoboui.h> + +G_BEGIN_DECLS + +#define GNOME_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnome_recent_view_bonobo_get_type (), GnomeRecentViewBonobo) +#define GNOME_RECENT_VIEW_BONOBO_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnome_recent_view_bonobo_get_type (), GnomeRecentViewBonoboClass) +#define GNOME_IS_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnome_recent_view_bonobo_get_type ()) + +typedef struct _GnomeRecentViewBonobo GnomeRecentViewBonobo; + +typedef struct _GnomeRecentViewBonoboClass GnomeRecentViewBonoboClass; + +GType gnome_recent_view_bonobo_get_type (void); + +GnomeRecentViewBonobo * gnome_recent_view_bonobo_new (BonoboUIComponent *uic, + const gchar *path); + + +void gnome_recent_view_bonobo_set_ui_component (GnomeRecentViewBonobo *view, + BonoboUIComponent *uic); + +void gnome_recent_view_bonobo_set_ui_path (GnomeRecentViewBonobo *view, + const gchar *path); + +gchar * gnome_recent_view_bonobo_get_ui_path (GnomeRecentViewBonobo *view); +BonoboUIComponent *gnome_recent_view_bonobo_get_ui_component (GnomeRecentViewBonobo *view); + +G_END_DECLS + +#endif /* __GNOME_RECENT_VIEW_BONOBO_H__ */ diff --git a/glabels2/src/gnome-recent-view.c b/glabels2/src/gnome-recent-view.c new file mode 100644 index 0000000..edb145c --- /dev/null +++ b/glabels2/src/gnome-recent-view.c @@ -0,0 +1,51 @@ +#include <string.h> +#include <gtk/gtk.h> +#include "gnome-recent-view.h" + + +GtkType +gnome_recent_view_get_type (void) +{ + static GtkType view_type = 0; + + if (!view_type) + { + static const GTypeInfo view_info = + { + sizeof (GnomeRecentViewClass), /* class_size */ + NULL, /* base_init */ + NULL, /* base_finalize */ + }; + + view_type = g_type_register_static (G_TYPE_INTERFACE, + "GnomeRecentView", + &view_info, 0); + } + + return view_type; +} + +void +gnome_recent_view_clear (GnomeRecentView *view) +{ + g_return_if_fail (GNOME_IS_RECENT_VIEW (view)); + + GNOME_RECENT_VIEW_GET_CLASS (view)->do_clear (view); +} + +GnomeRecentModel * +gnome_recent_view_get_model (GnomeRecentView *view) +{ + g_return_val_if_fail (view, NULL); + + return GNOME_RECENT_VIEW_GET_CLASS (view)->do_get_model (view); +} + +void +gnome_recent_view_set_model (GnomeRecentView *view, GnomeRecentModel *model) +{ + g_return_if_fail (view); + g_return_if_fail (model); + + GNOME_RECENT_VIEW_GET_CLASS (view)->do_set_model (view, model); +} diff --git a/glabels2/src/gnome-recent-view.h b/glabels2/src/gnome-recent-view.h new file mode 100644 index 0000000..aedf67c --- /dev/null +++ b/glabels2/src/gnome-recent-view.h @@ -0,0 +1,49 @@ +#ifndef __GNOME_RECENT_VIEW_H__ +#define __GNOME_RECENT_VIEW_H__ + + +#include <gdk/gdk.h> +#include <gtk/gtkwidget.h> +#include "gnome-recent-model.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GNOME_TYPE_RECENT_VIEW (gnome_recent_view_get_type ()) +#define GNOME_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RECENT_VIEW, GnomeRecentView)) +#define GNOME_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GNOME_TYPE_RECENT_VIEW, GnomeRecentViewClass)) +#define GNOME_IS_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RECENT_VIEW)) +#define GNOME_IS_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GNOME_TYPE_RECENT_VIEW)) +#define GNOME_RECENT_VIEW_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GNOME_TYPE_RECENT_VIEW, GnomeRecentViewClass)) + +typedef struct _GnomeRecentView GnomeRecentView; /* Dummy typedef */ +typedef struct _GnomeRecentViewClass GnomeRecentViewClass; + +struct _GnomeRecentViewClass +{ + GTypeInterface base_iface; + + /* vtable, not signals */ + void (* do_clear) (GnomeRecentView *view); + void (* do_set_model) (GnomeRecentView *view, + GnomeRecentModel *model); + GnomeRecentModel * (* do_get_model) (GnomeRecentView *view); +}; + +GtkType gnome_recent_view_get_type (void) G_GNUC_CONST; +void gnome_recent_view_set_list (GnomeRecentView *view, + GSList *list); +void gnome_recent_view_clear (GnomeRecentView *view); +GnomeRecentModel *gnome_recent_view_get_model (GnomeRecentView *view); +void gnome_recent_view_set_model (GnomeRecentView *view, + GnomeRecentModel *model); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNOME_RECENT_VIEW_H__ */ diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c new file mode 100644 index 0000000..aaa9920 --- /dev/null +++ b/glabels2/src/label-barcode.c @@ -0,0 +1,280 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_barcode.c: GLabels label text object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> +#include <libgnomeprint/gnome-glyphlist.h> + +#include "label-barcode.h" + +#include "pixmaps/checkerboard.xpm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelBarcodePrivate { + glTextNode *text_node; + glBarcodeStyle style; + guint color; + gboolean text_flag; + gdouble scale; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_barcode_class_init (glLabelBarcodeClass *klass); +static void gl_label_barcode_instance_init (glLabelBarcode *lbc); +static void gl_label_barcode_finalize (GObject *object); + +static void update_size (glLabelBarcode *lbc); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_barcode_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelBarcodeClass), + NULL, + NULL, + (GClassInitFunc) gl_label_barcode_class_init, + NULL, + NULL, + sizeof (glLabelBarcode), + 0, + (GInstanceInitFunc) gl_label_barcode_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelBarcode", &info, 0); + } + + return type; +} + +static void +gl_label_barcode_class_init (glLabelBarcodeClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_barcode_finalize; +} + +static void +gl_label_barcode_instance_init (glLabelBarcode *lbc) +{ + lbc->private = g_new0 (glLabelBarcodePrivate, 1); +} + +static void +gl_label_barcode_finalize (GObject *object) +{ + glLabelBarcode *lbc; + + g_return_if_fail (object && GL_IS_LABEL_BARCODE (object)); + + lbc = GL_LABEL_BARCODE (object); + + gl_text_node_free (&lbc->private->text_node); + g_free (lbc->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "text" object. */ +/*****************************************************************************/ +GObject * +gl_label_barcode_new (glLabel *label) +{ + glLabelBarcode *lbc; + + lbc = g_object_new (gl_label_barcode_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lbc), label); + + return G_OBJECT (lbc); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelBarcode * +gl_label_barcode_dup (glLabelBarcode *lbc, + glLabel *label) +{ + glLabelBarcode *new_lbc; + glTextNode *text_node; + gdouble x, y, w, h; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lbc = GL_LABEL_BARCODE(gl_label_barcode_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lbc), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lbc), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lbc), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lbc), w, h); + + text_node = gl_label_barcode_get_data (lbc); + gl_label_barcode_get_props (lbc, &style, &text_flag, &color, &scale); + + gl_label_barcode_set_data (new_lbc, text_node); + gl_label_barcode_set_props (new_lbc,style, text_flag, color, scale); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_LABEL, "END"); + + return new_lbc; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_barcode_set_data (glLabelBarcode *lbc, + glTextNode *text_node) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + + gl_text_node_free (&lbc->private->text_node); + lbc->private->text_node = gl_text_node_dup (text_node); + + update_size (lbc); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); + + gl_debug (DEBUG_LABEL, "END"); +} + +void +gl_label_barcode_set_props (glLabelBarcode *lbc, + glBarcodeStyle style, + gboolean text_flag, + guint color, + gdouble scale) +{ + GdkPixbuf *pixbuf; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + + lbc->private->style = style; + lbc->private->text_flag = text_flag; + lbc->private->color = color; + lbc->private->scale = scale; + + update_size (lbc); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); + + gl_debug (DEBUG_LABEL, "END"); +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +glTextNode * +gl_label_barcode_get_data (glLabelBarcode *lbc) +{ + g_return_val_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc), NULL); + + return gl_text_node_dup (lbc->private->text_node); +} + +void +gl_label_barcode_get_props (glLabelBarcode *lbc, + glBarcodeStyle *style, + gboolean *text_flag, + guint *color, + gdouble *scale) +{ + g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); + + *style = lbc->private->style; + *text_flag = lbc->private->text_flag; + *color = lbc->private->color; + *scale = lbc->private->scale; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update object size. */ +/*---------------------------------------------------------------------------*/ +static void +update_size (glLabelBarcode *lbc) +{ + gchar *data; + glBarcode *gbc; + + gl_debug (DEBUG_LABEL, "START"); + + data = gl_barcode_default_digits (lbc->private->style); + gbc = gl_barcode_new (lbc->private->style, + lbc->private->text_flag, + lbc->private->scale, + data); + + gl_label_object_set_size (GL_LABEL_OBJECT(lbc), + gbc->width, gbc->height); + + gl_barcode_free (&gbc); + + gl_debug (DEBUG_LABEL, "END"); +} + diff --git a/glabels2/src/label-barcode.h b/glabels2/src/label-barcode.h new file mode 100644 index 0000000..d1c0e09 --- /dev/null +++ b/glabels2/src/label-barcode.h @@ -0,0 +1,80 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_barcode.h: GLabels label barcode object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_BARCODE_H__ +#define __LABEL_BARCODE_H__ + +#include <gtk/gtkenums.h> +#include <libgnomeprint/gnome-font.h> +#include "bc.h" +#include "text-node.h" +#include "label-object.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_BARCODE (gl_label_barcode_get_type ()) +#define GL_LABEL_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_BARCODE, glLabelBarcode)) +#define GL_LABEL_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_BARCODE, glLabelBarcodeClass)) +#define GL_IS_LABEL_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_BARCODE)) +#define GL_IS_LABEL_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_BARCODE)) + +typedef struct _glLabelBarcode glLabelBarcode; +typedef struct _glLabelBarcodeClass glLabelBarcodeClass; + +typedef struct _glLabelBarcodePrivate glLabelBarcodePrivate; + +struct _glLabelBarcode { + glLabelObject object; + + glLabelBarcodePrivate *private; +}; + +struct _glLabelBarcodeClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_barcode_get_type (void); + +extern GObject *gl_label_barcode_new (glLabel *label); + +extern glLabelBarcode *gl_label_barcode_dup (glLabelBarcode *lbc, + glLabel *label); + +extern void gl_label_barcode_set_data (glLabelBarcode *lbc, + glTextNode *text_node); +extern void gl_label_barcode_set_props (glLabelBarcode *lbc, + glBarcodeStyle style, + gboolean text_flag, + guint color, + gdouble scale); + +extern glTextNode *gl_label_barcode_get_data (glLabelBarcode *lbc); +extern void gl_label_barcode_get_props (glLabelBarcode *lbc, + glBarcodeStyle *style, + gboolean *text_flag, + guint *color, + gdouble *scale); + +G_END_DECLS + +#endif /* __LABEL_BARCODE_H__ */ diff --git a/glabels2/src/label-box.c b/glabels2/src/label-box.c new file mode 100644 index 0000000..a7e816a --- /dev/null +++ b/glabels2/src/label-box.c @@ -0,0 +1,233 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_box.c: GLabels label box object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "label-box.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelBoxPrivate { + gdouble line_width; + guint line_color; + guint fill_color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_box_class_init (glLabelBoxClass *klass); +static void gl_label_box_instance_init (glLabelBox *lbox); +static void gl_label_box_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_box_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelBoxClass), + NULL, + NULL, + (GClassInitFunc) gl_label_box_class_init, + NULL, + NULL, + sizeof (glLabelBox), + 0, + (GInstanceInitFunc) gl_label_box_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelBox", &info, 0); + } + + return type; +} + +static void +gl_label_box_class_init (glLabelBoxClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_box_finalize; +} + +static void +gl_label_box_instance_init (glLabelBox *lbox) +{ + lbox->private = g_new0 (glLabelBoxPrivate, 1); +} + +static void +gl_label_box_finalize (GObject *object) +{ + glLabelBox *lbox; + + g_return_if_fail (object && GL_IS_LABEL_BOX (object)); + + lbox = GL_LABEL_BOX (object); + + g_free (lbox->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "box" object. */ +/*****************************************************************************/ +GObject * +gl_label_box_new (glLabel *label) +{ + glLabelBox *lbox; + + lbox = g_object_new (gl_label_box_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lbox), label); + + return G_OBJECT (lbox); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelBox * +gl_label_box_dup (glLabelBox *lbox, + glLabel *label) +{ + glLabelBox *new_lbox; + gdouble x, y, w, h, line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lbox = GL_LABEL_BOX(gl_label_box_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lbox), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lbox), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lbox), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lbox), w, h); + + line_width = gl_label_box_get_line_width (lbox); + line_color = gl_label_box_get_line_color (lbox); + fill_color = gl_label_box_get_fill_color (lbox); + + gl_label_box_set_line_width (new_lbox, line_width); + gl_label_box_set_line_color (new_lbox, line_color); + gl_label_box_set_fill_color (new_lbox, fill_color); + + + gl_debug (DEBUG_LABEL, "END"); + + return new_lbox; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_box_set_line_width (glLabelBox *lbox, + gdouble line_width) +{ + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + + if ( lbox->private->line_width != line_width ) { + lbox->private->line_width = line_width; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); + } +} + +void +gl_label_box_set_line_color (glLabelBox *lbox, + guint line_color) +{ + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + + if ( lbox->private->line_color != line_color ) { + lbox->private->line_color = line_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); + } +} + +void +gl_label_box_set_fill_color (glLabelBox *lbox, + guint fill_color) +{ + g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); + + if ( lbox->private->fill_color != fill_color ) { + lbox->private->fill_color = fill_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); + } +} + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gdouble +gl_label_box_get_line_width (glLabelBox *lbox) +{ + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0.0); + + return lbox->private->line_width; +} + +guint +gl_label_box_get_line_color (glLabelBox *lbox) +{ + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); + + return lbox->private->line_color; +} + +guint +gl_label_box_get_fill_color (glLabelBox *lbox) +{ + g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); + + return lbox->private->fill_color; +} + diff --git a/glabels2/src/label-box.h b/glabels2/src/label-box.h new file mode 100644 index 0000000..fc5b6f9 --- /dev/null +++ b/glabels2/src/label-box.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_box.h: GLabels label box object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_BOX_H__ +#define __LABEL_BOX_H__ + +#include "label-object.h" + + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_BOX (gl_label_box_get_type ()) +#define GL_LABEL_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_BOX, glLabelBox)) +#define GL_LABEL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_BOX, glLabelBoxClass)) +#define GL_IS_LABEL_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_BOX)) +#define GL_IS_LABEL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_BOX)) + +typedef struct _glLabelBox glLabelBox; +typedef struct _glLabelBoxClass glLabelBoxClass; + +typedef struct _glLabelBoxPrivate glLabelBoxPrivate; + +struct _glLabelBox { + glLabelObject object; + + glLabelBoxPrivate *private; +}; + +struct _glLabelBoxClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_box_get_type (void); + +extern GObject *gl_label_box_new (glLabel *label); + +extern glLabelBox *gl_label_box_dup (glLabelBox *lbox, + glLabel *label); + +extern void gl_label_box_set_line_width (glLabelBox *lbox, + gdouble line_width); + +extern void gl_label_box_set_line_color (glLabelBox *lbox, + guint line_color); + +extern void gl_label_box_set_fill_color (glLabelBox *lbox, + guint fill_color); + +extern gdouble gl_label_box_get_line_width (glLabelBox *lbox); +extern guint gl_label_box_get_line_color (glLabelBox *lbox); +extern guint gl_label_box_get_fill_color (glLabelBox *lbox); + + +G_END_DECLS + +#endif /* __LABEL_BOX_H__ */ diff --git a/glabels2/src/label-ellipse.c b/glabels2/src/label-ellipse.c new file mode 100644 index 0000000..e071f5d --- /dev/null +++ b/glabels2/src/label-ellipse.c @@ -0,0 +1,232 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_ellipse.c: GLabels label ellipse object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "label-ellipse.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelEllipsePrivate { + gdouble line_width; + guint line_color; + guint fill_color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_ellipse_class_init (glLabelEllipseClass *klass); +static void gl_label_ellipse_instance_init (glLabelEllipse *lellipse); +static void gl_label_ellipse_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_ellipse_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelEllipseClass), + NULL, + NULL, + (GClassInitFunc) gl_label_ellipse_class_init, + NULL, + NULL, + sizeof (glLabelEllipse), + 0, + (GInstanceInitFunc) gl_label_ellipse_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelEllipse", &info, 0); + } + + return type; +} + +static void +gl_label_ellipse_class_init (glLabelEllipseClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_ellipse_finalize; +} + +static void +gl_label_ellipse_instance_init (glLabelEllipse *lellipse) +{ + lellipse->private = g_new0 (glLabelEllipsePrivate, 1); +} + +static void +gl_label_ellipse_finalize (GObject *object) +{ + glLabelEllipse *lellipse; + + g_return_if_fail (object && GL_IS_LABEL_ELLIPSE (object)); + + lellipse = GL_LABEL_ELLIPSE (object); + + g_free (lellipse->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "ellipse" object. */ +/*****************************************************************************/ +GObject * +gl_label_ellipse_new (glLabel *label) +{ + glLabelEllipse *lellipse; + + lellipse = g_object_new (gl_label_ellipse_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lellipse), label); + + return G_OBJECT (lellipse); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelEllipse * +gl_label_ellipse_dup (glLabelEllipse *lellipse, + glLabel *label) +{ + glLabelEllipse *new_lellipse; + gdouble x, y, w, h, line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lellipse = GL_LABEL_ELLIPSE(gl_label_ellipse_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lellipse), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lellipse), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lellipse), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lellipse), w, h); + + line_width = gl_label_ellipse_get_line_width (lellipse); + line_color = gl_label_ellipse_get_line_color (lellipse); + fill_color = gl_label_ellipse_get_fill_color (lellipse); + + gl_label_ellipse_set_line_width (new_lellipse, line_width); + gl_label_ellipse_set_line_color (new_lellipse, line_color); + gl_label_ellipse_set_fill_color (new_lellipse, fill_color); + + gl_debug (DEBUG_LABEL, "END"); + + return new_lellipse; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_ellipse_set_line_width (glLabelEllipse *lellipse, + gdouble line_width) +{ + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + + if ( lellipse->private->line_width != line_width ) { + lellipse->private->line_width = line_width; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); + } +} + +void +gl_label_ellipse_set_line_color (glLabelEllipse *lellipse, + guint line_color) +{ + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + + if ( lellipse->private->line_color != line_color ) { + lellipse->private->line_color = line_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); + } +} + +void +gl_label_ellipse_set_fill_color (glLabelEllipse *lellipse, + guint fill_color) +{ + g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); + + if ( lellipse->private->fill_color != fill_color ) { + lellipse->private->fill_color = fill_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); + } +} + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gdouble +gl_label_ellipse_get_line_width (glLabelEllipse *lellipse) +{ + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0.0); + + return lellipse->private->line_width; +} + +guint +gl_label_ellipse_get_line_color (glLabelEllipse *lellipse) +{ + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); + + return lellipse->private->line_color; +} + +guint +gl_label_ellipse_get_fill_color (glLabelEllipse *lellipse) +{ + g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); + + return lellipse->private->fill_color; +} + diff --git a/glabels2/src/label-ellipse.h b/glabels2/src/label-ellipse.h new file mode 100644 index 0000000..8704e69 --- /dev/null +++ b/glabels2/src/label-ellipse.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_ellipse.h: GLabels label ellipse object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_ELLIPSE_H__ +#define __LABEL_ELLIPSE_H__ + +#include "label-object.h" + + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_ELLIPSE (gl_label_ellipse_get_type ()) +#define GL_LABEL_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_ELLIPSE, glLabelEllipse)) +#define GL_LABEL_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_ELLIPSE, glLabelEllipseClass)) +#define GL_IS_LABEL_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_ELLIPSE)) +#define GL_IS_LABEL_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_ELLIPSE)) + +typedef struct _glLabelEllipse glLabelEllipse; +typedef struct _glLabelEllipseClass glLabelEllipseClass; + +typedef struct _glLabelEllipsePrivate glLabelEllipsePrivate; + +struct _glLabelEllipse { + glLabelObject object; + + glLabelEllipsePrivate *private; +}; + +struct _glLabelEllipseClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_ellipse_get_type (void); + +extern GObject *gl_label_ellipse_new (glLabel *label); + +extern glLabelEllipse *gl_label_ellipse_dup (glLabelEllipse *lellipse, + glLabel *label); + +extern void gl_label_ellipse_set_line_width (glLabelEllipse *lellipse, + gdouble line_width); + +extern void gl_label_ellipse_set_line_color (glLabelEllipse *lellipse, + guint line_color); + +extern void gl_label_ellipse_set_fill_color (glLabelEllipse *lellipse, + guint fill_color); + +extern gdouble gl_label_ellipse_get_line_width (glLabelEllipse *lellipse); +extern guint gl_label_ellipse_get_line_color (glLabelEllipse *lellipse); +extern guint gl_label_ellipse_get_fill_color (glLabelEllipse *lellipse); + + +G_END_DECLS + +#endif /* __LABEL_ELLIPSE_H__ */ diff --git a/glabels2/src/label-image.c b/glabels2/src/label-image.c new file mode 100644 index 0000000..9ca6c30 --- /dev/null +++ b/glabels2/src/label-image.c @@ -0,0 +1,239 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_image.c: GLabels label image object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "label-image.h" + +#include "pixmaps/checkerboard.xpm" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelImagePrivate { + gchar *filename; + GdkPixbuf *pixbuf; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_image_class_init (glLabelImageClass *klass); +static void gl_label_image_instance_init (glLabelImage *limage); +static void gl_label_image_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_image_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelImageClass), + NULL, + NULL, + (GClassInitFunc) gl_label_image_class_init, + NULL, + NULL, + sizeof (glLabelImage), + 0, + (GInstanceInitFunc) gl_label_image_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelImage", &info, 0); + } + + return type; +} + +static void +gl_label_image_class_init (glLabelImageClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_image_finalize; +} + +static void +gl_label_image_instance_init (glLabelImage *limage) +{ + limage->private = g_new0 (glLabelImagePrivate, 1); + + limage->private->pixbuf = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); +} + +static void +gl_label_image_finalize (GObject *object) +{ + glLabelImage *limage; + + g_return_if_fail (object && GL_IS_LABEL_IMAGE (object)); + + limage = GL_LABEL_IMAGE (object); + + g_free (limage->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "image" object. */ +/*****************************************************************************/ +GObject * +gl_label_image_new (glLabel *label) +{ + glLabelImage *limage; + + limage = g_object_new (gl_label_image_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(limage), label); + + return G_OBJECT (limage); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelImage * +gl_label_image_dup (glLabelImage *limage, + glLabel *label) +{ + glLabelImage *new_limage; + gdouble x, y, w, h; + gchar *filename; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (limage && GL_IS_LABEL_IMAGE (limage)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_limage = GL_LABEL_IMAGE(gl_label_image_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(limage), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(limage), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_limage), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_limage), w, h); + + filename = gl_label_image_get_filename (limage); + + gl_label_image_set_filename (new_limage, filename); + + g_free (filename); + + gl_debug (DEBUG_LABEL, "END"); + + return new_limage; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_image_set_filename (glLabelImage *limage, + const gchar *filename) +{ + GdkPixbuf *pixbuf; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (limage && GL_IS_LABEL_IMAGE (limage)); + + if ( filename == NULL ) { + + g_free (limage->private->filename); + limage->private->filename = NULL; + + g_object_unref (limage->private->pixbuf); + limage->private->pixbuf = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(limage)); + } else { + + if ( (limage->private->filename == NULL) || + (strcmp (limage->private->filename, filename) != 0) ) { + + g_free (limage->private->filename); + limage->private->filename = g_strdup (filename); + + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); + g_object_unref (limage->private->pixbuf); + if ( pixbuf != NULL ) { + limage->private->pixbuf = pixbuf; + } else { + limage->private->pixbuf = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); + } + + gl_label_object_emit_changed (GL_LABEL_OBJECT(limage)); + } + + } + + gl_debug (DEBUG_LABEL, "END"); +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gchar * +gl_label_image_get_filename (glLabelImage *limage) +{ + g_return_val_if_fail (limage && GL_IS_LABEL_IMAGE (limage), NULL); + + return g_strdup (limage->private->filename); +} + +const GdkPixbuf * +gl_label_image_get_pixbuf (glLabelImage *limage) +{ + g_return_val_if_fail (limage && GL_IS_LABEL_IMAGE (limage), NULL); + + return limage->private->pixbuf; +} + diff --git a/glabels2/src/label-image.h b/glabels2/src/label-image.h new file mode 100644 index 0000000..34af171 --- /dev/null +++ b/glabels2/src/label-image.h @@ -0,0 +1,69 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_image.h: GLabels label image object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_IMAGE_H__ +#define __LABEL_IMAGE_H__ + +#include "label-object.h" +#include "gdk-pixbuf/gdk-pixbuf.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_IMAGE (gl_label_image_get_type ()) +#define GL_LABEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_IMAGE, glLabelImage)) +#define GL_LABEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_IMAGE, glLabelImageClass)) +#define GL_IS_LABEL_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_IMAGE)) +#define GL_IS_LABEL_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_IMAGE)) + +typedef struct _glLabelImage glLabelImage; +typedef struct _glLabelImageClass glLabelImageClass; + +typedef struct _glLabelImagePrivate glLabelImagePrivate; + +struct _glLabelImage { + glLabelObject object; + + glLabelImagePrivate *private; +}; + +struct _glLabelImageClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_image_get_type (void); + +extern GObject *gl_label_image_new (glLabel *label); + +extern glLabelImage *gl_label_image_dup (glLabelImage *limage, + glLabel *label); + +extern void gl_label_image_set_filename (glLabelImage *limage, + const gchar *filename); + +extern gchar *gl_label_image_get_filename (glLabelImage *limage); + +extern const GdkPixbuf *gl_label_image_get_pixbuf (glLabelImage *limage); + +G_END_DECLS + +#endif /* __LABEL_IMAGE_H__ */ diff --git a/glabels2/src/label-line.c b/glabels2/src/label-line.c new file mode 100644 index 0000000..990a2b9 --- /dev/null +++ b/glabels2/src/label-line.c @@ -0,0 +1,210 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_line.c: GLabels label line object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "label-line.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelLinePrivate { + gdouble line_width; + guint line_color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_line_class_init (glLabelLineClass *klass); +static void gl_label_line_instance_init (glLabelLine *lline); +static void gl_label_line_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_line_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelLineClass), + NULL, + NULL, + (GClassInitFunc) gl_label_line_class_init, + NULL, + NULL, + sizeof (glLabelLine), + 0, + (GInstanceInitFunc) gl_label_line_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelLine", &info, 0); + } + + return type; +} + +static void +gl_label_line_class_init (glLabelLineClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_line_finalize; +} + +static void +gl_label_line_instance_init (glLabelLine *lline) +{ + lline->private = g_new0 (glLabelLinePrivate, 1); +} + +static void +gl_label_line_finalize (GObject *object) +{ + glLabelLine *lline; + + g_return_if_fail (object && GL_IS_LABEL_LINE (object)); + + lline = GL_LABEL_LINE (object); + + g_free (lline->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "line" object. */ +/*****************************************************************************/ +GObject * +gl_label_line_new (glLabel *label) +{ + glLabelLine *lline; + + lline = g_object_new (gl_label_line_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(lline), label); + + return G_OBJECT (lline); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelLine * +gl_label_line_dup (glLabelLine *lline, + glLabel *label) +{ + glLabelLine *new_lline; + gdouble x, y, w, h, line_width; + guint line_color; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_lline = GL_LABEL_LINE(gl_label_line_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(lline), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(lline), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_lline), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_lline), w, h); + + line_width = gl_label_line_get_line_width (lline); + line_color = gl_label_line_get_line_color (lline); + + gl_label_line_set_line_width (new_lline, line_width); + gl_label_line_set_line_color (new_lline, line_color); + + gl_debug (DEBUG_LABEL, "END"); + + return new_lline; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_line_set_line_width (glLabelLine *lline, + gdouble line_width) +{ + g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); + + if ( lline->private->line_width != line_width ) { + lline->private->line_width = line_width; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); + } +} + +void +gl_label_line_set_line_color (glLabelLine *lline, + guint line_color) +{ + g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); + + if ( lline->private->line_color != line_color ) { + lline->private->line_color = line_color; + gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); + } +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +gdouble +gl_label_line_get_line_width (glLabelLine *lline) +{ + g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0.0); + + return lline->private->line_width; +} + +guint +gl_label_line_get_line_color (glLabelLine *lline) +{ + g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0); + + return lline->private->line_color; +} + diff --git a/glabels2/src/label-line.h b/glabels2/src/label-line.h new file mode 100644 index 0000000..b418b89 --- /dev/null +++ b/glabels2/src/label-line.h @@ -0,0 +1,72 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_line.h: GLabels label line object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_LINE_H__ +#define __LABEL_LINE_H__ + +#include "label-object.h" + + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_LINE (gl_label_line_get_type ()) +#define GL_LABEL_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_LINE, glLabelLine)) +#define GL_LABEL_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_LINE, glLabelLineClass)) +#define GL_IS_LABEL_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_LINE)) +#define GL_IS_LABEL_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_LINE)) + +typedef struct _glLabelLine glLabelLine; +typedef struct _glLabelLineClass glLabelLineClass; + +typedef struct _glLabelLinePrivate glLabelLinePrivate; + +struct _glLabelLine { + glLabelObject object; + + glLabelLinePrivate *private; +}; + +struct _glLabelLineClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_line_get_type (void); + +extern GObject *gl_label_line_new (glLabel *label); + +extern glLabelLine *gl_label_line_dup (glLabelLine *lline, + glLabel *label); + +extern void gl_label_line_set_line_width (glLabelLine *lline, + gdouble line_width); + +extern void gl_label_line_set_line_color (glLabelLine *lline, + guint line_color); + +extern gdouble gl_label_line_get_line_width (glLabelLine *lline); +extern guint gl_label_line_get_line_color (glLabelLine *lline); + + +G_END_DECLS + +#endif /* __LABEL_LINE_H__ */ diff --git a/glabels2/src/label-object.c b/glabels2/src/label-object.c new file mode 100644 index 0000000..badbd33 --- /dev/null +++ b/glabels2/src/label-object.c @@ -0,0 +1,426 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_object.c: GLabels label object base class + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "label-object.h" +#include "marshal.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelObjectPrivate { + gchar *name; + gdouble x, y; + gdouble w, h; +}; + +enum { + CHANGED, + MOVED, + TOP, + BOTTOM, + LAST_SIGNAL +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint signals[LAST_SIGNAL] = {0}; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_object_class_init (glLabelObjectClass *klass); +static void gl_label_object_instance_init (glLabelObject *object); +static void gl_label_object_finalize (GObject *object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_object_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelObjectClass), + NULL, + NULL, + (GClassInitFunc) gl_label_object_class_init, + NULL, + NULL, + sizeof (glLabelObject), + 0, + (GInstanceInitFunc) gl_label_object_instance_init, + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "glLabelObject", &info, 0); + } + + return type; +} + +static void +gl_label_object_class_init (glLabelObjectClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_LABEL, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_object_finalize; + + signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + signals[MOVED] = + g_signal_new ("moved", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, moved), + NULL, NULL, + gl_marshal_VOID__DOUBLE_DOUBLE, + G_TYPE_NONE, + 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE); + signals[TOP] = + g_signal_new ("top", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, top), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + signals[BOTTOM] = + g_signal_new ("bottom", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelObjectClass, bottom), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_object_instance_init (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + object->private = g_new0 (glLabelObjectPrivate, 1); + + object->private->name = g_strdup_printf ("object%d", instance++); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_object_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + parent = GL_LABEL_OBJECT(object)->parent; + gl_label_remove_object (parent, GL_LABEL_OBJECT(object)); + + g_free (GL_LABEL_OBJECT(object)->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_LABEL, "END"); +} + +GObject * +gl_label_object_new (glLabel *label) +{ + glLabelObject *object; + + gl_debug (DEBUG_LABEL, "START"); + + object = g_object_new (gl_label_object_get_type(), NULL); + + gl_label_object_set_parent (object, label); + + gl_debug (DEBUG_LABEL, "END"); + + return G_OBJECT (object); +} + +/*****************************************************************************/ +/* Emit "changed" signal (for derived objects). */ +/*****************************************************************************/ +void +gl_label_object_emit_changed (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Set parent label of object. */ +/*****************************************************************************/ +void +gl_label_object_set_parent (glLabelObject *object, + glLabel *label) +{ + glLabel *old_parent; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + old_parent = object->parent; + if ( old_parent != NULL ) { + gl_label_remove_object( old_parent, object ); + } + gl_label_add_object( label, object ); + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get parent label of object. */ +/*****************************************************************************/ +glLabel * +gl_label_object_get_parent (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + gl_debug (DEBUG_LABEL, "END"); + + return object->parent; +} + +/*****************************************************************************/ +/* Set name of object. */ +/*****************************************************************************/ +void +gl_label_object_set_name (glLabelObject *object, + gchar *name) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + g_free(object->private->name); + object->private->name = name; + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get name of object. */ +/*****************************************************************************/ +gchar * +gl_label_object_get_name (glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + gl_debug (DEBUG_LABEL, "END"); + + return g_strdup(object->private->name); +} + +/*****************************************************************************/ +/* Set position of object. */ +/*****************************************************************************/ +void +gl_label_object_set_position (glLabelObject *object, + gdouble x, + gdouble y) +{ + gdouble dx, dy; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + dx = x - object->private->x; + dy = y - object->private->y; + + object->private->x = x; + object->private->y = y; + + g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Set position of object relative to old position. */ +/*****************************************************************************/ +void +gl_label_object_set_position_relative (glLabelObject *object, + gdouble dx, + gdouble dy) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + object->private->x += dx; + object->private->y += dy; + + gl_debug (DEBUG_LABEL, " x = %f, y= %f", + object->private->x, + object->private->y); + + g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get position of object. */ +/*****************************************************************************/ +void +gl_label_object_get_position (glLabelObject *object, + gdouble *x, + gdouble *y) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + *x = object->private->x; + *y = object->private->y; + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Set size of object. */ +/*****************************************************************************/ +void +gl_label_object_set_size (glLabelObject *object, + gdouble w, + gdouble h) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + object->private->w = w; + object->private->h = h; + + g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Get size of object. */ +/*****************************************************************************/ +void +gl_label_object_get_size (glLabelObject *object, + gdouble *w, + gdouble *h) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + *w = object->private->w; + *h = object->private->h; + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Bring label object to front/top. */ +/****************************************************************************/ +void +gl_label_object_raise_to_top (glLabelObject *object) +{ + glLabel *label; + + gl_debug (DEBUG_LABEL, "START"); + + label = object->parent; + + gl_label_raise_object_to_top (label, object); + + g_signal_emit (G_OBJECT(object), signals[TOP], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Send label object to rear/bottom. */ +/****************************************************************************/ +void +gl_label_object_lower_to_bottom (glLabelObject *object) +{ + glLabel *label; + + gl_debug (DEBUG_LABEL, "START"); + + label = object->parent; + + gl_label_lower_object_to_bottom (label, object); + + g_signal_emit (G_OBJECT(object), signals[BOTTOM], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + diff --git a/glabels2/src/label-object.h b/glabels2/src/label-object.h new file mode 100644 index 0000000..878f711 --- /dev/null +++ b/glabels2/src/label-object.h @@ -0,0 +1,106 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_object.h: GLabels label object base class + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_OBJECT_H__ +#define __LABEL_OBJECT_H__ + +#include <glib-object.h> + + +G_BEGIN_DECLS + +typedef enum { + GL_LABEL_OBJECT_TEXT, + GL_LABEL_OBJECT_BOX, + GL_LABEL_OBJECT_LINE, + GL_LABEL_OBJECT_ELLIPSE, + GL_LABEL_OBJECT_IMAGE, + GL_LABEL_OBJECT_BARCODE, + GL_LABEL_OBJECT_N_TYPES +} glLabelObjectType; + + +#define GL_TYPE_LABEL_OBJECT (gl_label_object_get_type ()) +#define GL_LABEL_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_OBJECT, glLabelObject)) +#define GL_LABEL_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_OBJECT, glLabelObjectClass)) +#define GL_IS_LABEL_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_OBJECT)) +#define GL_IS_LABEL_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_OBJECT)) + +typedef struct _glLabelObject glLabelObject; +typedef struct _glLabelObjectClass glLabelObjectClass; + +typedef struct _glLabelObjectPrivate glLabelObjectPrivate; + +#include "label.h" + +struct _glLabelObject { + GObject object; + + glLabel *parent; + + glLabelObjectPrivate *private; +}; + +struct _glLabelObjectClass { + GObjectClass parent_class; + + void (*changed) (glLabelObject *object, gpointer user_data); + + void (*moved) (glLabelObject *object, + gdouble dx, gdouble dy, gpointer user_data); + + void (*top) (glLabelObject *object, gpointer user_data); + void (*bottom) (glLabelObject *object, gpointer user_data); +}; + +extern GType gl_label_object_get_type (void); + +extern GObject *gl_label_object_new (glLabel *label); + +extern void gl_label_object_emit_changed (glLabelObject *object); + +extern void gl_label_object_set_parent (glLabelObject *object, + glLabel *label); +extern glLabel *gl_label_object_get_parent (glLabelObject *object); + +extern void gl_label_object_set_name (glLabelObject *object, + gchar *name); +extern gchar *gl_label_object_get_name (glLabelObject *object); + +extern void gl_label_object_set_position (glLabelObject *object, + gdouble x, gdouble y); +extern void gl_label_object_set_position_relative (glLabelObject *object, + gdouble dx, + gdouble dy); +extern void gl_label_object_get_position (glLabelObject *object, + gdouble *x, gdouble *y); +extern void gl_label_object_set_size (glLabelObject *object, + gdouble w, gdouble h); +extern void gl_label_object_get_size (glLabelObject *object, + gdouble *w, gdouble *h); + +extern void gl_label_object_raise_to_top (glLabelObject * object); +extern void gl_label_object_lower_to_bottom (glLabelObject * object); + +G_END_DECLS + +#endif /* __LABEL_OBJECT_H__ */ diff --git a/glabels2/src/label-text.c b/glabels2/src/label-text.c new file mode 100644 index 0000000..8e30f99 --- /dev/null +++ b/glabels2/src/label-text.c @@ -0,0 +1,345 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_text.c: GLabels label text object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> +#include <libgnomeprint/gnome-glyphlist.h> + +#include "label-text.h" + +#include "pixmaps/checkerboard.xpm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define DEFAULT_FONT_FAMILY "Helvetica" +#define DEFAULT_FONT_SIZE 14.0 +#define DEFAULT_FONT_WEIGHT GNOME_FONT_BOOK +#define DEFAULT_FONT_ITALIC_FLAG FALSE +#define DEFAULT_JUST GTK_JUSTIFY_LEFT +#define DEFAULT_COLOR GNOME_CANVAS_COLOR (0,0,0) + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelTextPrivate { + GList *lines; /* list of glLabelTextNode lists */ + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + GtkJustification just; + guint color; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint instance = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_text_class_init (glLabelTextClass *klass); +static void gl_label_text_instance_init (glLabelText *ltext); +static void gl_label_text_finalize (GObject *object); + +static void update_size (glLabelText *ltext); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_text_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelTextClass), + NULL, + NULL, + (GClassInitFunc) gl_label_text_class_init, + NULL, + NULL, + sizeof (glLabelText), + 0, + (GInstanceInitFunc) gl_label_text_instance_init, + }; + + type = g_type_register_static (GL_TYPE_LABEL_OBJECT, + "glLabelText", &info, 0); + } + + return type; +} + +static void +gl_label_text_class_init (glLabelTextClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_text_finalize; +} + +static void +gl_label_text_instance_init (glLabelText *ltext) +{ + ltext->private = g_new0 (glLabelTextPrivate, 1); + + ltext->private->font_family = g_strdup(DEFAULT_FONT_FAMILY); + ltext->private->font_size = DEFAULT_FONT_SIZE; + ltext->private->font_weight = DEFAULT_FONT_WEIGHT; + ltext->private->font_italic_flag = DEFAULT_FONT_ITALIC_FLAG; + ltext->private->just = DEFAULT_JUST; + ltext->private->color = DEFAULT_COLOR; +} + +static void +gl_label_text_finalize (GObject *object) +{ + glLabelText *ltext; + + g_return_if_fail (object && GL_IS_LABEL_TEXT (object)); + + ltext = GL_LABEL_TEXT (object); + + g_free (ltext->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/*****************************************************************************/ +/* NEW label "text" object. */ +/*****************************************************************************/ +GObject * +gl_label_text_new (glLabel *label) +{ + glLabelText *ltext; + + ltext = g_object_new (gl_label_text_get_type(), NULL); + + gl_label_object_set_parent (GL_LABEL_OBJECT(ltext), label); + + return G_OBJECT (ltext); +} + +/*****************************************************************************/ +/* Duplicate object. */ +/*****************************************************************************/ +glLabelText * +gl_label_text_dup (glLabelText *ltext, + glLabel *label) +{ + glLabelText *new_ltext; + gdouble x, y, w, h; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + g_return_if_fail (label && GL_IS_LABEL (label)); + + new_ltext = GL_LABEL_TEXT(gl_label_text_new (label)); + + gl_label_object_get_position (GL_LABEL_OBJECT(ltext), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(ltext), &w, &h); + + gl_label_object_set_position (GL_LABEL_OBJECT(new_ltext), x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(new_ltext), w, h); + + lines = gl_label_text_get_lines (ltext); + gl_label_text_get_props (ltext, + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + gl_label_text_set_lines (new_ltext, lines); + gl_label_text_set_props (new_ltext, + font_family, font_size, font_weight, + font_italic_flag, + color, just); + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_LABEL, "END"); + + return new_ltext; +} + + +/*****************************************************************************/ +/* Set object params. */ +/*****************************************************************************/ +void +gl_label_text_set_lines (glLabelText *ltext, + GList *lines) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + + gl_text_node_lines_free (<ext->private->lines); + ltext->private->lines = gl_text_node_lines_dup (lines); + + update_size (ltext); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); + + gl_debug (DEBUG_LABEL, "END"); +} + +void +gl_label_text_set_props (glLabelText *ltext, + gchar *font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just) +{ + GdkPixbuf *pixbuf; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + + g_free (ltext->private->font_family); + + ltext->private->font_family = g_strdup (font_family); + ltext->private->font_size = font_size; + ltext->private->font_weight = font_weight; + ltext->private->font_italic_flag = font_italic_flag; + ltext->private->color = color; + ltext->private->just = just; + + gl_debug (DEBUG_LABEL, "just = %d", ltext->private->just); + + update_size (ltext); + + gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); + + gl_debug (DEBUG_LABEL, "END"); +} + + +/*****************************************************************************/ +/* Get object params. */ +/*****************************************************************************/ +GList * +gl_label_text_get_lines (glLabelText *ltext) +{ + g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), NULL); + + return gl_text_node_lines_dup (ltext->private->lines); +} + +void +gl_label_text_get_props (glLabelText *ltext, + gchar **font_family, + gdouble *font_size, + GnomeFontWeight *font_weight, + gboolean *font_italic_flag, + guint *color, + GtkJustification *just) +{ + g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); + + *font_family = g_strdup (ltext->private->font_family); + *font_size = ltext->private->font_size; + *font_weight = ltext->private->font_weight; + *font_italic_flag = ltext->private->font_italic_flag; + *color = ltext->private->color; + *just = ltext->private->just; + + gl_debug (DEBUG_LABEL, "just = %d", *just); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update object size. */ +/*---------------------------------------------------------------------------*/ +static void +update_size (glLabelText *ltext) +{ + gdouble w, h; + GnomeFont *font; + gchar *text; + gchar **line; + gint i; + GnomeGlyphList *glyphlist; + ArtDRect bbox; + gdouble affine[6]; + + gl_debug (DEBUG_LABEL, "START"); + + font = gnome_font_find_closest_from_weight_slant ( + ltext->private->font_family, + ltext->private->font_weight, + ltext->private->font_italic_flag, + ltext->private->font_size); + + text = gl_text_node_lines_expand (ltext->private->lines, NULL); + line = g_strsplit (text, "\n", -1); + g_free (text); + + art_affine_identity (affine); + + w = 0.0; + h = 0.0; + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, 0, + 0.0, 0.0, + line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + + if ( bbox.x1 > w ) w = bbox.x1; + + h += ltext->private->font_size; + + } + + g_strfreev (line); + + gl_label_object_set_size (GL_LABEL_OBJECT(ltext), w, h); + + gl_debug (DEBUG_LABEL, "END"); +} + diff --git a/glabels2/src/label-text.h b/glabels2/src/label-text.h new file mode 100644 index 0000000..cb7fd31 --- /dev/null +++ b/glabels2/src/label-text.h @@ -0,0 +1,83 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label_text.h: GLabels label text object + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LABEL_TEXT_H__ +#define __LABEL_TEXT_H__ + +#include <gtk/gtkenums.h> +#include <libgnomeprint/gnome-font.h> +#include "text-node.h" +#include "label-object.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_LABEL_TEXT (gl_label_text_get_type ()) +#define GL_LABEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_TEXT, glLabelText)) +#define GL_LABEL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL_TEXT, glLabelTextClass)) +#define GL_IS_LABEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL_TEXT)) +#define GL_IS_LABEL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL_TEXT)) + +typedef struct _glLabelText glLabelText; +typedef struct _glLabelTextClass glLabelTextClass; + +typedef struct _glLabelTextPrivate glLabelTextPrivate; + +struct _glLabelText { + glLabelObject object; + + glLabelTextPrivate *private; +}; + +struct _glLabelTextClass { + glLabelObjectClass parent_class; +}; + +extern GType gl_label_text_get_type (void); + +extern GObject *gl_label_text_new (glLabel *label); + +extern glLabelText *gl_label_text_dup (glLabelText *ltext, + glLabel *label); + +extern void gl_label_text_set_lines (glLabelText *ltext, + GList *lines); +extern void gl_label_text_set_props (glLabelText *ltext, + gchar *font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just); + +extern GList *gl_label_text_get_lines (glLabelText *ltext); +extern void gl_label_text_get_props (glLabelText *ltext, + gchar **font_family, + gdouble *font_size, + GnomeFontWeight *font_weight, + gboolean *font_italic_flag, + guint *color, + GtkJustification *just); + +G_END_DECLS + +#endif /* __LABEL_TEXT_H__ */ diff --git a/glabels2/src/label.c b/glabels2/src/label.c new file mode 100644 index 0000000..00054d7 --- /dev/null +++ b/glabels2/src/label.c @@ -0,0 +1,614 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.c: GLabels label module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> + +#include "label.h" +#include "label-object.h" +#include "label-text.h" +#include "label-box.h" +#include "label-line.h" +#include "label-ellipse.h" +#include "label-image.h" +#include "label-barcode.h" +#include "template.h" +#include "marshal.h" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glLabelPrivate { + + glTemplate *template; + gboolean rotate_flag; + + gchar *filename; + gboolean modified_flag; + gint untitled_instance; + + glMerge *merge; +}; + +enum { + CHANGED, + NAME_CHANGED, + MODIFIED_CHANGED, + LAST_SIGNAL +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + +static guint signals[LAST_SIGNAL] = {0}; + +static guint untitled = 0; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_label_class_init (glLabelClass *klass); +static void gl_label_instance_init (glLabel *label); +static void gl_label_finalize (GObject *object); + +static void object_changed_cb (glLabelObject *object, glLabel *label); +static void object_moved_cb (glLabelObject *object, + gdouble x, gdouble y, glLabel *label); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_label_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glLabelClass), + NULL, + NULL, + (GClassInitFunc) gl_label_class_init, + NULL, + NULL, + sizeof (glLabel), + 0, + (GInstanceInitFunc) gl_label_instance_init, + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "glLabel", &info, 0); + } + + return type; +} + +static void +gl_label_class_init (glLabelClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_LABEL, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_label_finalize; + + signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals[NAME_CHANGED] = + g_signal_new ("name_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelClass, name_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals[MODIFIED_CHANGED] = + g_signal_new ("modified_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glLabelClass, modified_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_instance_init (glLabel *label) +{ + gl_debug (DEBUG_LABEL, "START"); + + label->private = g_new0 (glLabelPrivate, 1); + label->private->merge = gl_merge_new(); + + gl_debug (DEBUG_LABEL, "END"); +} + +static void +gl_label_finalize (GObject *object) +{ + glLabel *label; + GList *p, *p_next; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (object && GL_IS_LABEL (object)); + + label = GL_LABEL (object); + + gl_template_free (&label->private->template); + + for (p = label->objects; p != NULL; p = p_next) { + p_next = p->next; /* NOTE: p will be left dangling */ + g_object_unref (G_OBJECT(p->data)); + } + + gl_merge_free (&label->private->merge); + + g_free (label->private); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_LABEL, "END"); +} + +GObject * +gl_label_new (void) +{ + glLabel *label; + + gl_debug (DEBUG_LABEL, "START"); + + label = g_object_new (gl_label_get_type(), NULL); + + label->private->modified_flag = FALSE; + + gl_debug (DEBUG_LABEL, "END"); + + return G_OBJECT (label); +} + + +/*****************************************************************************/ +/* Add object to label. */ +/*****************************************************************************/ +void +gl_label_add_object (glLabel *label, + glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + g_return_if_fail (GL_IS_LABEL_OBJECT (object)); + + object->parent = label; + label->objects = g_list_append (label->objects, object); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + g_signal_connect (G_OBJECT(object), "changed", + G_CALLBACK(object_changed_cb), label); + + g_signal_connect (G_OBJECT(object), "moved", + G_CALLBACK(object_moved_cb), label); + + gl_debug (DEBUG_LABEL, "END"); +} + +/*****************************************************************************/ +/* Remove object from label. */ +/*****************************************************************************/ +void +gl_label_remove_object (glLabel *label, + glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + g_return_if_fail (GL_IS_LABEL_OBJECT (object)); + + object->parent = NULL; + label->objects = g_list_remove (label->objects, object); + + if ( G_OBJECT(label)->ref_count /* not finalized */ ) { + + g_signal_handlers_disconnect_by_func (object, + G_CALLBACK(object_changed_cb), + label); + g_signal_handlers_disconnect_by_func (object, + G_CALLBACK(object_moved_cb), + label); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + } + + gl_debug (DEBUG_LABEL, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Object changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +object_changed_cb (glLabelObject *object, glLabel *label) +{ + + if ( !label->private->modified_flag ) { + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + } + + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Object moved callback. */ +/*---------------------------------------------------------------------------*/ +static void +object_moved_cb (glLabelObject *object, gdouble x, gdouble y, glLabel *label) +{ + + if ( !label->private->modified_flag ) { + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + } + + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); +} + +/****************************************************************************/ +/* Bring label object to front/top. */ +/****************************************************************************/ +void +gl_label_raise_object_to_top (glLabel *label, glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + /* Move to end of list, representing front most object */ + label->objects = g_list_remove (label->objects, object); + label->objects = g_list_append (label->objects, object); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Send label object to rear/bottom. */ +/****************************************************************************/ +void +gl_label_lower_object_to_bottom (glLabel *label, glLabelObject *object) +{ + gl_debug (DEBUG_LABEL, "START"); + + /* Move to front of list, representing rear most object */ + label->objects = g_list_remove (label->objects, object); + label->objects = g_list_prepend (label->objects, object); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* set template. */ +/****************************************************************************/ +extern void +gl_label_set_template (glLabel *label, + glTemplate *template) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_template_free (&label->private->template); + label->private->template = gl_template_dup (template); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* set rotate flag. */ +/****************************************************************************/ +extern void +gl_label_set_rotate_flag (glLabel *label, + gboolean rotate_flag) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + label->private->rotate_flag = rotate_flag; + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Get template. */ +/****************************************************************************/ +glTemplate * +gl_label_get_template (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_debug (DEBUG_LABEL, "END"); + + return gl_template_dup (label->private->template); +} + +/****************************************************************************/ +/* Get rotate flag. */ +/****************************************************************************/ +gboolean +gl_label_get_rotate_flag (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_debug (DEBUG_LABEL, "END"); + + return label->private->rotate_flag; +} + +/****************************************************************************/ +/* Get label size. */ +/****************************************************************************/ +void +gl_label_get_size (glLabel * label, + gdouble *w, + gdouble *h) +{ + glTemplate *template; + + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + template = label->private->template; + if ( !template ) { + gl_debug (DEBUG_LABEL, "END -- template NULL"); + *w = *h = 0; + return; + } + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + if (!label->private->rotate_flag) { + *w = template->label_width; + *h = template->label_height; + } else { + *w = template->label_height; + *h = template->label_width; + } + break; + + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + *w = *h = 2.0 * template->label_radius; + break; + + default: + g_warning ("Unknown template label style %d", template->style); + *w = *h = 0; + break; + } + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* set merge information structure. */ +/****************************************************************************/ +extern void +gl_label_set_merge (glLabel * label, + glMerge * merge) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_merge_free (&label->private->merge); + label->private->merge = gl_merge_dup (merge); + + label->private->modified_flag = TRUE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); + + gl_debug (DEBUG_LABEL, "END"); +} + +/****************************************************************************/ +/* Get merge information structure. */ +/****************************************************************************/ +glMerge * +gl_label_get_merge (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "START"); + + g_return_if_fail (label && GL_IS_LABEL (label)); + + gl_debug (DEBUG_LABEL, "END"); + + return gl_merge_dup (label->private->merge); +} + +/****************************************************************************/ +/* return filename. */ +/****************************************************************************/ +gchar * +gl_label_get_filename (glLabel * label) +{ + gl_debug (DEBUG_LABEL, ""); + + return g_strdup ( label->private->filename ); +} + +/****************************************************************************/ +/* return short filename. */ +/****************************************************************************/ +gchar * +gl_label_get_short_name (glLabel * label) +{ + gl_debug (DEBUG_LABEL, ""); + + if ( label->private->filename == NULL ) { + + if ( label->private->untitled_instance == 0 ) { + label->private->untitled_instance = ++untitled; + } + + return g_strdup_printf ( _("%s %d"), _("Untitled"), + label->private->untitled_instance ); + + } else { + + return g_path_get_basename ( label->private->filename ); + + } +} + +/****************************************************************************/ +/* Is label modified? */ +/****************************************************************************/ +gboolean +gl_label_is_modified (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "return %d", label->private->modified_flag); + return label->private->modified_flag; +} + +/****************************************************************************/ +/* Is label untitled? */ +/****************************************************************************/ +gboolean +gl_label_is_untitled (glLabel * label) +{ + gl_debug (DEBUG_LABEL, "return %d",(label->private->filename == NULL)); + return (label->private->filename == NULL); +} + +/****************************************************************************/ +/* Can undo? */ +/****************************************************************************/ +gboolean +gl_label_can_undo (glLabel * label) +{ + return FALSE; +} + + +/****************************************************************************/ +/* Can redo? */ +/****************************************************************************/ +gboolean +gl_label_can_redo (glLabel * label) +{ + return FALSE; +} + + +/****************************************************************************/ +/* Set filename. */ +/****************************************************************************/ +void +gl_label_set_filename (glLabel *label, + const gchar *filename) +{ + label->private->filename = g_strdup (filename); + + g_signal_emit (G_OBJECT(label), signals[NAME_CHANGED], 0); +} + +/****************************************************************************/ +/* Clear modified flag. */ +/****************************************************************************/ +void +gl_label_clear_modified (glLabel *label) +{ + + if ( label->private->modified_flag ) { + + label->private->modified_flag = FALSE; + + g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); + } + +} + + + diff --git a/glabels2/src/label.h b/glabels2/src/label.h new file mode 100644 index 0000000..2d4ad16 --- /dev/null +++ b/glabels2/src/label.h @@ -0,0 +1,107 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.h: GLabels label module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __LABEL_H__ +#define __LABEL_H__ + +#include <glib-object.h> + +#include "merge.h" +#include "template.h" + +G_BEGIN_DECLS + +#define GL_TYPE_LABEL (gl_label_get_type ()) +#define GL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL, glLabel)) +#define GL_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_LABEL, glLabelClass)) +#define GL_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_LABEL)) +#define GL_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_LABEL)) + +typedef struct _glLabel glLabel; +typedef struct _glLabelClass glLabelClass; + +typedef struct _glLabelPrivate glLabelPrivate; + +#include "label-object.h" +struct _glLabel { + GObject object; + + GList *objects; + + glLabelPrivate *private; +}; + +struct _glLabelClass { + GObjectClass parent_class; + + void (*changed) (glLabel *label, gpointer user_data); + + void (*name_changed) (glLabel *label, gpointer user_data); + + void (*modified_changed) (glLabel *label, gpointer user_data); + +}; + + +extern GType gl_label_get_type (void); + +extern GObject *gl_label_new (void); + +extern void gl_label_add_object (glLabel *label, + glLabelObject *object); +extern void gl_label_remove_object (glLabel *label, + glLabelObject *object); +extern void gl_label_raise_object_to_top (glLabel *label, + glLabelObject * object); +extern void gl_label_lower_object_to_bottom (glLabel *label, + glLabelObject * object); + +extern void gl_label_set_template (glLabel * label, + glTemplate *template); + +extern void gl_label_set_rotate_flag (glLabel * label, + gboolean rotate_flag); + +extern glTemplate *gl_label_get_template (glLabel * label); +extern gboolean gl_label_get_rotate_flag (glLabel * label); +extern void gl_label_get_size (glLabel * label, + gdouble *w, + gdouble *h); + +extern void gl_label_set_merge (glLabel * label, + glMerge * merge); +extern glMerge *gl_label_get_merge (glLabel * label); + +extern gchar *gl_label_get_filename (glLabel * label); +extern gchar *gl_label_get_short_name (glLabel * label); +extern gboolean gl_label_is_modified (glLabel * label); +extern gboolean gl_label_is_untitled (glLabel * label); +extern gboolean gl_label_can_undo (glLabel * label); +extern gboolean gl_label_can_redo (glLabel * label); + +extern void gl_label_set_filename (glLabel *label, + const gchar *filename); +extern void gl_label_clear_modified (glLabel *label); + +G_END_DECLS + + +#endif /* __LABEL_H__ */ diff --git a/glabels2/src/marshal.list b/glabels2/src/marshal.list new file mode 100644 index 0000000..9a1941c --- /dev/null +++ b/glabels2/src/marshal.list @@ -0,0 +1,6 @@ +VOID:VOID +VOID:BOOLEAN +VOID:INT +VOID:INT,INT +VOID:DOUBLE,DOUBLE +BOOLEAN:OBJECT diff --git a/glabels2/src/mdi-child.c b/glabels2/src/mdi-child.c new file mode 100644 index 0000000..80fb5ba --- /dev/null +++ b/glabels2/src/mdi-child.c @@ -0,0 +1,363 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi-child.c: gLabels MDI child module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi-child.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#include <config.h> + +#include "mdi-child.h" +#include "xml-label.h" +#include "label.h" +#include "view.h" +#include "marshal.h" +#include "debug.h" + +struct _glMDIChildPrivate +{ + GtkWidget *tab_label; +}; + +enum { + STATE_CHANGED, + UNDO_REDO_STATE_CHANGED, + LAST_SIGNAL +}; + +static void gl_mdi_child_class_init (glMDIChildClass *klass); +static void gl_mdi_child_init (glMDIChild *mdi); +static void gl_mdi_child_finalize (GObject *obj); +static void gl_mdi_child_destroy (GtkObject *obj); + +static void gl_mdi_child_real_state_changed (glMDIChild* child); + +static GtkWidget *gl_mdi_child_create_view (BonoboMDIChild *child); + +static void gl_mdi_child_document_state_changed_handler (glLabel *label, + glMDIChild* child); + +static void gl_mdi_child_document_can_undo_redo_handler (glLabel *label, + gboolean can, glMDIChild* child); + +static gchar* gl_mdi_child_get_config_string (BonoboMDIChild *child, gpointer data); + +static BonoboMDIChildClass *parent_class = NULL; +static guint mdi_child_signals[LAST_SIGNAL] = { 0 }; + + +GType +gl_mdi_child_get_type (void) +{ + static GType mdi_child_type = 0; + + gl_debug (DEBUG_MDI, "START"); + + if (mdi_child_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (glMDIChildClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gl_mdi_child_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (glMDIChild), + 0, /* n_preallocs */ + (GInstanceInitFunc) gl_mdi_child_init + }; + + mdi_child_type = g_type_register_static (BONOBO_TYPE_MDI_CHILD, + "glMDIChild", + &our_info, + 0); + } + + gl_debug (DEBUG_MDI, "END"); + + return mdi_child_type; +} + +static void +gl_mdi_child_class_init (glMDIChildClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gl_debug (DEBUG_MDI, "START"); + + parent_class = g_type_class_peek_parent (klass); + + gobject_class->finalize = gl_mdi_child_finalize; + + klass->state_changed = gl_mdi_child_real_state_changed; + klass->undo_redo_state_changed = NULL; + + mdi_child_signals [STATE_CHANGED] = + g_signal_new ("state_changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (glMDIChildClass, state_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + mdi_child_signals [UNDO_REDO_STATE_CHANGED] = + g_signal_new ("undo_redo_state_changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (glMDIChildClass, undo_redo_state_changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + BONOBO_MDI_CHILD_CLASS (klass)->create_view = + (BonoboMDIChildViewCreator)(gl_mdi_child_create_view); + + BONOBO_MDI_CHILD_CLASS (klass)->get_config_string = + (BonoboMDIChildConfigFunc)(gl_mdi_child_get_config_string); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_child_init (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + child->priv = g_new0 (glMDIChildPrivate, 1); + + child->priv->tab_label = NULL; + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_child_finalize (GObject *obj) +{ + glMDIChild *child; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (obj != NULL); + + child = GL_MDI_CHILD (obj); + + g_return_if_fail (GL_IS_MDI_CHILD (child)); + g_return_if_fail (child->priv != NULL); + + if (child->label != NULL) + g_object_unref (G_OBJECT (child->label)); + + g_free (child->priv); + + G_OBJECT_CLASS (parent_class)->finalize (obj); + + gl_debug (DEBUG_MDI, "END"); +} + +static void gl_mdi_child_real_state_changed (glMDIChild* child) +{ + gchar* docname = NULL; + gchar* tab_name = NULL; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (child != NULL); + g_return_if_fail (child->label != NULL); + + docname = gl_label_get_short_name (child->label); + g_return_if_fail (docname != NULL); + + if (gl_label_is_modified (child->label)) + { + tab_name = g_strdup_printf ("%s*", docname); + } + else + { + tab_name = g_strdup_printf ("%s", docname); + } + + g_free (docname); + + g_return_if_fail (tab_name != NULL); + + bonobo_mdi_child_set_name (BONOBO_MDI_CHILD (child), tab_name); + + g_free (tab_name); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_child_document_state_changed_handler (glLabel *label, glMDIChild* child) +{ + gl_debug (DEBUG_MDI, ""); + g_return_if_fail (child->label == label); + + g_signal_emit (G_OBJECT (child), mdi_child_signals [STATE_CHANGED], 0); +} + +static void +gl_mdi_child_document_can_undo_redo_handler (glLabel *label, gboolean can, + glMDIChild* child) +{ + gl_debug (DEBUG_MDI, ""); + g_return_if_fail (child->label == label); + + g_signal_emit (G_OBJECT (child), mdi_child_signals [UNDO_REDO_STATE_CHANGED], 0); +} + + +static void +gl_mdi_child_connect_signals (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + g_signal_connect (G_OBJECT (child->label), "name_changed", + G_CALLBACK (gl_mdi_child_document_state_changed_handler), + child); + g_signal_connect (G_OBJECT (child->label), "modified_changed", + G_CALLBACK (gl_mdi_child_document_state_changed_handler), + child); +#if 0 + g_signal_connect (G_OBJECT (child->label), "can_undo", + G_CALLBACK (gl_mdi_child_document_can_undo_redo_handler), + child); + g_signal_connect (G_OBJECT (child->label), "can_redo", + G_CALLBACK (gl_mdi_child_document_can_undo_redo_handler), + child); +#endif + + gl_debug (DEBUG_MDI, "END"); +} + +/** + * gl_mdi_child_new: + * + * Creates a new #glMDIChild object. + * + * Return value: a new #glMDIChild + **/ +glMDIChild* +gl_mdi_child_new (const gchar *tmplt_name, + gboolean rotate_flag) +{ + glMDIChild *child; + gchar *doc_name; + glTemplate *template; + + gl_debug (DEBUG_MDI, "START"); + + child = GL_MDI_CHILD (g_object_new (GL_TYPE_MDI_CHILD, NULL)); + g_return_val_if_fail (child != NULL, NULL); + + child->label = GL_LABEL (gl_label_new ()); + g_return_val_if_fail (child->label != NULL, NULL); + + template = gl_template_from_name (tmplt_name); + gl_label_set_template (child->label, template); + gl_template_free (&template); + gl_label_set_rotate_flag (child->label, rotate_flag); + gl_label_clear_modified (child->label); + + doc_name = gl_label_get_short_name (child->label); + bonobo_mdi_child_set_name (BONOBO_MDI_CHILD (child), doc_name); + g_free(doc_name); + + gl_mdi_child_connect_signals (child); + + gl_debug (DEBUG_MDI, "END"); + + return child; +} + +glMDIChild* +gl_mdi_child_new_with_uri (const gchar *uri, GError **error) +{ + glMDIChild *child; + glLabel *doc; + glXMLLabelStatus status; + + gl_debug (DEBUG_MDI, "START"); + + doc = gl_xml_label_open (uri, &status); + + if (doc == NULL) + { + return NULL; + } + + child = GL_MDI_CHILD (g_object_new (GL_TYPE_MDI_CHILD, NULL)); + g_return_val_if_fail (child != NULL, NULL); + + child->label = doc; + g_return_val_if_fail (child->label != NULL, NULL); + + gl_mdi_child_real_state_changed (child); + + gl_mdi_child_connect_signals (child); + + gl_debug (DEBUG_MDI, "END"); + + return child; +} + +static GtkWidget * +gl_mdi_child_create_view (BonoboMDIChild *child) +{ + glView *new_view; + + gl_debug (DEBUG_MDI, "START"); + + g_return_val_if_fail (child != NULL, NULL); + g_return_val_if_fail (GL_IS_MDI_CHILD (child), NULL); + + new_view = GL_VIEW(gl_view_new (GL_MDI_CHILD (child)->label)); + + gtk_widget_show_all (GTK_WIDGET (new_view)); + + gl_debug (DEBUG_MDI, "END"); + + return GTK_WIDGET (new_view); +} + +static gchar* +gl_mdi_child_get_config_string (BonoboMDIChild *child, gpointer data) +{ + glMDIChild *c; + + gl_debug (DEBUG_MDI, ""); + + g_return_val_if_fail (child != NULL, NULL); + g_return_val_if_fail (GL_IS_MDI_CHILD (child), NULL); + + c = GL_MDI_CHILD (child); + + return gl_label_get_filename (c->label); +} diff --git a/glabels2/src/mdi-child.h b/glabels2/src/mdi-child.h new file mode 100644 index 0000000..9e00cf4 --- /dev/null +++ b/glabels2/src/mdi-child.h @@ -0,0 +1,79 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi-child.h: gLabels MDI child module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi-child.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#ifndef __MDI_CHILD_H__ +#define __MDI_CHILD_H__ + +#include <bonobo-mdi.h> + +#include "label.h" + +#define GL_TYPE_MDI_CHILD (gl_mdi_child_get_type ()) +#define GL_MDI_CHILD(o) (GTK_CHECK_CAST ((o), GL_TYPE_MDI_CHILD, glMDIChild)) +#define GL_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MDI_CHILD, \ + glMDIChildClass)) +#define GL_IS_MDI_CHILD(o) (GTK_CHECK_TYPE ((o), GL_TYPE_MDI_CHILD)) +#define GL_IS_MDI_CHILD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MDI_CHILD)) +#define GL_MDI_CHILD_GET_CLASS(o) (GTK_CHECK_GET_CLASS ((o), GL_TYPE_MDI_CHILD, glMdiChildClass)) + + +typedef struct _glMDIChild glMDIChild; +typedef struct _glMDIChildClass glMDIChildClass; + +typedef struct _glMDIChildPrivate glMDIChildPrivate; + +struct _glMDIChild +{ + BonoboMDIChild child; + + glLabel* label; + glMDIChildPrivate *priv; +}; + +struct _glMDIChildClass +{ + BonoboMDIChildClass parent_class; + + /* MDI child state changed */ + void (*state_changed) (glMDIChild *child); + + void (*undo_redo_state_changed) (glMDIChild *child); +}; + + +GtkType gl_mdi_child_get_type (void) G_GNUC_CONST; + +glMDIChild* gl_mdi_child_new (const gchar *tmplt_name, + gboolean rotate_flag); + +glMDIChild* gl_mdi_child_new_with_uri (const gchar *uri, GError **error); + +#endif /* __MDI_CHILD_H__ */ + diff --git a/glabels2/src/mdi.c b/glabels2/src/mdi.c new file mode 100644 index 0000000..3e0dc58 --- /dev/null +++ b/glabels2/src/mdi.c @@ -0,0 +1,857 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi.c: gLabels MDI module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#include <config.h> + +#include <libgnome/libgnome.h> +#include <libgnomeui/libgnomeui.h> +#include <libgnomevfs/gnome-vfs.h> + +#include <string.h> + +#include "mdi.h" +#include "mdi-child.h" +#include "glabels.h" +#include "menus.h" +#include "prefs.h" +#include "recent.h" +#include "file.h" +#include "view.h" +#include "debug.h" +#include "gnome-recent-view.h" + +#include <bonobo/bonobo-ui-util.h> +#include <bonobo/bonobo-control.h> + +#include <gconf/gconf-client.h> + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define DEFAULT_WINDOW_WIDTH 500 +#define DEFAULT_WINDOW_HEIGHT 375 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glMDIPrivate +{ + gint untitled_number; +}; + + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static BonoboMDIClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_mdi_class_init (glMDIClass *klass); +static void gl_mdi_init (glMDI *mdi); +static void gl_mdi_finalize (GObject *object); + +static void gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win); +static void gl_mdi_set_app_toolbar_style (BonoboWindow *win); +static void gl_mdi_set_app_statusbar_style (BonoboWindow *win); + +static gint gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child); +static gint gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view); +static gint gl_mdi_remove_child_cb (BonoboMDI *mdi, BonoboMDIChild *child); +static gint gl_mdi_remove_view_cb (BonoboMDI *mdi, GtkWidget *view); + +static void gl_mdi_view_changed_cb (BonoboMDI *mdi, GtkWidget *old_view); +static void gl_mdi_child_changed_cb (BonoboMDI *mdi, BonoboMDIChild *old_child); +static void gl_mdi_child_state_changed_cb (glMDIChild *child); + +static void gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi); + +static void gl_mdi_view_menu_item_toggled_cb ( + BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + BonoboWindow *win); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_mdi_get_type (void) +{ + static GType mdi_type = 0; + + if (mdi_type == 0) + { + static const GTypeInfo our_info = + { + sizeof (glMDIClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gl_mdi_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (glMDI), + 0, /* n_preallocs */ + (GInstanceInitFunc) gl_mdi_init + }; + + mdi_type = g_type_register_static (BONOBO_TYPE_MDI, + "glMDI", + &our_info, + 0); + } + + return mdi_type; +} + +static void +gl_mdi_class_init (glMDIClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + gl_debug (DEBUG_MDI, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_mdi_finalize; + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_init (glMDI *mdi) +{ + gl_debug (DEBUG_MDI, "START"); + + bonobo_mdi_construct (BONOBO_MDI (mdi), "glabels", "gLabels", + DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); + + mdi->priv = g_new0 (glMDIPrivate, 1); + + mdi->priv->untitled_number = 0; + + bonobo_mdi_set_ui_template_file (BONOBO_MDI (mdi), + GLABELS_UI_DIR "glabels-ui.xml", + gl_verbs); + + bonobo_mdi_set_child_list_path (BONOBO_MDI (mdi), "/menu/Documents/"); + + /* Connect signals */ + g_signal_connect (G_OBJECT (mdi), "top_window_created", + G_CALLBACK (gl_mdi_app_created_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "add_child", + G_CALLBACK (gl_mdi_add_child_cb), NULL); + g_signal_connect (G_OBJECT (mdi), "add_view", + G_CALLBACK (gl_mdi_add_view_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "remove_child", + G_CALLBACK (gl_mdi_remove_child_cb), NULL); + g_signal_connect (G_OBJECT (mdi), "remove_view", + G_CALLBACK (gl_mdi_remove_view_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "child_changed", + G_CALLBACK (gl_mdi_child_changed_cb), NULL); + g_signal_connect (G_OBJECT (mdi), "view_changed", + G_CALLBACK (gl_mdi_view_changed_cb), NULL); + + g_signal_connect (G_OBJECT (mdi), "all_windows_destroyed", + G_CALLBACK (gl_file_exit), NULL); + + gl_debug (DEBUG_MDI, "END"); +} + +static void +gl_mdi_finalize (GObject *object) +{ + glMDI *mdi; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (object != NULL); + + mdi = GL_MDI (object); + + g_return_if_fail (GL_IS_MDI (mdi)); + g_return_if_fail (mdi->priv != NULL); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + g_free (mdi->priv); + + gl_debug (DEBUG_MDI, "END"); +} + + +/*****************************************************************************/ +/* NEW mdi objecg. */ +/*****************************************************************************/ +glMDI* +gl_mdi_new (void) +{ + glMDI *mdi; + + gl_debug (DEBUG_MDI, "START"); + + mdi = GL_MDI (g_object_new (GL_TYPE_MDI, NULL)); + g_return_val_if_fail (mdi != NULL, NULL); + + gl_debug (DEBUG_MDI, "END"); + return mdi; +} + +/*---------------------------------------------------------------------------*/ +/* App created callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_app_created_cb (BonoboMDI *mdi, BonoboWindow *win) +{ + GtkWidget *widget; + BonoboControl *control; + BonoboUIComponent *ui_component; + GnomeRecentView *view; + GnomeRecentModel *model; + + static GtkTargetEntry drag_types[] = + { + { "text/uri-list", 0, 0 }, + }; + + static gint n_drag_types = + sizeof (drag_types) / sizeof (drag_types [0]); + + gl_debug (DEBUG_MDI, "START"); + + ui_component = bonobo_mdi_get_ui_component_from_window (win); + g_return_if_fail (ui_component != NULL); + + /* Set the toolbar style according to prefs */ + gl_mdi_set_app_toolbar_style (win); + + /* Add listener fo the view menu */ + bonobo_ui_component_add_listener (ui_component, "ViewToolbar", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + + bonobo_ui_component_add_listener (ui_component, "ToolbarSystem", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + bonobo_ui_component_add_listener (ui_component, "ToolbarIcon", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + bonobo_ui_component_add_listener (ui_component, "ToolbarIconText", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + bonobo_ui_component_add_listener (ui_component, "ToolbarTooltips", + (BonoboUIListenerFn)gl_mdi_view_menu_item_toggled_cb, + (gpointer)win); + + + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_no_docs_sensible_verbs, + FALSE); + + /* add a GeditRecentView object */ + model = gl_recent_get_model (); + view = GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component, + "/menu/File/Recents")); + gnome_recent_view_set_model (view, model); + + g_signal_connect (G_OBJECT (view), "activate", + G_CALLBACK (gl_file_open_recent), win); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Menu item togglded callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_view_menu_item_toggled_cb ( + BonoboUIComponent *ui_component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + BonoboWindow *win) +{ + gboolean s; + + gl_debug (DEBUG_MDI, "%s toggled to '%s'", path, state); + + s = (strcmp (state, "1") == 0); + + if ((strcmp (path, "ViewToolbar") == 0) && + (s != gl_prefs->toolbar_visible)) + { + gl_prefs->toolbar_visible = s; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if (s && (strcmp (path, "ToolbarSystem") == 0) && + (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_SYSTEM)) + { + gl_prefs->toolbar_buttons_style = GL_TOOLBAR_SYSTEM; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if (s && (strcmp (path, "ToolbarIcon") == 0) && + (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_ICONS)) + { + gl_prefs->toolbar_buttons_style = GL_TOOLBAR_ICONS; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if (s && (strcmp (path, "ToolbarIconText") == 0) && + (gl_prefs->toolbar_buttons_style != GL_TOOLBAR_ICONS_AND_TEXT)) + { + gl_prefs->toolbar_buttons_style = GL_TOOLBAR_ICONS_AND_TEXT; + gl_mdi_set_app_toolbar_style (win); + + return; + } + + if ((strcmp (path, "ToolbarTooltips") == 0) && + (s != gl_prefs->toolbar_view_tooltips)) + { + gl_prefs->toolbar_view_tooltips = s; + gl_mdi_set_app_toolbar_style (win); + + return; + } + +} + +/*---------------------------------------------------------------------------*/ +/* Set toolbar style. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_set_app_toolbar_style (BonoboWindow *win) +{ + BonoboUIComponent *ui_component; + GConfClient *client; + gboolean labels; + + gl_debug (DEBUG_MDI, "START"); + + g_return_if_fail (BONOBO_IS_WINDOW (win)); + + ui_component = bonobo_mdi_get_ui_component_from_window (win); + g_return_if_fail (ui_component != NULL); + + bonobo_ui_component_freeze (ui_component, NULL); + + /* Updated view menu */ + gl_menus_set_verb_state (ui_component, + "/commands/ViewToolbar", + gl_prefs->toolbar_visible); + + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarSystem", + gl_prefs->toolbar_visible); + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarIcon", + gl_prefs->toolbar_visible); + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarIconText", + gl_prefs->toolbar_visible); + gl_menus_set_verb_sensitive (ui_component, + "/commands/ToolbarTooltips", + gl_prefs->toolbar_visible); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarSystem", + gl_prefs->toolbar_buttons_style == GL_TOOLBAR_SYSTEM); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarIcon", + gl_prefs->toolbar_buttons_style == GL_TOOLBAR_ICONS); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarIconText", + gl_prefs->toolbar_buttons_style == GL_TOOLBAR_ICONS_AND_TEXT); + + gl_menus_set_verb_state (ui_component, + "/commands/ToolbarTooltips", + gl_prefs->toolbar_view_tooltips); + + + /* Actually update toolbar style */ + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", + "tips", gl_prefs->toolbar_view_tooltips ? "1" : "0", + NULL); + + switch (gl_prefs->toolbar_buttons_style) + { + case GL_TOOLBAR_SYSTEM: + + client = gconf_client_get_default (); + if (client == NULL) + goto error; + + labels = gconf_client_get_bool (client, + "/desktop/gnome/interface/toolbar-labels", NULL); + + g_object_unref (G_OBJECT (client)); + + if (labels) + { + gl_debug (DEBUG_MDI, "SYSTEM: BOTH"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "both", NULL); + + } + else + { + gl_debug (DEBUG_MDI, "SYSTEM: ICONS"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "icons", NULL); + } + + break; + + case GL_TOOLBAR_ICONS: + gl_debug (DEBUG_MDI, "GLABELS: ICONS"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "icon", NULL); + + break; + + case GL_TOOLBAR_ICONS_AND_TEXT: + gl_debug (DEBUG_MDI, "GLABELS: ICONS_AND_TEXT"); + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", "look", "both", NULL); + + break; + default: + goto error; + break; + } + + bonobo_ui_component_set_prop ( + ui_component, "/Toolbar", + "hidden", gl_prefs->toolbar_visible ? "0":"1", NULL); + + error: + bonobo_ui_component_thaw (ui_component, NULL); + + gl_debug (DEBUG_MDI, "END"); +} + + +/*---------------------------------------------------------------------------*/ +/* Child state changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_child_state_changed_cb (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) != BONOBO_MDI_CHILD (child)) + return; + + gl_mdi_set_active_window_title (BONOBO_MDI (glabels_mdi)); + gl_mdi_set_active_window_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Child undo/redo state changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +gl_mdi_child_undo_redo_state_changed_cb (glMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + if (bonobo_mdi_get_active_child (BONOBO_MDI (glabels_mdi)) != BONOBO_MDI_CHILD (child)) + return; + + gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BONOBO_MDI (glabels_mdi)); + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Add child callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_add_child_cb (BonoboMDI *mdi, BonoboMDIChild *child) +{ + gl_debug (DEBUG_MDI, "START"); + + g_signal_connect (G_OBJECT (child), "state_changed", + G_CALLBACK (gl_mdi_child_state_changed_cb), + NULL); + g_signal_connect (G_OBJECT (child), "undo_redo_state_changed", + G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb), + NULL); + + gl_debug (DEBUG_MDI, "END"); + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* Add view callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_add_view_cb (BonoboMDI *mdi, GtkWidget *view) +{ + gl_debug (DEBUG_MDI, "START"); + gl_debug (DEBUG_MDI, "END"); + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* Remove child callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_remove_child_cb (BonoboMDI *mdi, BonoboMDIChild *child) +{ + glLabel* doc; + gboolean close = TRUE; + + gl_debug (DEBUG_MDI, "START"); + + g_return_val_if_fail (child != NULL, FALSE); + g_return_val_if_fail (GL_MDI_CHILD (child)->label != NULL, FALSE); + + doc = GL_MDI_CHILD (child)->label; + + if (gl_label_is_modified (doc)) + { + GtkWidget *msgbox, *w; + gchar *fname = NULL, *msg = NULL; + gint ret; + gboolean exiting; + + w = GTK_WIDGET (g_list_nth_data (bonobo_mdi_child_get_views (child), 0)); + + if(w != NULL) + bonobo_mdi_set_active_view (mdi, w); + + fname = gl_label_get_short_name (doc); + + msgbox = gtk_message_dialog_new (GTK_WINDOW (bonobo_mdi_get_active_window (mdi)), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + _("Do you want to save the changes you made to the document \"%s\"? \n\n" + "Your changes will be lost if you don't save them."), + fname); + + gl_util_dialog_add_button (GTK_DIALOG (msgbox), + _("Do_n't save"), + GTK_STOCK_NO, + GTK_RESPONSE_NO); + + if (glabels_close_x_button_pressed) + exiting = FALSE; + else if (glabels_exit_button_pressed) + exiting = TRUE; + else + { + /* Delete event generated */ + if (g_list_length (bonobo_mdi_get_windows (BONOBO_MDI (glabels_mdi))) == 1) + exiting = TRUE; + else + exiting = FALSE; + } + +#if 0 + if (exiting) + gl_util_dialog_add_button (GTK_DIALOG (msgbox), + _("_Don't quit"), + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); + else + gl_util_dialog_add_button (GTK_DIALOG (msgbox), + _("_Don't close"), + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); +#endif + + gtk_dialog_add_button (GTK_DIALOG (msgbox), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + + gtk_dialog_add_button (GTK_DIALOG (msgbox), + GTK_STOCK_SAVE, + GTK_RESPONSE_YES); + + gtk_dialog_set_default_response (GTK_DIALOG (msgbox), GTK_RESPONSE_YES); + + gtk_window_set_resizable (GTK_WINDOW (msgbox), FALSE); + + ret = gtk_dialog_run (GTK_DIALOG (msgbox)); + + gtk_widget_destroy (msgbox); + + g_free (fname); + g_free (msg); + + switch (ret) + { + case GTK_RESPONSE_YES: + close = gl_file_save (GL_MDI_CHILD (child)); + break; + case GTK_RESPONSE_NO: + close = TRUE; + break; + default: + close = FALSE; + } + + gl_debug (DEBUG_MDI, "CLOSE: %s", close ? "TRUE" : "FALSE"); + } + + /* FIXME: there is a bug if you "close all" >1 docs, don't save the document + * and then don't close the last one. + */ + /* Disable to avoid the bug */ + /* + if (close) + { + g_signal_handlers_disconnect_by_func (child, + G_CALLBACK (gl_mdi_child_state_changed_cb), + NULL); + g_signal_handlers_disconnect_by_func (GTK_OBJECT (child), + G_CALLBACK (gl_mdi_child_undo_redo_state_changed_cb), + NULL); + } + */ + + gl_debug (DEBUG_MDI, "END"); + return close; +} + +/*---------------------------------------------------------------------------*/ +/* Remove view callback. */ +/*---------------------------------------------------------------------------*/ +static gint +gl_mdi_remove_view_cb (BonoboMDI *mdi, GtkWidget *view) +{ + gl_debug (DEBUG_MDI, ""); + gl_debug (DEBUG_MDI, "END"); + + return TRUE; +} + +/*****************************************************************************/ +/* Set title of active window. */ +/*****************************************************************************/ +void +gl_mdi_set_active_window_title (BonoboMDI *mdi) +{ + BonoboMDIChild* active_child = NULL; + glLabel* doc = NULL; + gchar* docname = NULL; + gchar* title = NULL; + + gl_debug (DEBUG_MDI, "START"); + + + active_child = bonobo_mdi_get_active_child (mdi); + if (active_child == NULL) + return; + + doc = GL_MDI_CHILD (active_child)->label; + g_return_if_fail (doc != NULL); + + /* Set active window title */ + docname = gl_label_get_short_name (doc); + g_return_if_fail (docname != NULL); + + if (gl_label_is_modified (doc)) + { + title = g_strdup_printf ("%s %s - glabels", + docname, _("(modified)")); + } + else + { + title = g_strdup_printf ("%s - glabels", docname); + + } + + gtk_window_set_title (GTK_WINDOW (bonobo_mdi_get_active_window (mdi)), title); + + g_free (docname); + g_free (title); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Child changed callback. */ +/*---------------------------------------------------------------------------*/ +static +void gl_mdi_child_changed_cb (BonoboMDI *mdi, BonoboMDIChild *old_child) +{ + gl_debug (DEBUG_MDI, "START"); + + gl_mdi_set_active_window_title (mdi); + + gl_debug (DEBUG_MDI, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* View changed callback. */ +/*---------------------------------------------------------------------------*/ +static +void gl_mdi_view_changed_cb (BonoboMDI *mdi, GtkWidget *old_view) +{ + BonoboWindow *win; + GtkWidget* status; + GtkWidget *active_view; + + gl_debug (DEBUG_MDI, "START"); + + gl_mdi_set_active_window_verbs_sensitivity (mdi); + + active_view = bonobo_mdi_get_active_view (mdi); + + win = bonobo_mdi_get_active_window (mdi); + g_return_if_fail (win != NULL); + + gl_debug (DEBUG_MDI, "END"); +} + +/*****************************************************************************/ +/* Set sensitivity of verbs in active window. */ +/*****************************************************************************/ +void +gl_mdi_set_active_window_verbs_sensitivity (BonoboMDI *mdi) +{ + /* FIXME: it is too slooooooow! - Paolo */ + + BonoboWindow* active_window = NULL; + BonoboMDIChild* active_child = NULL; + glLabel* doc = NULL; + BonoboUIComponent *ui_component; + + gl_debug (DEBUG_MDI, "START"); + + active_window = bonobo_mdi_get_active_window (mdi); + + if (active_window == NULL) + return; + + ui_component = bonobo_mdi_get_ui_component_from_window (active_window); + g_return_if_fail (ui_component != NULL); + + active_child = bonobo_mdi_get_active_child (mdi); + + bonobo_ui_component_freeze (ui_component, NULL); + + if (active_child == NULL) + { + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_no_docs_sensible_verbs, FALSE); + goto end; + } + else + { + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_all_sensible_verbs, TRUE); + } + + doc = GL_MDI_CHILD (active_child)->label; + g_return_if_fail (doc != NULL); + + if (!gl_label_can_undo (doc)) + gl_menus_set_verb_sensitive (ui_component, + "/commands/EditUndo", FALSE); + + if (!gl_label_can_redo (doc)) + gl_menus_set_verb_sensitive (ui_component, + "/commands/EditRedo", FALSE); + + if (!gl_label_is_modified (doc)) + { + gl_menus_set_verb_list_sensitive (ui_component, + gl_menus_not_modified_doc_sensible_verbs, + FALSE); + goto end; + } + +end: + bonobo_ui_component_thaw (ui_component, NULL); + + gl_debug (DEBUG_MDI, "END"); +} + + +/*****************************************************************************/ +/* Set sensitivity of undo/redo verbs in active window. */ +/*****************************************************************************/ +static void +gl_mdi_set_active_window_undo_redo_verbs_sensitivity (BonoboMDI *mdi) +{ + BonoboWindow* active_window = NULL; + BonoboMDIChild* active_child = NULL; + glLabel* doc = NULL; + BonoboUIComponent *ui_component; + + gl_debug (DEBUG_MDI, "START"); + + active_window = bonobo_mdi_get_active_window (mdi); + g_return_if_fail (active_window != NULL); + + ui_component = bonobo_mdi_get_ui_component_from_window (active_window); + g_return_if_fail (ui_component != NULL); + + active_child = bonobo_mdi_get_active_child (mdi); + doc = GL_MDI_CHILD (active_child)->label; + g_return_if_fail (doc != NULL); + + bonobo_ui_component_freeze (ui_component, NULL); + + gl_menus_set_verb_sensitive (ui_component, "/commands/EditUndo", + gl_label_can_undo (doc)); + + gl_menus_set_verb_sensitive (ui_component, "/commands/EditRedo", + gl_label_can_redo (doc)); + + bonobo_ui_component_thaw (ui_component, NULL); + + gl_debug (DEBUG_MDI, "END"); +} + diff --git a/glabels2/src/mdi.h b/glabels2/src/mdi.h new file mode 100644 index 0000000..3f215a3 --- /dev/null +++ b/glabels2/src/mdi.h @@ -0,0 +1,73 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi.h: gLabels MDI module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-mdi.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * Copyright (C) 2002 Paolo Maggi + * + */ +#ifndef __MDI_H__ +#define __MDI_H__ + +#include <bonobo-mdi.h> + +#define GL_TYPE_MDI (gl_mdi_get_type ()) +#define GL_MDI(obj) (GTK_CHECK_CAST ((obj), GL_TYPE_MDI, glMDI)) +#define GL_MDI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MDI, glMDIClass)) +#define GL_IS_MDI(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_MDI)) +#define GL_IS_MDI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MDI)) +#define GL_MDI_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_MDI, glMdiClass)) + + +typedef struct _glMDI glMDI; +typedef struct _glMDIClass glMDIClass; + +typedef struct _glMDIPrivate glMDIPrivate; + +struct _glMDI +{ + BonoboMDI mdi; + + glMDIPrivate *priv; +}; + +struct _glMDIClass +{ + BonoboMDIClass parent_class; +}; + + +GtkType gl_mdi_get_type (void) G_GNUC_CONST; + +glMDI* gl_mdi_new (void); + +void gl_mdi_set_active_window_title (BonoboMDI *mdi); + +void gl_mdi_update_ui_according_to_preferences (glMDI *mdi); + +void gl_mdi_set_active_window_verbs_sensitivity (BonoboMDI *mdi); + +#endif /* __MDI_H__ */ + diff --git a/glabels2/src/menus.c b/glabels2/src/menus.c new file mode 100644 index 0000000..f2c05e7 --- /dev/null +++ b/glabels2/src/menus.c @@ -0,0 +1,260 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * menus.c: GLabels menus module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-menus.c from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#include <config.h> + +#include "menus.h" +#include "commands.h" +#include "tools.h" +#include "glabels.h" + +BonoboUIVerb gl_verbs [] = { + BONOBO_UI_VERB ("FileNew", gl_cmd_file_new), + BONOBO_UI_VERB ("FileOpen", gl_cmd_file_open), + BONOBO_UI_VERB ("FileSave", gl_cmd_file_save), + BONOBO_UI_VERB ("FileSaveAs", gl_cmd_file_save_as), + BONOBO_UI_VERB ("FilePrint", gl_cmd_file_print), + BONOBO_UI_VERB ("FileClose", gl_cmd_file_close), + BONOBO_UI_VERB ("FileCloseAll", gl_cmd_file_close_all), + BONOBO_UI_VERB ("FileExit", gl_cmd_file_exit), + BONOBO_UI_VERB ("EditCut", gl_cmd_edit_cut), + BONOBO_UI_VERB ("EditCopy", gl_cmd_edit_copy), + BONOBO_UI_VERB ("EditPaste", gl_cmd_edit_paste), + BONOBO_UI_VERB ("EditDelete", gl_cmd_edit_delete), + BONOBO_UI_VERB ("EditSelectAll", gl_cmd_edit_select_all), + BONOBO_UI_VERB ("EditUnSelectAll", gl_cmd_edit_unselect_all), + BONOBO_UI_VERB ("ToolsArrow", gl_tools_arrow), + BONOBO_UI_VERB ("ToolsText", gl_tools_text), + BONOBO_UI_VERB ("ToolsBox", gl_tools_box), + BONOBO_UI_VERB ("ToolsLine", gl_tools_line), + BONOBO_UI_VERB ("ToolsEllipse", gl_tools_ellipse), + BONOBO_UI_VERB ("ToolsImage", gl_tools_image), + BONOBO_UI_VERB ("ToolsBarcode", gl_tools_barcode), + BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin), + BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout), + BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1), + BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties), + BONOBO_UI_VERB ("SettingsPreferences", gl_cmd_settings_preferences), + BONOBO_UI_VERB ("HelpContents", gl_cmd_help_contents), + BONOBO_UI_VERB ("About", gl_cmd_help_about), + + BONOBO_UI_VERB_END +}; + +gchar* gl_menus_no_docs_sensible_verbs [] = { + "/commands/FileSave", + "/commands/FileSaveAs", + "/commands/FilePrint", + "/commands/FilePrintPreview", + "/commands/FileClose", + "/commands/FileCloseAll", + "/commands/EditUndo", + "/commands/EditRedo", + "/commands/EditCut", + "/commands/EditCopy", + "/commands/EditPaste", + "/commands/EditDelete", + "/commands/EditSelectAll", + "/commands/EditUnSelectAll", + "/commands/ToolsArrow", + "/commands/ToolsText", + "/commands/ToolsLine", + "/commands/ToolsBox", + "/commands/ToolsEllipse", + "/commands/ToolsImage", + "/commands/ToolsBarcode", + "/commands/ToolsZoomIn", + "/commands/ToolsZoomOut", + "/commands/ToolsZoom1to1", + "/commands/ToolsMergeProperties", + + NULL +}; + +gchar* gl_menus_not_modified_doc_sensible_verbs [] = { + "/commands/FileSave", + + NULL +}; + + +void +gl_menus_set_verb_sensitive (BonoboUIComponent *ui_component, gchar* cname, gboolean sensitive) +{ + g_return_if_fail (cname != NULL); + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + bonobo_ui_component_set_prop ( + ui_component, cname, "sensitive", sensitive ? "1" : "0", NULL); +} + +void +gl_menus_set_verb_list_sensitive (BonoboUIComponent *ui_component, gchar** vlist, gboolean sensitive) +{ + g_return_if_fail (vlist != NULL); + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + for ( ; *vlist; ++vlist) + { + bonobo_ui_component_set_prop ( + ui_component, *vlist, "sensitive", sensitive ? "1" : "0", NULL); + } +} + +void +gl_menus_set_verb_state (BonoboUIComponent *ui_component, gchar* cname, gboolean state) +{ + g_return_if_fail (cname != NULL); + g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component)); + + bonobo_ui_component_set_prop ( + ui_component, cname, "state", state ? "1" : "0", NULL); +} + +void +gl_menus_add_menu_item (BonoboWindow *window, const gchar *path, + const gchar *name, const gchar *label, + const gchar *tooltip, const gchar *stock_pixmap, + BonoboUIVerbFn cb) +{ + BonoboUIComponent *ui_component; + gchar *item_path; + gchar *cmd; + + g_return_if_fail (window != NULL); + g_return_if_fail (path != NULL); + g_return_if_fail (label != NULL); + g_return_if_fail (cb != NULL); + + item_path = g_strconcat (path, name, NULL); + ui_component = bonobo_mdi_get_ui_component_from_window (BONOBO_WINDOW (window)); + if (!bonobo_ui_component_path_exists (ui_component, item_path, NULL)) { + gchar *xml; + + xml = g_strdup_printf ("<menuitem name=\"%s\" verb=\"\"" + " _label=\"%s\"" + " _tip=\"%s\" hident=\"0\" />", name, + label, tooltip); + + + if (stock_pixmap != NULL) { + cmd = g_strdup_printf ("<cmd name=\"%s\"" + " pixtype=\"stock\" pixname=\"%s\" />", + name, stock_pixmap); + } + else { + cmd = g_strdup_printf ("<cmd name=\"%s\" />", name); + } + + + bonobo_ui_component_set_translate (ui_component, path, + xml, NULL); + + bonobo_ui_component_set_translate (ui_component, "/commands/", + cmd, NULL); + + bonobo_ui_component_add_verb (ui_component, name, cb, NULL); + + g_free (xml); + g_free (cmd); + } + + g_free (item_path); +} + +void +gl_menus_remove_menu_item (BonoboWindow *window, const gchar *path, + const gchar *name) +{ + BonoboUIComponent *ui_component; + gchar *item_path; + + g_return_if_fail (window != NULL); + g_return_if_fail (path != NULL); + g_return_if_fail (name != NULL); + + item_path = g_strconcat (path, name, NULL); + ui_component = bonobo_mdi_get_ui_component_from_window (BONOBO_WINDOW (window)); + + if (bonobo_ui_component_path_exists (ui_component, item_path, NULL)) { + gchar *cmd; + + cmd = g_strdup_printf ("/commands/%s", name); + + bonobo_ui_component_rm (ui_component, item_path, NULL); + bonobo_ui_component_rm (ui_component, cmd, NULL); + + g_free (cmd); + } + + g_free (item_path); +} + +void +gl_menus_add_menu_item_all (const gchar *path, const gchar *name, + const gchar *label, const gchar *tooltip, + const gchar *stock_pixmap, + BonoboUIVerbFn cb) +{ + GList* top_windows; + + top_windows = glabels_get_top_windows (); + g_return_if_fail (top_windows != NULL); + + while (top_windows) + { + BonoboWindow* window = BONOBO_WINDOW (top_windows->data); + + + gl_menus_add_menu_item (window, path, name, label, tooltip, + stock_pixmap, cb); + + top_windows = g_list_next (top_windows); + } +} + +void +gl_menus_remove_menu_item_all (const gchar *path, const gchar *name) +{ + GList* top_windows; + + top_windows = glabels_get_top_windows (); + g_return_if_fail (top_windows != NULL); + + while (top_windows) + { + BonoboWindow* window = BONOBO_WINDOW (top_windows->data); + + + gl_menus_remove_menu_item (window, path, name); + + + top_windows = g_list_next (top_windows); + } +} diff --git a/glabels2/src/menus.h b/glabels2/src/menus.h new file mode 100644 index 0000000..24a0541 --- /dev/null +++ b/glabels2/src/menus.h @@ -0,0 +1,80 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * menus.h: GLabels menus module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This file is based on gedit-menus.h from gedit2: + * + * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence + * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi + * + */ +#ifndef __GL_MENU_H__ +#define __GL_MENU_H__ + +#include <bonobo/bonobo-ui-component.h> +#include <bonobo/bonobo-ui-engine.h> +#include <bonobo/bonobo-window.h> + +extern BonoboUIVerb gl_verbs []; +extern gchar* gl_menus_no_docs_sensible_verbs []; +extern gchar* gl_menus_untitled_doc_sensible_verbs []; +extern gchar* gl_menus_not_modified_doc_sensible_verbs []; + +#define gl_menus_all_sensible_verbs gl_menus_no_docs_sensible_verbs + +void gl_menus_set_verb_sensitive (BonoboUIComponent *ui_component, + gchar *cname, + gboolean sensitive); +void gl_menus_set_verb_list_sensitive (BonoboUIComponent *ui_component, + gchar **vlist, + gboolean sensitive); +void gl_menus_set_verb_state (BonoboUIComponent *ui_component, + gchar* cname, + gboolean state); + +/* convenience functions for plugins */ + +void gl_menus_add_menu_item (BonoboWindow *window, + const gchar *path, + const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *stock_pixmap, + BonoboUIVerbFn cb); + +void gl_menus_remove_menu_item (BonoboWindow *window, + const gchar *path, + const gchar *name); + + +void gl_menus_add_menu_item_all (const gchar *path, + const gchar *name, + const gchar *label, + const gchar *tooltip, + const gchar *stock_pixmap, + BonoboUIVerbFn cb); + +void gl_menus_remove_menu_item_all (const gchar *path, + const gchar *name); + + +#endif /* __GL_MENU_H__ */ diff --git a/glabels2/src/merge-properties.c b/glabels2/src/merge-properties.c new file mode 100644 index 0000000..b55770a --- /dev/null +++ b/glabels2/src/merge-properties.c @@ -0,0 +1,270 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_properties.c: document merge properties dialog module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include "glabels.h" +#include "mdi.h" +#include "view.h" +#include "merge.h" +#include "merge-ui.h" +#include "merge-properties.h" + +#include "debug.h" + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GtkWidget *dialog; + + glView *view; + glLabel *label; + + GtkWidget *type_entry; + GtkWidget *src_entry; + GtkWidget *field_ws; + + glMergeType src_type; + gchar *field_ws_src; + +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void create_merge_dialog_widgets (GtkDialog * dialog, + PropertyDialogPassback * data); + +static void type_changed_cb (GtkWidget * widget, PropertyDialogPassback * data); +static void src_changed_cb (GtkWidget * widget, PropertyDialogPassback * data); + +static void response_cb (GtkDialog * dialog, gint response, + PropertyDialogPassback * data); + +/****************************************************************************/ +/* Launch merge properties dialog. */ +/****************************************************************************/ +void +gl_merge_properties_dialog (glView * view) +{ + static PropertyDialogPassback *data = NULL; + GtkWidget *dialog; + BonoboWindow *win = glabels_get_active_window (); + + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + + dialog = gtk_dialog_new_with_buttons ( + _("Edit document-merge properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); + + data->dialog = dialog; + data->view = view; + data->label = view->label; + + data->type_entry = NULL; + data->src_entry = NULL; + data->field_ws = NULL; + + create_merge_dialog_widgets (GTK_DIALOG (dialog), data); + + g_signal_connect (G_OBJECT(dialog), "response", + G_CALLBACK(response_cb), data); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create and add start page to druid. */ +/*--------------------------------------------------------------------------*/ +static void +create_merge_dialog_widgets (GtkDialog * dialog, + PropertyDialogPassback * data) +{ + GtkWidget *wvbox, *wframe, *whbox, *wtable, *wlabel, *wcombo, *wscroll; + GList *texts; + glMerge *merge; + glMergeType type; + gchar *src; + GList *fields; + + merge = gl_label_get_merge (data->label); + type = merge->type; + src = merge->src; + fields = merge->field_defs; + gl_merge_free (&merge); + + wvbox = dialog->vbox; + + wframe = gtk_frame_new (_("Source")); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + whbox = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_container_add (GTK_CONTAINER (wframe), whbox); + + wtable = gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_box_pack_start (GTK_BOX (whbox), wtable, FALSE, FALSE, GNOME_PAD); + + wlabel = gtk_label_new (_("Format:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + wcombo = gtk_combo_new (); + gtk_widget_set_usize (wcombo, 400, -1); + texts = gl_merge_get_long_texts_list (); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), texts); + gl_merge_free_long_texts_list (&texts); + data->type_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (data->type_entry), FALSE); + gtk_table_attach_defaults (GTK_TABLE (wtable), wcombo, 1, 2, 0, 1); + gtk_entry_set_text (GTK_ENTRY (data->type_entry), + gl_merge_type_to_long_text (type)); + + wlabel = gtk_label_new (_("Location:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + + data->src_entry = gl_merge_ui_src_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), data->src_entry, 1, 2, 1, + 2); + gl_merge_ui_src_set_type (GL_MERGE_UI_SRC (data->src_entry), type); + gl_merge_ui_src_set_value (GL_MERGE_UI_SRC (data->src_entry), src); + + wframe = gtk_frame_new (_("Fields")); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wscroll = gtk_scrolled_window_new (NULL, NULL); + gtk_container_set_border_width (GTK_CONTAINER (wscroll), 5); + gtk_widget_set_usize (wscroll, 500, 300); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (wframe), wscroll); + + data->field_ws = gl_merge_ui_field_ws_new (); + gtk_container_set_border_width (GTK_CONTAINER (data->field_ws), 10); + gl_merge_ui_field_ws_set_type_src (GL_MERGE_UI_FIELD_WS + (data->field_ws), type, src); + gl_merge_ui_field_ws_set_field_defs (GL_MERGE_UI_FIELD_WS + (data->field_ws), fields); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (wscroll), + data->field_ws); + + g_signal_connect (G_OBJECT (data->type_entry), "changed", + G_CALLBACK (type_changed_cb), data); + g_signal_connect (G_OBJECT (data->src_entry), "changed", + G_CALLBACK (src_changed_cb), data); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. type "changed" callback. */ +/*--------------------------------------------------------------------------*/ +static void +type_changed_cb (GtkWidget * widget, + PropertyDialogPassback * data) +{ + glMergeType type; + gchar *type_text; + + type_text = gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + gl_merge_ui_src_set_type (GL_MERGE_UI_SRC (data->src_entry), type); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. source "changed" callback. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (GtkWidget * widget, + PropertyDialogPassback * data) +{ + glMergeType type; + gchar *type_text, *src; + + type_text = gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + src = gl_merge_ui_src_get_value (GL_MERGE_UI_SRC (data->src_entry)); + gl_merge_ui_field_ws_set_type_src (GL_MERGE_UI_FIELD_WS + (data->field_ws), type, src); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. response callback. */ +/*--------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog * dialog, + gint response, + PropertyDialogPassback * data) +{ + gchar *type_text; + glMerge *merge; + + switch (response) { + + case GTK_RESPONSE_OK: + + merge = gl_merge_new(); + + type_text = + gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + merge->type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + merge->src = + gl_merge_ui_src_get_value (GL_MERGE_UI_SRC (data->src_entry)); + + merge->field_defs = + gl_merge_ui_field_ws_get_field_defs (GL_MERGE_UI_FIELD_WS + (data->field_ws)); + + gl_label_set_merge (data->label, merge); + + gl_merge_free (&merge); + + break; + } + + gtk_widget_destroy (data->dialog); +} diff --git a/glabels2/src/merge-properties.h b/glabels2/src/merge-properties.h new file mode 100644 index 0000000..1d72b58 --- /dev/null +++ b/glabels2/src/merge-properties.h @@ -0,0 +1,29 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_properties.h: document merge properties dialog module header file + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_PROPERTIES_H__ +#define __MERGE_PROPERTIES_H__ + +#include "view.h" + +extern void gl_merge_properties_dialog (glView * view); + +#endif diff --git a/glabels2/src/merge-text.c b/glabels2/src/merge-text.c new file mode 100644 index 0000000..50852e5 --- /dev/null +++ b/glabels2/src/merge-text.c @@ -0,0 +1,272 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_text.c: text-file merge backend module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> + +#include "merge-text.h" + +#include "debug.h" + +#define LINE_BUF_LEN 1024 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ +static GList * split_fields( gchar *line, gchar delim ); +static void free_fields( GList **fields ); + + +/****************************************************************************/ +/* Open merge source. */ +/****************************************************************************/ +glMergeInput * +gl_merge_text_open (glMergeType type, + GList * field_defs, + gchar * src) +{ + FILE *fp; + glMergeInput *input; + + fp = fopen (src, "r"); + if (fp == NULL) { + return NULL; + } + + input = g_new0 (glMergeInput, 1); + input->type = type; + input->field_defs = field_defs; + input->handle = fp; + + return input; +} + +/****************************************************************************/ +/* Close merge source. */ +/****************************************************************************/ +void +gl_merge_text_close (glMergeInput * input) +{ + if (input != NULL) { + + fclose ((FILE *) input->handle); + g_free (input); + + } +} + +/****************************************************************************/ +/* Get next record from merge source, NULL if no records left (i.e EOF) */ +/****************************************************************************/ +glMergeRecord * +gl_merge_text_get_record (glMergeInput * input) +{ + gchar delim, *loc; + GList *fields, *p; + gint i_field; + glMergeRecord *record = NULL; + glMergeField *field; + gchar line[LINE_BUF_LEN]; + + if (input != NULL) { + + switch (input->type) { + case GL_MERGE_TEXT_TAB: + delim = '\t'; + break; + case GL_MERGE_TEXT_COLON: + delim = ':'; + break; + case GL_MERGE_TEXT_COMMA: + delim = ','; + break; + default: + g_warning ("Unexpected merge type"); + return NULL; + } + + while (fgets (line, LINE_BUF_LEN, (FILE *) input->handle) != + NULL) { + if (TRUE /* TODO: skip blank lines or comments */ ) { + g_strchomp (line); + record = g_new0 (glMergeRecord, 1); + record->select_flag = TRUE; + fields = split_fields (line, delim); + i_field = 1; + for (p=fields; p != NULL; p=p->next) { + loc = + g_strdup_printf ("%d", i_field++); + field = g_new0 (glMergeField, 1); + field->value = g_strdup (p->data); + field->key = + gl_merge_find_key (input-> + field_defs, loc); + record->field_list = + g_list_append (record->field_list, field); + g_free (loc); + } + free_fields (&fields); + return record; + } + } + + } + return NULL; +} + +/****************************************************************************/ +/* Retrieve a list of raw fields (columns in this case) */ +/****************************************************************************/ +GList * +gl_merge_text_get_raw_record (glMergeInput * input) +{ + GList *list = NULL; + gchar line[LINE_BUF_LEN], delim; + GList *fields, *p; + gint i_field; + glMergeRawField *raw_field; + + if (input != NULL) { + + switch (input->type) { + case GL_MERGE_TEXT_TAB: + delim = '\t'; + break; + case GL_MERGE_TEXT_COLON: + delim = ':'; + break; + case GL_MERGE_TEXT_COMMA: + delim = ','; + break; + default: + g_warning ("Unexpected merge type"); + return NULL; + } + + while (fgets (line, LINE_BUF_LEN, (FILE *) input->handle) + != NULL) { + if (TRUE /* TODO: skip blank lines or comments */ ) { + g_strchomp (line); + fields = split_fields (line, delim); + i_field = 1; + for (p=fields; p != NULL; p=p->next) { + raw_field = + g_new0 (glMergeRawField, 1); + raw_field->loc = + g_strdup_printf ("%d", + i_field++); + raw_field->value = g_strdup (p->data); + list = g_list_append (list, raw_field); + } + free_fields (&fields); + break; + } + } + + } + return list; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Split out fields by delimiter while decoding things like "\n". */ +/*---------------------------------------------------------------------------*/ +static GList * split_fields ( gchar *line, + gchar delim ) +{ + GList *list = NULL; + GString *string; + gchar *c; + enum { NORMAL, ESCAPED } state; + + g_return_val_if_fail (line != NULL, NULL); + + state = NORMAL; + string = g_string_new( "" ); + for ( c=line; *c!=0; c++ ) { + + switch (state) { + + case NORMAL: + if ( *c == '\\' ) { + state = ESCAPED; + } else if ( *c != delim ) { + string = g_string_append_c (string, *c); + } else { + list = g_list_append (list, + g_strdup (string->str)); + string = g_string_assign( string, "" ); + } + break; + + case ESCAPED: + switch (*c) { + case 'n': + string = g_string_append_c (string, '\n'); + break; + case 't': + string = g_string_append_c (string, '\t'); + break; + default: + string = g_string_append_c (string, *c); + break; + } + state = NORMAL; + break; + + default: + g_assert_not_reached(); + break; + } + + } + list = g_list_append( list, g_strdup(string->str) ); + g_string_free( string, TRUE ); + + return list; +} + +/*---------------------------------------------------------------------------*/ +/* Free list of fields. */ +/*---------------------------------------------------------------------------*/ +void +free_fields (GList ** list) +{ + GList *p; + + for (p = *list; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*list); + *list = NULL; +} + diff --git a/glabels2/src/merge-text.h b/glabels2/src/merge-text.h new file mode 100644 index 0000000..b1dddef --- /dev/null +++ b/glabels2/src/merge-text.h @@ -0,0 +1,35 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_text.h: text-file merge backend module header file + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_TEXT_H__ +#define __MERGE_TEXT_H__ + +#include <gtk/gtk.h> + +#include "merge.h" + +extern glMergeInput *gl_merge_text_open (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_text_close (glMergeInput * input); +extern glMergeRecord *gl_merge_text_get_record (glMergeInput * input); +extern GList *gl_merge_text_get_raw_record (glMergeInput * input); + +#endif diff --git a/glabels2/src/merge-ui-text.c b/glabels2/src/merge-ui-text.c new file mode 100644 index 0000000..ba280a3 --- /dev/null +++ b/glabels2/src/merge-ui-text.c @@ -0,0 +1,448 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui_text.c: text-file document merge user interface backend module + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include "merge-ui-text.h" +#include "merge-text.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef struct { + gchar *loc; + GtkWidget *entry; +} EntryNode; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint merge_ui_text_src_signals[LAST_SIGNAL] = { 0 }; +static gint merge_ui_text_field_ws_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_merge_ui_text_src_class_init (glMergeUITextSrcClass * class); +static void gl_merge_ui_text_src_instance_init (glMergeUITextSrc * src); +static void gl_merge_ui_text_src_finalize (GObject * object); +static void gl_merge_ui_text_src_construct (glMergeUITextSrc * src, + glMergeType type); + +static void src_changed_cb (glMergeUITextSrc * src); + +static void gl_merge_ui_text_field_ws_class_init (glMergeUITextFieldWSClass * class); +static void gl_merge_ui_text_field_ws_instance_init (glMergeUITextFieldWS * field_ws); +static void gl_merge_ui_text_field_ws_finalize (GObject * object); +static void gl_merge_ui_text_field_ws_construct (glMergeUITextFieldWS * field_ws, + glMergeType type, + gchar * src); + +static void field_ws_changed_cb (glMergeUITextFieldWS * field_ws); + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_text_src_get_type (void) +{ + static guint merge_ui_text_src_type = 0; + + if (!merge_ui_text_src_type) { + GTypeInfo merge_ui_text_src_info = { + sizeof (glMergeUITextSrcClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_text_src_class_init, + NULL, + NULL, + sizeof (glMergeUITextSrc), + 0, + (GInstanceInitFunc) gl_merge_ui_text_src_instance_init, + }; + + merge_ui_text_src_type = + g_type_register_static (gtk_vbox_get_type (), + "glMergeUITextSrc", + &merge_ui_text_src_info, 0); + } + + return merge_ui_text_src_type; +} + +static void +gl_merge_ui_text_src_class_init (glMergeUITextSrcClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_merge_ui_text_src_finalize; + + merge_ui_text_src_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUITextSrcClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +gl_merge_ui_text_src_instance_init (glMergeUITextSrc * src) +{ + src->type = GL_MERGE_NONE; + src->entry = NULL; +} + +static void +gl_merge_ui_text_src_finalize (GObject * object) +{ + glMergeUITextSrc *src; + glMergeUITextSrcClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_TEXT_SRC (object)); + + src = GL_MERGE_UI_TEXT_SRC (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_merge_ui_text_src_new (glMergeType type) +{ + glMergeUITextSrc *src; + + src = g_object_new (gl_merge_ui_text_src_get_type (), NULL); + + gl_merge_ui_text_src_construct (src, type); + + return GTK_WIDGET (src); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_merge_ui_text_src_construct (glMergeUITextSrc * src, + glMergeType type) +{ + GtkWidget *wvbox, *wentry; + + wvbox = GTK_WIDGET (src); + + src->type = type; + + src->entry = + gnome_file_entry_new (NULL, _("Select merge-database source")); + gtk_box_pack_start (GTK_BOX (wvbox), src->entry, TRUE, TRUE, 0); + + wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (src->entry)); + g_signal_connect_swapped (G_OBJECT (wentry), "changed", + G_CALLBACK (src_changed_cb), + G_OBJECT (src)); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (glMergeUITextSrc * src) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (src), merge_ui_text_src_signals[CHANGED], 0); +} + +/*****************************************************************************/ +/* Set src name. */ +/*****************************************************************************/ +void +gl_merge_ui_text_src_set_value (glMergeUITextSrc * src, + gchar * text) +{ + GtkWidget *wentry; + + wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (src->entry)); + + gtk_entry_set_text (GTK_ENTRY (wentry), text); +} + +/*****************************************************************************/ +/* Get src name. */ +/*****************************************************************************/ +gchar * +gl_merge_ui_text_src_get_value (glMergeUITextSrc * src) +{ + return gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (src->entry), + TRUE); +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_text_field_ws_get_type (void) +{ + static guint merge_ui_text_field_ws_type = 0; + + if (!merge_ui_text_field_ws_type) { + GTypeInfo merge_ui_text_field_ws_info = { + sizeof (glMergeUITextFieldWSClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_text_field_ws_class_init, + NULL, + NULL, + sizeof (glMergeUITextFieldWS), + 0, + (GInstanceInitFunc) gl_merge_ui_text_field_ws_instance_init, + }; + + merge_ui_text_field_ws_type = + g_type_register_static (gtk_hbox_get_type (), + "glMergeUITextFieldWS", + &merge_ui_text_field_ws_info, 0); + } + + return merge_ui_text_field_ws_type; +} + +static void +gl_merge_ui_text_field_ws_class_init (glMergeUITextFieldWSClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_merge_ui_text_field_ws_finalize; + + merge_ui_text_field_ws_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUITextFieldWSClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +gl_merge_ui_text_field_ws_instance_init (glMergeUITextFieldWS * field_ws) +{ + field_ws->type = GL_MERGE_NONE; + field_ws->entry_list = NULL; +} + +static void +gl_merge_ui_text_field_ws_finalize (GObject * object) +{ + glMergeUITextFieldWS *field_ws; + glMergeUITextFieldWSClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_TEXT_FIELD_WS (object)); + + field_ws = GL_MERGE_UI_TEXT_FIELD_WS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_merge_ui_text_field_ws_new (glMergeType type, + gchar * src) +{ + glMergeUITextFieldWS *field_ws; + + field_ws = g_object_new (gl_merge_ui_text_field_ws_get_type (), NULL); + + gl_merge_ui_text_field_ws_construct (field_ws, type, src); + + return GTK_WIDGET (field_ws); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_merge_ui_text_field_ws_construct (glMergeUITextFieldWS * field_ws, + glMergeType type, + gchar * src) +{ + GtkWidget *whbox, *wtable, *wlabel, *whline, *wentry; + glMergeInput *mp; + glMergeRawField *sample_field; + GList *sample_field_list=NULL, *p; + gint n_fields, i; + EntryNode *entry_node; + + field_ws->type = type; + field_ws->entry_list = NULL; + + mp = gl_merge_open( type, NULL, src ); + sample_field_list = gl_merge_get_raw_record (mp); + gl_merge_close(mp); + n_fields = g_list_length( sample_field_list ); + + whbox = GTK_WIDGET (field_ws); + + wtable = gtk_table_new (n_fields + 2, 3, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 20); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 10); + gtk_box_pack_start (GTK_BOX (whbox), wtable, FALSE, FALSE, GNOME_PAD); + + wlabel = gtk_label_new (_("Column")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 1, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + wlabel = gtk_label_new (_("Custom field key")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 1, 2, 0, 1); + + wlabel = gtk_label_new (_("Sample data")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 2, 3, 0, 1); + + whline = gtk_hseparator_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), whline, 0, 1, 1, 2); + whline = gtk_hseparator_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), whline, 1, 2, 1, 2); + whline = gtk_hseparator_new (); + gtk_table_attach_defaults (GTK_TABLE (wtable), whline, 2, 3, 1, 2); + + for (p = sample_field_list, i = 0; p != NULL; p = p->next, i++) { + sample_field = p->data; + + wlabel = gtk_label_new (sample_field->loc); + gtk_misc_set_alignment (GTK_MISC (wlabel), 1, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, + 0, 1, i + 2, i + 3); + + wentry = gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (wentry), sample_field->loc); + gtk_widget_set_usize (wentry, 100, 0); + gtk_table_attach_defaults (GTK_TABLE (wtable), wentry, + 1, 2, i + 2, i + 3); + + g_signal_connect_swapped (G_OBJECT (wentry), "changed", + G_CALLBACK(field_ws_changed_cb), + G_OBJECT (field_ws)); + + wlabel = gtk_label_new (sample_field->value); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL(wlabel), GTK_JUSTIFY_LEFT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, + 2, 3, i + 2, i + 3); + + entry_node = g_new0 (EntryNode, 1); + entry_node->loc = g_strdup (sample_field->loc); + entry_node->entry = wentry; + field_ws->entry_list = + g_list_append (field_ws->entry_list, entry_node); + + } + + gl_merge_free_raw_record (&sample_field_list); + +} + +/*****************************************************************************/ +/* Set field definitions. (associate key with locator) */ +/*****************************************************************************/ +void +gl_merge_ui_text_field_ws_set_field_defs (glMergeUITextFieldWS * field_ws, + GList * field_defs) +{ + GList *p_entry, *p_defs; + EntryNode *entry; + glMergeFieldDefinition *def; + + for (p_entry = field_ws->entry_list; p_entry != NULL; + p_entry = p_entry->next) { + entry = (EntryNode *) p_entry->data; + + for (p_defs = field_defs; p_defs != NULL; p_defs = p_defs->next) { + def = (glMergeFieldDefinition *) p_defs->data; + + if (strcmp (entry->loc, def->loc) == 0) { + gtk_entry_set_text (GTK_ENTRY (entry->entry), + def->key); + } + } + } + +} + +/*****************************************************************************/ +/* Get field definitions. (associate key with locator) */ +/*****************************************************************************/ +GList * +gl_merge_ui_text_field_ws_get_field_defs (glMergeUITextFieldWS * field_ws) +{ + GList *p_entry, *defs_list = NULL; + EntryNode *entry; + glMergeFieldDefinition *def; + + for (p_entry = field_ws->entry_list; p_entry != NULL; + p_entry = p_entry->next) { + entry = (EntryNode *) p_entry->data; + + def = g_new0 (glMergeFieldDefinition, 1); + + def->loc = g_strdup (entry->loc); + def->key = + gtk_editable_get_chars (GTK_EDITABLE (entry->entry), 0, -1); + + defs_list = g_list_append (defs_list, def); + + } + + return defs_list; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +field_ws_changed_cb (glMergeUITextFieldWS * field_ws) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_text_field_ws_signals[CHANGED], 0); +} diff --git a/glabels2/src/merge-ui-text.h b/glabels2/src/merge-ui-text.h new file mode 100644 index 0000000..42006f2 --- /dev/null +++ b/glabels2/src/merge-ui-text.h @@ -0,0 +1,101 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui_text.h: text-file merge user interface backend header + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_UI_TEXT_H__ +#define __MERGE_UI_TEXT_H__ + +#include <gnome.h> + +#include "merge.h" + +/*======================================================*/ +/* Merge source selection widget */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_TEXT_SRC (gl_merge_ui_text_src_get_type ()) +#define GL_MERGE_UI_TEXT_SRC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_TEXT_SRC, glMergeUITextSrc )) +#define GL_MERGE_UI_TEXT_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_TEXT_SRC, glMergeUITextSrcClass)) +#define GL_IS_MERGE_UI_TEXT_SRC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_TEXT_SRC)) +#define GL_IS_MERGE_UI_TEXT_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_TEXT_SRC)) + +typedef struct _glMergeUITextSrc glMergeUITextSrc; +typedef struct _glMergeUITextSrcClass glMergeUITextSrcClass; + +struct _glMergeUITextSrc { + GtkVBox parent_widget; + + glMergeType type; + GtkWidget *entry; +}; + +struct _glMergeUITextSrcClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUITextSrc * src, gpointer user_data); +}; + +extern guint gl_merge_ui_text_src_get_type (void); +extern GtkWidget *gl_merge_ui_text_src_new (glMergeType type); +extern void gl_merge_ui_text_src_set_value (glMergeUITextSrc * src, + gchar * text); +extern gchar *gl_merge_ui_text_src_get_value (glMergeUITextSrc * src); + +/*======================================================*/ +/* Merge field selection/definition widget. */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_TEXT_FIELD_WS (gl_merge_ui_text_field_ws_get_type ()) +#define GL_MERGE_UI_TEXT_FIELD_WS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_TEXT_FIELD_WS, glMergeUITextFieldWS )) +#define GL_MERGE_UI_TEXT_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_TEXT_FIELD_WS, glMergeUITextFieldWSClass)) +#define GL_IS_MERGE_UI_TEXT_FIELD_WS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_TEXT_FIELD_WS)) +#define GL_IS_MERGE_UI_TEXT_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_TEXT_FIELD_WS)) + +typedef struct _glMergeUITextFieldWS glMergeUITextFieldWS; +typedef struct _glMergeUITextFieldWSClass glMergeUITextFieldWSClass; + +struct _glMergeUITextFieldWS { + GtkHBox parent_widget; + + glMergeType type; + GList *entry_list; +}; + +struct _glMergeUITextFieldWSClass { + GtkHBoxClass parent_class; + + void (*changed) (glMergeUITextFieldWS * field_ws, gpointer user_data); +}; + +extern guint gl_merge_ui_text_field_ws_get_type (void); +extern GtkWidget *gl_merge_ui_text_field_ws_new (glMergeType type, + gchar * src); +extern void gl_merge_ui_text_field_ws_set_field_defs (glMergeUITextFieldWS * field_ws, + GList * field_defs); +extern GList *gl_merge_ui_text_field_ws_get_field_defs (glMergeUITextFieldWS * + field_ws); + +#endif diff --git a/glabels2/src/merge-ui.c b/glabels2/src/merge-ui.c new file mode 100644 index 0000000..18a25b5 --- /dev/null +++ b/glabels2/src/merge-ui.c @@ -0,0 +1,557 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui.c: document merge user interface module + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include "merge-ui.h" +#include "marshal.h" + +/* Backends */ +#include "merge-ui-text.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef struct { + + GtkWidget * (*src_new) (glMergeType); + void (*src_set_value) (); + gchar * (*src_get_value) (); + + GtkWidget * (*field_ws_new) (glMergeType, gchar *); + void (*field_ws_set_field_defs) (); + GList * (*field_ws_get_field_defs) (); + +} BackendFunctions; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint merge_ui_src_signals[LAST_SIGNAL] = { 0 }; +static gint merge_ui_field_ws_signals[LAST_SIGNAL] = { 0 }; + +static BackendFunctions func[GL_MERGE_N_TYPES]; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_merge_ui_src_class_init (glMergeUISrcClass * class); +static void gl_merge_ui_src_instance_init (glMergeUISrc * src); +static void gl_merge_ui_src_finalize (GObject * object); + +static void src_changed_cb (glMergeUISrc * src); + +static void gl_merge_ui_field_ws_class_init (glMergeUIFieldWSClass * class); +static void gl_merge_ui_field_ws_instance_init (glMergeUIFieldWS * field_ws); +static void gl_merge_ui_field_ws_finalize (GObject * object); + +static void field_ws_changed_cb (glMergeUIFieldWS * field_ws); + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_merge_ui_init (void) +{ + gint i; + + gl_debug (DEBUG_MERGE, "START"); + + /* Register backend functions. */ + + i = GL_MERGE_NONE; + func[i].src_new = NULL; + func[i].src_set_value = NULL; + func[i].src_get_value = NULL; + func[i].field_ws_new = NULL; + func[i].field_ws_set_field_defs = NULL; + func[i].field_ws_get_field_defs = NULL; + + i = GL_MERGE_TEXT_TAB; + func[i].src_new = gl_merge_ui_text_src_new; + func[i].src_set_value = gl_merge_ui_text_src_set_value; + func[i].src_get_value = gl_merge_ui_text_src_get_value; + func[i].field_ws_new = gl_merge_ui_text_field_ws_new; + func[i].field_ws_set_field_defs = + gl_merge_ui_text_field_ws_set_field_defs; + func[i].field_ws_get_field_defs = + gl_merge_ui_text_field_ws_get_field_defs; + + i = GL_MERGE_TEXT_COMMA; + func[i].src_new = gl_merge_ui_text_src_new; + func[i].src_set_value = gl_merge_ui_text_src_set_value; + func[i].src_get_value = gl_merge_ui_text_src_get_value; + func[i].field_ws_new = gl_merge_ui_text_field_ws_new; + func[i].field_ws_set_field_defs = + gl_merge_ui_text_field_ws_set_field_defs; + func[i].field_ws_get_field_defs = + gl_merge_ui_text_field_ws_get_field_defs; + + i = GL_MERGE_TEXT_COLON; + func[i].src_new = gl_merge_ui_text_src_new; + func[i].src_set_value = gl_merge_ui_text_src_set_value; + func[i].src_get_value = gl_merge_ui_text_src_get_value; + func[i].field_ws_new = gl_merge_ui_text_field_ws_new; + func[i].field_ws_set_field_defs = + gl_merge_ui_text_field_ws_set_field_defs; + func[i].field_ws_get_field_defs = + gl_merge_ui_text_field_ws_get_field_defs; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_src_get_type (void) +{ + static guint merge_ui_src_type = 0; + + if (!merge_ui_src_type) { + GTypeInfo merge_ui_src_info = { + sizeof (glMergeUISrcClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_src_class_init, + NULL, + NULL, + sizeof (glMergeUISrc), + 0, + (GInstanceInitFunc) gl_merge_ui_src_instance_init, + }; + + merge_ui_src_type = + g_type_register_static (gtk_vbox_get_type (), + "glMergeUISrc", + &merge_ui_src_info, 0); + } + + return merge_ui_src_type; +} + +static void +gl_merge_ui_src_class_init (glMergeUISrcClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MERGE, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_merge_ui_src_finalize; + + merge_ui_src_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUISrcClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_src_instance_init (glMergeUISrc * src) +{ + gl_debug (DEBUG_MERGE, "START"); + src->backend_widget = NULL; + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_src_finalize (GObject * object) +{ + glMergeUISrc *src; + + gl_debug (DEBUG_MERGE, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_SRC (object)); + + src = GL_MERGE_UI_SRC (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MERGE, "END"); +} + +GtkWidget * +gl_merge_ui_src_new (void) +{ + glMergeUISrc *src; + + gl_debug (DEBUG_MERGE, "START"); + + src = g_object_new (gl_merge_ui_src_get_type (), NULL); + + src->type = GL_MERGE_NONE; + src->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (src->backend_widget), 0, 0.5); + gtk_box_pack_start (GTK_BOX (src), src->backend_widget, FALSE, FALSE, + 0); + + gl_debug (DEBUG_MERGE, "END"); + + return GTK_WIDGET (src); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (glMergeUISrc * src) +{ + gl_debug (DEBUG_MERGE, "START"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (src), merge_ui_src_signals[CHANGED], 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Set type. */ +/*****************************************************************************/ +void +gl_merge_ui_src_set_type (glMergeUISrc * src, + glMergeType type) +{ + gl_debug (DEBUG_MERGE, "START"); + + if (type != src->type) { + + gtk_widget_destroy (src->backend_widget); + + src->type = type; + + if (type != GL_MERGE_NONE) { + src->backend_widget = (func[type].src_new) (type); + } else { + src->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (src->backend_widget), + 0, 0.5); + } + + gtk_box_pack_start (GTK_BOX (src), src->backend_widget, + FALSE, FALSE, 0); + + if (GTK_WIDGET_VISIBLE (src)) { + gtk_widget_show_all (src->backend_widget); + } + + if (type != GL_MERGE_NONE) { + g_signal_connect_swapped (G_OBJECT(src->backend_widget), + "changed", + G_CALLBACK(src_changed_cb), + G_OBJECT (src)); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (src), + merge_ui_src_signals[CHANGED], 0); + } + + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Set src. */ +/*****************************************************************************/ +void +gl_merge_ui_src_set_value (glMergeUISrc * src, + gchar * text) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + type = src->type; + + if (type != GL_MERGE_NONE) { + func[type].src_set_value (src->backend_widget, text); + } else { + gl_debug (DEBUG_MERGE, "END"); + return; + } + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Get src name. */ +/*****************************************************************************/ +gchar * +gl_merge_ui_src_get_value (glMergeUISrc * src) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, ""); + + type = src->type; + + if (type != GL_MERGE_NONE) { + return func[type].src_get_value (src->backend_widget); + } else { + return NULL; + } + +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_field_ws_get_type (void) +{ + static guint merge_ui_field_ws_type = 0; + + gl_debug (DEBUG_MERGE, "START"); + + if (!merge_ui_field_ws_type) { + GTypeInfo merge_ui_field_ws_info = { + sizeof (glMergeUIFieldWSClass), + NULL, + NULL, + (GClassInitFunc) gl_merge_ui_field_ws_class_init, + NULL, + NULL, + sizeof (glMergeUIFieldWS), + 0, + (GInstanceInitFunc) gl_merge_ui_field_ws_instance_init, + }; + + merge_ui_field_ws_type = + g_type_register_static (gtk_vbox_get_type (), + "glMergeUIFieldWS", + &merge_ui_field_ws_info, 0); + } + + gl_debug (DEBUG_MERGE, "END"); + + return merge_ui_field_ws_type; +} + +static void +gl_merge_ui_field_ws_class_init (glMergeUIFieldWSClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MERGE, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_merge_ui_field_ws_finalize; + + merge_ui_field_ws_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glMergeUIFieldWSClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_field_ws_instance_init (glMergeUIFieldWS * field_ws) +{ + gl_debug (DEBUG_MERGE, "START"); + + field_ws->type = GL_MERGE_NONE; + field_ws->src = NULL; + field_ws->backend_widget = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +static void +gl_merge_ui_field_ws_finalize (GObject * object) +{ + glMergeUIFieldWS *field_ws; + glMergeUIFieldWSClass *class; + + gl_debug (DEBUG_MERGE, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_FIELD_WS (object)); + + field_ws = GL_MERGE_UI_FIELD_WS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MERGE, "END"); +} + +GtkWidget * +gl_merge_ui_field_ws_new (void) +{ + glMergeUIFieldWS *field_ws; + + gl_debug (DEBUG_MERGE, "START"); + + field_ws = g_object_new (gl_merge_ui_field_ws_get_type (), NULL); + + field_ws->type = GL_MERGE_NONE; + field_ws->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (field_ws->backend_widget), 0, 0.5); + gtk_box_pack_start (GTK_BOX (field_ws), field_ws->backend_widget, + FALSE, FALSE, 0); + + gl_debug (DEBUG_MERGE, "END"); + + return GTK_WIDGET (field_ws); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +field_ws_changed_cb (glMergeUIFieldWS * field_ws) +{ + gl_debug (DEBUG_MERGE, "START"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED], 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* set type and src data, create appropriate backend widget. */ +/*****************************************************************************/ +void +gl_merge_ui_field_ws_set_type_src (glMergeUIFieldWS * field_ws, + glMergeType type, + gchar * src) +{ + gl_debug (DEBUG_MERGE, "START"); + + if (field_ws->src != NULL) + g_free (field_ws->src); + if (field_ws->backend_widget != NULL) { + gtk_widget_destroy (field_ws->backend_widget); + } + + field_ws->type = type; + field_ws->src = g_strdup (src); + + if (type != GL_MERGE_NONE) { + field_ws->backend_widget = + (func[type].field_ws_new) (type, src); + } else { + field_ws->backend_widget = gtk_label_new (_("N/A")); + gtk_misc_set_alignment (GTK_MISC (field_ws->backend_widget), 0, + 0.5); + } + + gtk_box_pack_start (GTK_BOX (field_ws), field_ws->backend_widget, + FALSE, FALSE, 0); + + if (type != GL_MERGE_NONE) { + g_signal_connect_swapped (G_OBJECT(field_ws->backend_widget), + "changed", + G_CALLBACK(field_ws_changed_cb), + G_OBJECT (field_ws)); + } + + if (GTK_WIDGET_VISIBLE (field_ws)) { + gtk_widget_show_all (field_ws->backend_widget); + } + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED], 0); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Set field definitions (associate ids with raw fields). */ +/*****************************************************************************/ +void +gl_merge_ui_field_ws_set_field_defs (glMergeUIFieldWS * field_ws, + GList * field_defs) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + type = field_ws->type; + + if (type != GL_MERGE_NONE) { + + (func[type].field_ws_set_field_defs) (field_ws->backend_widget, + field_defs); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED], 0); + + } + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Get field definitions (associate ids with raw fields). */ +/*****************************************************************************/ +GList * +gl_merge_ui_field_ws_get_field_defs (glMergeUIFieldWS * field_ws) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, ""); + + type = field_ws->type; + + if (type != GL_MERGE_NONE) { + + return (func[type].field_ws_get_field_defs) (field_ws-> + backend_widget); + } else { + + return NULL; + + } + +} diff --git a/glabels2/src/merge-ui.h b/glabels2/src/merge-ui.h new file mode 100644 index 0000000..e5a7e71 --- /dev/null +++ b/glabels2/src/merge-ui.h @@ -0,0 +1,106 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui.h: document merge user interface module header file + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_UI_H__ +#define __MERGE_UI_H__ + +#include <gnome.h> + +#include "merge.h" + +extern void + gl_merge_ui_init (void); + +/*======================================================*/ +/* Merge source selection widget */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_SRC (gl_merge_ui_src_get_type ()) +#define GL_MERGE_UI_SRC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_SRC, glMergeUISrc )) +#define GL_MERGE_UI_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_SRC, glMergeUISrcClass)) +#define GL_IS_MERGE_UI_SRC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_SRC)) +#define GL_IS_MERGE_UI_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_SRC)) + +typedef struct _glMergeUISrc glMergeUISrc; +typedef struct _glMergeUISrcClass glMergeUISrcClass; + +struct _glMergeUISrc { + GtkVBox parent_widget; + + glMergeType type; + GtkWidget *backend_widget; +}; + +struct _glMergeUISrcClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUISrc * src, gpointer user_data); +}; + +extern guint gl_merge_ui_src_get_type (void); +extern GtkWidget *gl_merge_ui_src_new (void); +extern void gl_merge_ui_src_set_type (glMergeUISrc * src, glMergeType type); +extern void gl_merge_ui_src_set_value (glMergeUISrc * src, gchar * text); +extern gchar *gl_merge_ui_src_get_value (glMergeUISrc * src); + +/*======================================================*/ +/* Merge field selection/definition widget. */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_FIELD_WS (gl_merge_ui_field_ws_get_type ()) +#define GL_MERGE_UI_FIELD_WS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_FIELD_WS, glMergeUIFieldWS )) +#define GL_MERGE_UI_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_FIELD_WS, glMergeUIFieldWSClass)) +#define GL_IS_MERGE_UI_FIELD_WS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_FIELD_WS)) +#define GL_IS_MERGE_UI_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_FIELD_WS)) + +typedef struct _glMergeUIFieldWS glMergeUIFieldWS; +typedef struct _glMergeUIFieldWSClass glMergeUIFieldWSClass; + +struct _glMergeUIFieldWS { + GtkVBox parent_widget; + + glMergeType type; + gchar *src; + GtkWidget *backend_widget; +}; + +struct _glMergeUIFieldWSClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUIFieldWS * field_ws, gpointer user_data); +}; + +extern guint gl_merge_ui_field_ws_get_type (void); +extern GtkWidget *gl_merge_ui_field_ws_new (void); +extern void gl_merge_ui_field_ws_set_type_src (glMergeUIFieldWS * field_ws, + glMergeType type, + gchar * src); +extern void gl_merge_ui_field_ws_set_field_defs (glMergeUIFieldWS * field_ws, + GList * field_defs); +extern GList *gl_merge_ui_field_ws_get_field_defs (glMergeUIFieldWS * field_ws); + +#endif diff --git a/glabels2/src/merge.c b/glabels2/src/merge.c new file mode 100644 index 0000000..ed81332 --- /dev/null +++ b/glabels2/src/merge.c @@ -0,0 +1,605 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge.c: document merge module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> + +#include "merge.h" +#include "merge-text.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ +typedef struct { + gchar *short_text; + gchar *long_text; +} TypeTexts; + +typedef struct { + + glMergeInput * (*open) (glMergeType, GList *, gchar *); + void (*close) (glMergeInput *); + glMergeRecord * (*get_record) (glMergeInput *); + GList * (*get_raw_record) (glMergeInput *); + +} BackendFunctions; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static TypeTexts type_text[GL_MERGE_N_TYPES]; + +static BackendFunctions func[GL_MERGE_N_TYPES]; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_merge_init (void) +{ + gint i; + + gl_debug (DEBUG_MERGE, "START"); + + /* Register backend functions and data. */ + + i = GL_MERGE_NONE; + func[i].open = NULL; + func[i].close = NULL; + func[i].get_record = NULL; + func[i].get_raw_record = NULL; + type_text[i].short_text = "None"; + type_text[i].long_text = _("None"); + + i = GL_MERGE_TEXT_TAB; + func[i].open = gl_merge_text_open; + func[i].close = gl_merge_text_close; + func[i].get_record = gl_merge_text_get_record; + func[i].get_raw_record = gl_merge_text_get_raw_record; + type_text[i].short_text = "Text/Tab"; + type_text[i].long_text = _("Text with tab separators"); + + i = GL_MERGE_TEXT_COMMA; + func[i].open = gl_merge_text_open; + func[i].close = gl_merge_text_close; + func[i].get_record = gl_merge_text_get_record; + func[i].get_raw_record = gl_merge_text_get_raw_record; + type_text[i].short_text = "Text/Comma"; + type_text[i].long_text = _("Text with comma separators"); + + i = GL_MERGE_TEXT_COLON; + func[i].open = gl_merge_text_open; + func[i].close = gl_merge_text_close; + func[i].get_record = gl_merge_text_get_record; + func[i].get_raw_record = gl_merge_text_get_raw_record; + type_text[i].short_text = "Text/Colon"; + type_text[i].long_text = _("Text with colon separators"); + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Create new merge information structure. */ +/*****************************************************************************/ +glMerge *gl_merge_new (void) +{ + gl_debug (DEBUG_MERGE, ""); + + return g_new0 (glMerge, 1); +} + +/*****************************************************************************/ +/* Duplicate merge information structure. */ +/*****************************************************************************/ +glMerge *gl_merge_dup (glMerge *orig) +{ + glMerge *new; + + gl_debug (DEBUG_MERGE, "START"); + + new = gl_merge_new (); + + new->type = orig->type; + new->src = g_strdup (orig->src); + new->field_defs = gl_merge_dup_field_def_list (orig->field_defs); + + gl_debug (DEBUG_MERGE, "END"); + return new; +} + +/*****************************************************************************/ +/* Free existing merge information structure. */ +/*****************************************************************************/ +void gl_merge_free (glMerge **merge) +{ + gl_debug (DEBUG_MERGE, "START"); + + g_free ((*merge)->src); + (*merge)->src = NULL; + gl_merge_free_field_def_list (&(*merge)->field_defs); + + *merge = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Lookup type from short text. */ +/*****************************************************************************/ +glMergeType +gl_merge_text_to_type (gchar * text) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + if (g_strcasecmp (text, type_text[type].short_text) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return type; + } + } + + gl_debug (DEBUG_MERGE, "END"); + + return GL_MERGE_NONE; +} + +/*****************************************************************************/ +/* Lookup short text for given type. */ +/*****************************************************************************/ +gchar * +gl_merge_type_to_text (glMergeType type) +{ + gl_debug (DEBUG_MERGE, ""); + + return g_strdup (type_text[type].short_text); +} + +/*****************************************************************************/ +/* Lookup type from long descriptive text. */ +/*****************************************************************************/ +glMergeType +gl_merge_long_text_to_type (gchar * text) +{ + glMergeType type; + + gl_debug (DEBUG_MERGE, "START"); + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + if (g_strcasecmp (text, type_text[type].long_text) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return type; + } + } + + gl_debug (DEBUG_MERGE, "END"); + return GL_MERGE_NONE; +} + +/*****************************************************************************/ +/* Lookup longer, more descriptive text for given type. */ +/*****************************************************************************/ +gchar * +gl_merge_type_to_long_text (glMergeType type) +{ + gl_debug (DEBUG_MERGE, ""); + + return g_strdup (type_text[type].long_text); +} + +/*****************************************************************************/ +/* Retrieve a list of descriptive texts for all available types. */ +/*****************************************************************************/ +GList * +gl_merge_get_long_texts_list (void) +{ + glMergeType type; + GList *list = NULL; + + gl_debug (DEBUG_MERGE, "START"); + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + + list = g_list_append (list, gl_merge_type_to_long_text (type)); + + } + + gl_debug (DEBUG_MERGE, "END"); + return list; +} + +/*****************************************************************************/ +/* Free list of descriptive texts. */ +/*****************************************************************************/ +void +gl_merge_free_long_texts_list (GList ** list) +{ + GList *p; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *list; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*list); + *list = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Duplicate field definitions. */ +/*****************************************************************************/ +GList *gl_merge_dup_field_def_list (GList * orig) +{ + GList *new, *p_orig; + glMergeFieldDefinition *fd_new, *fd_orig; + + gl_debug (DEBUG_MERGE, "START"); + + new = NULL; + for (p_orig = orig; p_orig != NULL; p_orig = p_orig->next) { + fd_orig = (glMergeFieldDefinition *) p_orig->data; + fd_new = g_new0 (glMergeFieldDefinition, 1); + + fd_new->key = g_strdup (fd_orig->key); + fd_new->loc = g_strdup (fd_orig->loc); + + new = g_list_append (new, fd_new); + } + + gl_debug (DEBUG_MERGE, "END"); + return new; +} + +/*****************************************************************************/ +/* Free list of field definitions. */ +/*****************************************************************************/ +void +gl_merge_free_field_def_list (GList ** list) +{ + GList *p; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *list; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + g_free (field_def->key); + field_def->key = NULL; + g_free (field_def->loc); + field_def->loc = NULL; + + g_free (p->data); + p->data = NULL; + } + + g_list_free (*list); + *list = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Extract a list of valid keys from field definitions list */ +/*****************************************************************************/ +GList * +gl_merge_get_key_list (GList * field_defs) +{ + GList *p, *keys; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_MERGE, "START"); + + keys = NULL; + for (p = field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + keys = g_list_append (keys, g_strdup (field_def->key)); + } + + gl_debug (DEBUG_MERGE, "END"); + + return keys; +} + +/*****************************************************************************/ +/* Free a list of keys. */ +/*****************************************************************************/ +void +gl_merge_free_key_list (GList ** keys) +{ + GList *p; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *keys; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*keys); + *keys = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Lookup key for given locator. */ +/*****************************************************************************/ +gchar * +gl_merge_find_key (GList * field_defs, + gchar * loc) +{ + GList *p; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + if (strcmp (loc, field_def->loc) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return g_strdup (field_def->key); + } + + } + + gl_debug (DEBUG_MERGE, "END"); + + return NULL; +} + +/*****************************************************************************/ +/* Open merge source front-end. */ +/*****************************************************************************/ +glMergeInput * +gl_merge_open (glMergeType type, + GList * field_defs, + gchar * src) +{ + gl_debug (DEBUG_MERGE, ""); + + return func[type].open (type, field_defs, src); +} + +/*****************************************************************************/ +/* Close merge source front-end. */ +/*****************************************************************************/ +void +gl_merge_close (glMergeInput * input) +{ + gl_debug (DEBUG_MERGE, "START"); + + if ( input != NULL ) { + func[input->type].close (input); + } + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Get next record from merge source, NULL if exhausted (front-end). */ +/*****************************************************************************/ +glMergeRecord * +gl_merge_get_record (glMergeInput * input) +{ + gl_debug (DEBUG_MERGE, ""); + + if ( input == NULL ) { + return NULL; + } + return func[input->type].get_record (input); +} + +/*****************************************************************************/ +/* Get next record (raw) from merge source, NULL if exhausted (front-end). */ +/*****************************************************************************/ +GList * +gl_merge_get_raw_record (glMergeInput * input) +{ + gl_debug (DEBUG_MERGE, ""); + + if ( input == NULL ) { + return NULL; + } + return func[input->type].get_raw_record (input); +} + +/*****************************************************************************/ +/* Free a merge record (list of fields) */ +/*****************************************************************************/ +void +gl_merge_free_record (glMergeRecord ** record) +{ + GList *p; + glMergeField *field; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = (*record)->field_list; p != NULL; p = p->next) { + field = (glMergeField *) p->data; + + g_free (field->key); + field->key = NULL; + g_free (field->value); + field->value = NULL; + + g_free (p->data); + p->data = NULL; + + } + g_list_free ((*record)->field_list); + (*record)->field_list = NULL; + + g_free (*record); + *record = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Free a merge record (list of fields) */ +/*****************************************************************************/ +void +gl_merge_free_raw_record (GList ** record) +{ + GList *p; + glMergeRawField *field; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *record; p != NULL; p = p->next) { + field = (glMergeRawField *) p->data; + + g_free (field->loc); + field->loc = NULL; + g_free (field->value); + field->value = NULL; + + g_free (p->data); + p->data = NULL; + + } + + g_list_free (*record); + *record = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Find key in given record and evaluate. */ +/*****************************************************************************/ +extern gchar * +gl_merge_eval_key (gchar * key, + glMergeRecord * record) +{ + GList *p; + glMergeField *field; + + gl_debug (DEBUG_MERGE, "START"); + + if ( record != NULL ) { + for (p = record->field_list; p != NULL; p = p->next) { + field = (glMergeField *) p->data; + + if (strcmp (key, field->key) == 0) { + gl_debug (DEBUG_MERGE, "END"); + return g_strdup (field->value); + } + + } + } + + gl_debug (DEBUG_MERGE, "END"); + + return NULL; +} + +/*****************************************************************************/ +/* Read all records from merge source. */ +/*****************************************************************************/ +GList * +gl_merge_read_data(glMergeType type, + GList *field_defs, + gchar *src) +{ + glMergeInput *mp; + glMergeRecord *record; + GList *record_list = NULL; + + gl_debug (DEBUG_MERGE, "START"); + + mp = gl_merge_open (type, field_defs, src); + while ( (record = gl_merge_get_record (mp)) != NULL ) { + record_list = g_list_append( record_list, record ); + } + gl_merge_close(mp); + + gl_debug (DEBUG_MERGE, "END"); + + return record_list; +} + +/*****************************************************************************/ +/* Free a list of records. */ +/*****************************************************************************/ +void +gl_merge_free_data (GList ** record_list) +{ + GList *p; + glMergeRecord *record; + + gl_debug (DEBUG_MERGE, "START"); + + for (p = *record_list; p != NULL; p = p->next) { + record = (glMergeRecord *) p->data; + + gl_merge_free_record( &record ); + + } + + g_list_free (*record_list); + *record_list = NULL; + + gl_debug (DEBUG_MERGE, "END"); +} + +/*****************************************************************************/ +/* Count selected records. */ +/*****************************************************************************/ +gint +gl_merge_count_records (GList *record_list) +{ + GList *p; + glMergeRecord *record; + gint count; + + gl_debug (DEBUG_MERGE, "START"); + + count = 0; + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) count ++; + } + + gl_debug (DEBUG_MERGE, "END"); + + return count; +} + diff --git a/glabels2/src/merge.h b/glabels2/src/merge.h new file mode 100644 index 0000000..3c8497b --- /dev/null +++ b/glabels2/src/merge.h @@ -0,0 +1,105 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge.h: document merge module header file + * + * Copyright (C) 2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_H__ +#define __MERGE_H__ + +#include <glib.h> + +typedef enum { + + GL_MERGE_NONE, + GL_MERGE_TEXT_TAB, + GL_MERGE_TEXT_COMMA, + GL_MERGE_TEXT_COLON, + + GL_MERGE_N_TYPES +} glMergeType; + +typedef struct { + glMergeType type; + gchar *src; + GList *field_defs; +} glMerge; + +typedef struct { + gchar *key; + gchar *loc; +} glMergeFieldDefinition; + +typedef struct { + gchar *loc; + gchar *value; +} glMergeRawField; + +typedef struct { + gchar *key; + gchar *value; +} glMergeField; + +typedef struct { + gboolean select_flag; + GList *field_list; /* List of glMergeFields */ +} glMergeRecord; + +typedef struct { + glMergeType type; + GList *field_defs; + gpointer handle; +} glMergeInput; + +extern void + gl_merge_init (void); + +extern glMerge *gl_merge_new (void); +extern glMerge *gl_merge_dup (glMerge *orig); +extern void gl_merge_free (glMerge **merge); + +extern glMergeType gl_merge_text_to_type (gchar * text); +extern gchar *gl_merge_type_to_text (glMergeType type); +extern glMergeType gl_merge_long_text_to_type (gchar * text); +extern gchar *gl_merge_type_to_long_text (glMergeType type); +extern GList *gl_merge_get_long_texts_list (void); +extern void gl_merge_free_long_texts_list (GList ** list); + +extern GList *gl_merge_dup_field_def_list (GList * field_defs); +extern void gl_merge_free_field_def_list (GList ** field_defs); + +extern GList *gl_merge_get_key_list (GList * field_defs); +extern void gl_merge_free_key_list (GList ** keys); + +extern gchar *gl_merge_find_key (GList * field_defs, gchar * loc); + +extern glMergeInput *gl_merge_open (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_close (glMergeInput * input); +extern glMergeRecord *gl_merge_get_record (glMergeInput * input); +extern GList *gl_merge_get_raw_record (glMergeInput * input); +extern void gl_merge_free_record (glMergeRecord ** record); +extern void gl_merge_free_raw_record (GList ** record); +extern gchar *gl_merge_eval_key (gchar * key, glMergeRecord * record); + +extern GList *gl_merge_read_data (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_free_data (GList **record_list); +extern gint gl_merge_count_records (GList *record_list); + +#endif diff --git a/glabels2/src/pixmaps/Makefile.am b/glabels2/src/pixmaps/Makefile.am new file mode 100644 index 0000000..5b19286 --- /dev/null +++ b/glabels2/src/pixmaps/Makefile.am @@ -0,0 +1,18 @@ + +EXTRA_DIST = \ + collate.xpm \ + nocollate.xpm \ + checkerboard.xpm \ + cursor_text.xbm \ + cursor_text_mask.xbm \ + cursor_box.xbm \ + cursor_box_mask.xbm \ + cursor_line.xbm \ + cursor_line_mask.xbm \ + cursor_ellipse.xbm \ + cursor_ellipse_mask.xbm \ + cursor_image.xbm \ + cursor_image_mask.xbm \ + cursor_barcode.xbm \ + cursor_barcode_mask.xbm + diff --git a/glabels2/src/pixmaps/Makefile.in b/glabels2/src/pixmaps/Makefile.in new file mode 100644 index 0000000..2685092 --- /dev/null +++ b/glabels2/src/pixmaps/Makefile.in @@ -0,0 +1,191 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +EXTRA_DIST = collate.xpm nocollate.xpm checkerboard.xpm cursor_text.xbm cursor_text_mask.xbm cursor_box.xbm cursor_box_mask.xbm cursor_line.xbm cursor_line_mask.xbm cursor_ellipse.xbm cursor_ellipse_mask.xbm cursor_image.xbm cursor_image_mask.xbm cursor_barcode.xbm cursor_barcode_mask.xbm + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/pixmaps/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/pixmaps + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/src/pixmaps/checkerboard.xpm b/glabels2/src/pixmaps/checkerboard.xpm new file mode 100644 index 0000000..33ab7b5 --- /dev/null +++ b/glabels2/src/pixmaps/checkerboard.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * checkerboard_xpm[] = { +"24 24 2 1", +" c #CCCCCC", +". c #000000", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. .."}; diff --git a/glabels2/src/pixmaps/collate.xpm b/glabels2/src/pixmaps/collate.xpm new file mode 100644 index 0000000..a781151 --- /dev/null +++ b/glabels2/src/pixmaps/collate.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char *collate_xpm[]={ +"58 28 3 1", +". c None", +"# c #000000", +"a c #ffffff", +"..........................................................", +".###################..###################.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaa##aaaaaaaa#.................", +".#aaaaaaa##aaaaaaaa#..#aaaaaa#aa#aaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaaa#aaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaa#aaaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaa#aaaaaaaaaa#.................", +".#aaaaaaa###aaaaaaa#..#aaaaaa####aaaaaaa#.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".###################..###################.................", +"..........................................................", +"..........................................................", +"..........................................................", +".................###################..###################.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaaa##aaaaaaaa#.", +".................#aaaaaaa##aaaaaaaa#..#aaaaaa#aa#aaaaaaa#.", +"....##..##..##...#aaaaaaaa#aaaaaaaa#..#aaaaaaaaa#aaaaaaa#.", +"....##..##..##...#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaaa#aaaaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaa#aaaaaaaaaa#.", +".................#aaaaaaa###aaaaaaa#..#aaaaaa####aaaaaaa#.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................###################..###################.", +"..........................................................", +".........................................................."}; diff --git a/glabels2/src/pixmaps/cursor_barcode.xbm b/glabels2/src/pixmaps/cursor_barcode.xbm new file mode 100644 index 0000000..6e8d1d6 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_barcode.xbm @@ -0,0 +1,16 @@ +#define cursor_barcode_width 32 +#define cursor_barcode_height 32 +#define cursor_barcode_x_hot 7 +#define cursor_barcode_y_hot 7 +static unsigned char cursor_barcode_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, 0x00, 0xa0, 0xad, 0x5a, + 0x00, 0xa0, 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_barcode_mask.xbm b/glabels2/src/pixmaps/cursor_barcode_mask.xbm new file mode 100644 index 0000000..52ed3ba --- /dev/null +++ b/glabels2/src/pixmaps/cursor_barcode_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_barcode_mask_width 32 +#define cursor_barcode_mask_height 32 +#define cursor_barcode_mask_x_hot 7 +#define cursor_barcode_mask_y_hot 7 +static unsigned char cursor_barcode_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0xf1, 0xff, 0xff, 0xc0, 0xf1, 0xff, 0xff, 0xc0, 0xf1, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, + 0x00, 0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_box.xbm b/glabels2/src/pixmaps/cursor_box.xbm new file mode 100644 index 0000000..48ae4ea --- /dev/null +++ b/glabels2/src/pixmaps/cursor_box.xbm @@ -0,0 +1,16 @@ +#define cursor_box_width 32 +#define cursor_box_height 32 +#define cursor_box_x_hot 7 +#define cursor_box_y_hot 7 +static unsigned char cursor_box_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, + 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0x01, 0x60, 0x00, 0x80, 0xff, 0x7f, + 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_box_mask.xbm b/glabels2/src/pixmaps/cursor_box_mask.xbm new file mode 100644 index 0000000..b41e055 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_box_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_box_mask_width 32 +#define cursor_box_mask_height 32 +#define cursor_box_mask_x_hot 7 +#define cursor_box_mask_y_hot 7 +static unsigned char cursor_box_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0xc1, 0xff, 0xff, + 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0x03, 0xf0, + 0x00, 0xc0, 0x03, 0xf0, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, + 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff}; diff --git a/glabels2/src/pixmaps/cursor_ellipse.xbm b/glabels2/src/pixmaps/cursor_ellipse.xbm new file mode 100644 index 0000000..946af9a --- /dev/null +++ b/glabels2/src/pixmaps/cursor_ellipse.xbm @@ -0,0 +1,16 @@ +#define cursor_ellipse_width 32 +#define cursor_ellipse_height 32 +#define cursor_ellipse_x_hot 7 +#define cursor_ellipse_y_hot 7 +static unsigned char cursor_ellipse_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x7c, 0x00, 0x80, 0x00, 0xef, 0x01, 0x00, 0x80, 0x01, 0x03, + 0x00, 0xc0, 0x00, 0x06, 0x00, 0x60, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x08, + 0x00, 0x30, 0x00, 0x18, 0x00, 0x30, 0x00, 0x18, 0x00, 0x10, 0x00, 0x10, + 0x00, 0x30, 0x00, 0x18, 0x00, 0x30, 0x00, 0x18, 0x00, 0x20, 0x00, 0x08, + 0x00, 0x60, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x06, 0x00, 0x80, 0x01, 0x03, + 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_ellipse_mask.xbm b/glabels2/src/pixmaps/cursor_ellipse_mask.xbm new file mode 100644 index 0000000..22fb544 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_ellipse_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_ellipse_mask_width 32 +#define cursor_ellipse_mask_height 32 +#define cursor_ellipse_mask_x_hot 7 +#define cursor_ellipse_mask_y_hot 7 +static unsigned char cursor_ellipse_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0xfe, 0x00, + 0xc0, 0x81, 0xff, 0x03, 0xc0, 0xc1, 0xff, 0x07, 0xc0, 0xe1, 0xff, 0x0f, + 0x00, 0xf0, 0x83, 0x1f, 0x00, 0xf0, 0x01, 0x1f, 0x00, 0xf8, 0x00, 0x3e, + 0x00, 0x78, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x3c, + 0x00, 0x78, 0x00, 0x3c, 0x00, 0x78, 0x00, 0x3c, 0x00, 0xf8, 0x00, 0x3e, + 0x00, 0xf0, 0x01, 0x1f, 0x00, 0xf0, 0x83, 0x1f, 0x00, 0xe0, 0xff, 0x0f, + 0x00, 0xc0, 0xff, 0x07, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_image.xbm b/glabels2/src/pixmaps/cursor_image.xbm new file mode 100644 index 0000000..3230836 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_image.xbm @@ -0,0 +1,16 @@ +#define cursor_image_width 32 +#define cursor_image_height 32 +#define cursor_image_x_hot 7 +#define cursor_image_y_hot 7 +static unsigned char cursor_image_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0xf0, 0xff, 0x7f, 0x80, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, + 0x00, 0x10, 0x00, 0x4c, 0x00, 0x10, 0x00, 0x52, 0x00, 0x10, 0x08, 0x4c, + 0x00, 0x10, 0x14, 0x40, 0x00, 0x10, 0x22, 0x40, 0x00, 0x10, 0x41, 0x40, + 0x00, 0x90, 0xc1, 0x40, 0x00, 0x10, 0x41, 0x40, 0x00, 0xf0, 0xc1, 0x7f, + 0x00, 0x10, 0x41, 0x40, 0x00, 0x10, 0x41, 0x40, 0x00, 0x10, 0x41, 0x40, + 0x00, 0x10, 0x7f, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, + 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_image_mask.xbm b/glabels2/src/pixmaps/cursor_image_mask.xbm new file mode 100644 index 0000000..9c79e82 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_image_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_image_mask_width 32 +#define cursor_image_mask_height 32 +#define cursor_image_mask_x_hot 7 +#define cursor_image_mask_y_hot 7 +static unsigned char cursor_image_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0xf9, 0xff, 0xff, + 0xc0, 0xf9, 0xff, 0xff, 0xc0, 0xf9, 0xff, 0xff, 0xc0, 0xf9, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, + 0x00, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff}; diff --git a/glabels2/src/pixmaps/cursor_line.xbm b/glabels2/src/pixmaps/cursor_line.xbm new file mode 100644 index 0000000..f5e2636 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_line.xbm @@ -0,0 +1,16 @@ +#define cursor_line_width 32 +#define cursor_line_height 32 +#define cursor_line_x_hot 7 +#define cursor_line_y_hot 7 +static unsigned char cursor_line_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, + 0x80, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_line_mask.xbm b/glabels2/src/pixmaps/cursor_line_mask.xbm new file mode 100644 index 0000000..a9359d5 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_line_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_line_mask_width 32 +#define cursor_line_mask_height 32 +#define cursor_line_mask_x_hot 7 +#define cursor_line_mask_y_hot 7 +static unsigned char cursor_line_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x08, 0xc0, 0x01, 0x00, 0x1c, + 0xc0, 0x01, 0x00, 0x1e, 0xc0, 0x01, 0x00, 0x0f, 0xc0, 0x01, 0x80, 0x07, + 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x00, + 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_text.xbm b/glabels2/src/pixmaps/cursor_text.xbm new file mode 100644 index 0000000..4378c1a --- /dev/null +++ b/glabels2/src/pixmaps/cursor_text.xbm @@ -0,0 +1,16 @@ +#define cursor_text_width 32 +#define cursor_text_height 32 +#define cursor_text_x_hot 7 +#define cursor_text_y_hot 7 +static unsigned char cursor_text_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, + 0x00, 0xc0, 0x9c, 0x01, 0x00, 0x40, 0x1c, 0x01, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/cursor_text_mask.xbm b/glabels2/src/pixmaps/cursor_text_mask.xbm new file mode 100644 index 0000000..543c2b7 --- /dev/null +++ b/glabels2/src/pixmaps/cursor_text_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_text_mask_width 32 +#define cursor_text_mask_height 32 +#define cursor_text_mask_x_hot 7 +#define cursor_text_mask_y_hot 7 +static unsigned char cursor_text_mask_bits[] = { + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, + 0xc0, 0x01, 0x00, 0x00, 0xc0, 0xe1, 0xff, 0x03, 0xc0, 0xe1, 0xff, 0x03, + 0x00, 0xe0, 0xff, 0x03, 0x00, 0xe0, 0xbe, 0x03, 0x00, 0x60, 0x3e, 0x03, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels2/src/pixmaps/nocollate.xpm b/glabels2/src/pixmaps/nocollate.xpm new file mode 100644 index 0000000..a67cc13 --- /dev/null +++ b/glabels2/src/pixmaps/nocollate.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char *nocollate_xpm[]={ +"58 28 3 1", +". c None", +"# c #000000", +"a c #ffffff", +"..........................................................", +".###################..###################.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.................", +".#aaaaaaa##aaaaaaaa#..#aaaaaaa##aaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#..##..##..##.....", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.................", +".#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.................", +".#aaaaaaa###aaaaaaa#..#aaaaaaa###aaaaaaa#.................", +".#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.................", +".###################..###################.................", +"..........................................................", +"..........................................................", +"..........................................................", +".................###################..###################.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................#aaaaaaaa##aaaaaaa#..#aaaaaaaa##aaaaaaa#.", +".................#aaaaaaa#aa#aaaaaa#..#aaaaaaa#aa#aaaaaa#.", +"....##..##..##...#aaaaaaaaaa#aaaaaa#..#aaaaaaaaaa#aaaaaa#.", +"....##..##..##...#aaaaaaaaa#aaaaaaa#..#aaaaaaaaa#aaaaaaa#.", +".................#aaaaaaaa#aaaaaaaa#..#aaaaaaaa#aaaaaaaa#.", +".................#aaaaaaa#aaaaaaaaa#..#aaaaaaa#aaaaaaaaa#.", +".................#aaaaaaa####aaaaaa#..#aaaaaaa####aaaaaa#.", +".................#aaaaaaaaaaaaaaaaa#..#aaaaaaaaaaaaaaaaa#.", +".................###################..###################.", +"..........................................................", +".........................................................."}; diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c new file mode 100644 index 0000000..7d09221 --- /dev/null +++ b/glabels2/src/prefs-dialog.c @@ -0,0 +1,568 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs-dialog.c: Preferences dialog module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include <libgnome/libgnome.h> +#include <libgnomeui/libgnomeui.h> + +#include "bonobo-mdi.h" +#include "prefs-dialog.h" +#include "prefs.h" +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-text-props.h" +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define US_LETTER "US Letter" +#define A4 "A4" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glPrefsDialogPrivate +{ + GtkWidget* categories_tree; + + GtkWidget* notebook; + + GtkTreeModel *categories_tree_model; + + /* Units page */ + GtkWidget *units_points_radio; + GtkWidget *units_inches_radio; + GtkWidget *units_mm_radio; + + /* Page size page */ + GtkWidget *page_size_us_letter_radio; + GtkWidget *page_size_a4_radio; + + /* Default text properties */ + GtkWidget *text; + + /* Default line properties */ + GtkWidget *line; + + /* Default fill properties */ + GtkWidget *fill; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GtkDialogClass* parent_class = NULL; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_prefs_dialog_class_init (glPrefsDialogClass *klass); +static void gl_prefs_dialog_init (glPrefsDialog *dlg); +static void gl_prefs_dialog_finalize (GObject *object); +static void gl_prefs_dialog_construct (glPrefsDialog *dlg); + +static void response_cb (glPrefsDialog *dialog, + gint response, + gpointer user_data); + +static GtkWidget *locale_page (glPrefsDialog *dlg); +static GtkWidget *object_page (glPrefsDialog *dlg); + +static update_locale_page_from_prefs (glPrefsDialog *dlg); +static update_object_page_from_prefs (glPrefsDialog *dlg); + +static update_prefs_from_locale_page (glPrefsDialog *dlg); +static update_prefs_from_object_page (glPrefsDialog *dlg); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_prefs_dialog_get_type (void) +{ + static GType dialog_type = 0; + + if (!dialog_type) + { + static const GTypeInfo dialog_info = + { + sizeof (glPrefsDialogClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gl_prefs_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (glPrefsDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gl_prefs_dialog_init + }; + + dialog_type = g_type_register_static (GTK_TYPE_DIALOG, + "glPrefsDialog", + &dialog_info, + 0); + } + + return dialog_type; +} + +static void +gl_prefs_dialog_class_init (glPrefsDialogClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + gl_debug (DEBUG_PREFS, ""); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_prefs_dialog_finalize; +} + +static void +gl_prefs_dialog_init (glPrefsDialog *dlg) +{ + gl_debug (DEBUG_PREFS, ""); + + dlg->private = g_new0 (glPrefsDialogPrivate, 1); +} + +static void +gl_prefs_dialog_finalize (GObject *object) +{ + glPrefsDialog* dlg; + + gl_debug (DEBUG_PREFS, ""); + + g_return_if_fail (object != NULL); + + dlg = GL_PREFS_DIALOG (object); + + g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); + g_return_if_fail (dlg->private != NULL); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + g_free (dlg->private); +} + +/*****************************************************************************/ +/* NEW preferences dialog. */ +/*****************************************************************************/ +GtkWidget* +gl_prefs_dialog_new (GtkWindow *parent) +{ + GtkWidget *dlg; + + gl_debug (DEBUG_PREFS, ""); + + dlg = GTK_WIDGET (g_object_new (GL_TYPE_PREFS_DIALOG, NULL)); + + if (parent) + gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); + + gl_prefs_dialog_construct (GL_PREFS_DIALOG(dlg)); + + return dlg; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_prefs_dialog_construct (glPrefsDialog *dlg) +{ + GtkWidget *notebook, *wlabel, *wvbox, *wvbox1, *whbox, *wframe; + GSList *radio_group = NULL; + + g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); + g_return_if_fail (dlg->private != NULL); + + gtk_dialog_add_button (GTK_DIALOG(dlg), + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + + gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CLOSE); + + g_signal_connect(G_OBJECT (dlg), "response", + G_CALLBACK (response_cb), NULL); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dlg)->vbox), + notebook, TRUE, TRUE, 0); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), + locale_page (dlg), + gtk_label_new (_("Locale"))); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), + object_page (dlg), + gtk_label_new (_("Object defaults"))); + + update_locale_page_from_prefs (dlg); + update_object_page_from_prefs (dlg); + + gtk_widget_show_all (GTK_DIALOG (dlg)->vbox); + + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + gtk_window_set_title (GTK_WINDOW (dlg), _("Preferences")); + gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (glPrefsDialog *dlg, + gint response, + gpointer user_data) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dlg != NULL); + g_return_if_fail(GTK_IS_DIALOG(dlg)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dlg)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Build Locale Properties Notebook Tab */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +locale_page (glPrefsDialog *dlg) +{ + GtkWidget *wlabel, *wvbox, *whbox, *wvbox1, *wframe; + GSList *radio_group = NULL; + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + + wlabel = gtk_label_new (_("Select locale specific behavior.")); + gtk_box_pack_start (GTK_BOX (wvbox), wlabel, FALSE, FALSE, 0); + + whbox = gtk_hbox_new (TRUE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, FALSE, FALSE, 0); + + /* ----- Display Units Frame ------------------------------------ */ + wframe = gtk_frame_new (_("Display units")); + gtk_box_pack_start (GTK_BOX (whbox), wframe, FALSE, TRUE, 0); + + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox1), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox1); + + radio_group = NULL; + + dlg->private->units_points_radio = + gtk_radio_button_new_with_label (radio_group, _("Points")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_points_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->units_points_radio, + FALSE, FALSE, 0); + + dlg->private->units_inches_radio = + gtk_radio_button_new_with_label (radio_group, _("Inches")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_inches_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->units_inches_radio, + FALSE, FALSE, 0); + + dlg->private->units_mm_radio = + gtk_radio_button_new_with_label (radio_group, _("Millimeters")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_mm_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->units_mm_radio, + FALSE, FALSE, 0); + + /* ----- Page Size Frame ------------------------------------ */ + wframe = gtk_frame_new (_("Default page size")); + gtk_box_pack_start (GTK_BOX (whbox), wframe, FALSE, TRUE, 0); + + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox1), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox1); + + radio_group = NULL; + + dlg->private->page_size_us_letter_radio = + gtk_radio_button_new_with_label (radio_group, US_LETTER); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON + (dlg->private->page_size_us_letter_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->page_size_us_letter_radio, FALSE, + FALSE, 0); + + dlg->private->page_size_a4_radio = + gtk_radio_button_new_with_label (radio_group, A4); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->page_size_a4_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), dlg->private->page_size_a4_radio, + FALSE, FALSE, 0); + + g_signal_connect_swapped ( + G_OBJECT(dlg->private->units_points_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->units_inches_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->units_mm_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->page_size_us_letter_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_connect_swapped ( + G_OBJECT(dlg->private->page_size_a4_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg); + + return wvbox; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Build Default Object Properties Notebook Tab */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +object_page (glPrefsDialog *dlg) +{ + GtkWidget *wlabel, *wvbox, *whbox; + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + + wlabel = gtk_label_new (_("Select default properties for new objects.")); + gtk_box_pack_start (GTK_BOX (wvbox), wlabel, FALSE, FALSE, 0); + + /* text props entry */ + dlg->private->text = + gl_wdgt_text_props_new ("Text"); + gtk_box_pack_start (GTK_BOX (wvbox), dlg->private->text, + FALSE, FALSE, 0); + + whbox = gtk_hbox_new (TRUE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, FALSE, FALSE, 0); + + /* ------ Line box ------ */ + dlg->private->line = gl_wdgt_line_new (_("Line")); + gtk_box_pack_start (GTK_BOX (whbox), dlg->private->line, + FALSE, TRUE, 0); + + /* ------ Fill box ------ */ + dlg->private->fill = gl_wdgt_fill_new (_("Fill")); + gtk_box_pack_start (GTK_BOX (whbox), dlg->private->fill, + FALSE, TRUE, 0); + + g_signal_connect_swapped (G_OBJECT(dlg->private->text), + "changed", + G_CALLBACK(update_prefs_from_object_page), + dlg); + g_signal_connect_swapped (G_OBJECT(dlg->private->line), + "changed", + G_CALLBACK(update_prefs_from_object_page), + dlg); + g_signal_connect_swapped (G_OBJECT(dlg->private->fill), + "changed", + G_CALLBACK(update_prefs_from_object_page), + dlg); + return wvbox; +} + + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update locale page widgets from current prefs. */ +/*--------------------------------------------------------------------------*/ +static update_locale_page_from_prefs (glPrefsDialog *dlg) +{ + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->units_points_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->units_inches_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->units_mm_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->page_size_us_letter_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->page_size_a4_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_points_radio), + TRUE); + break; + case GL_PREFS_UNITS_INCHES: + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_inches_radio), + TRUE); + break; + case GL_PREFS_UNITS_MM: + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_mm_radio), + TRUE); + break; + default: + g_warning ("Illegal units"); /* Should not happen */ + break; + } + + if ( g_strcasecmp(gl_prefs->default_page_size, US_LETTER) == 0) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_us_letter_radio), + TRUE); + } else if ( g_strcasecmp(gl_prefs->default_page_size, A4) == 0) { + gtk_toggle_button_set_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_a4_radio), + TRUE); + } else { + g_warning ("Unknown default page size"); /* Shouldn't happen */ + } + + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->units_points_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->units_inches_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->units_mm_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->page_size_us_letter_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->page_size_a4_radio), + G_CALLBACK(update_prefs_from_locale_page), dlg); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update object page widgets from current prefs. */ +/*--------------------------------------------------------------------------*/ +static update_object_page_from_prefs (glPrefsDialog *dlg) +{ + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->text), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->line), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_block_by_func ( + G_OBJECT(dlg->private->fill), + G_CALLBACK(update_prefs_from_object_page), dlg); + + gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(dlg->private->text), + gl_prefs->default_font_family, + gl_prefs->default_font_size, + gl_prefs->default_font_weight, + gl_prefs->default_font_italic_flag, + gl_prefs->default_text_color, + gl_prefs->default_text_alignment); + + gl_wdgt_line_set_params (GL_WDGT_LINE(dlg->private->line), + gl_prefs->default_line_width, + gl_prefs->default_line_color); + + gl_wdgt_fill_set_params (GL_WDGT_FILL(dlg->private->fill), + gl_prefs->default_fill_color); + + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->text), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->line), + G_CALLBACK(update_prefs_from_object_page), dlg); + g_signal_handlers_unblock_by_func ( + G_OBJECT(dlg->private->fill), + G_CALLBACK(update_prefs_from_object_page), dlg); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update prefs from current state of locale page widgets. */ +/*--------------------------------------------------------------------------*/ +static update_prefs_from_locale_page (glPrefsDialog *dlg) +{ + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_points_radio)) == 0) { + gl_prefs->units = GL_PREFS_UNITS_PTS; + } + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_inches_radio)) == 0) { + gl_prefs->units = GL_PREFS_UNITS_INCHES; + } + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->units_mm_radio)) == 0) { + gl_prefs->units = GL_PREFS_UNITS_MM; + } + + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_us_letter_radio)) == 0) { + gl_prefs->default_page_size = US_LETTER; + } + if (gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON(dlg->private->page_size_a4_radio)) == 0) { + gl_prefs->default_page_size = A4; + } + + gl_prefs_save_settings (); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update prefs from current state of object page widgets. */ +/*--------------------------------------------------------------------------*/ +static update_prefs_from_object_page (glPrefsDialog *dlg) +{ + gl_wdgt_text_props_get_params (GL_WDGT_TEXT_PROPS(dlg->private->text), + &gl_prefs->default_font_family, + &gl_prefs->default_font_size, + &gl_prefs->default_font_weight, + &gl_prefs->default_font_italic_flag, + &gl_prefs->default_text_color, + &gl_prefs->default_text_alignment); + + gl_wdgt_line_get_params (GL_WDGT_LINE(dlg->private->line), + &gl_prefs->default_line_width, + &gl_prefs->default_line_color); + + gl_wdgt_fill_get_params (GL_WDGT_FILL(dlg->private->fill), + &gl_prefs->default_fill_color); + + gl_prefs_save_settings (); +} + + + diff --git a/glabels2/src/prefs-dialog.h b/glabels2/src/prefs-dialog.h new file mode 100644 index 0000000..6daafdf --- /dev/null +++ b/glabels2/src/prefs-dialog.h @@ -0,0 +1,58 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs-dialog.h: Preferences dialog module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PREFS_DIALOG_H__ +#define __PREFS_DIALOG_H__ + +#include <gtk/gtk.h> + +#define GL_TYPE_PREFS_DIALOG (gl_prefs_dialog_get_type ()) +#define GL_PREFS_DIALOG(obj) (GTK_CHECK_CAST ((obj), GL_TYPE_PREFS_DIALOG, glPrefsDialog)) +#define GL_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PREFS_DIALOG, glPrefsDialogClass)) +#define GL_IS_PREFS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_PREFS_DIALOG)) +#define GL_IS_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PREFS_DIALOG)) +#define GL_PREFS_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_PREFS_DIALOG, glPrefsDialogClass)) + + +typedef struct _glPrefsDialog glPrefsDialog; +typedef struct _glPrefsDialogClass glPrefsDialogClass; + +typedef struct _glPrefsDialogPrivate glPrefsDialogPrivate; + +struct _glPrefsDialog +{ + GtkDialog parent_instance; + + glPrefsDialogPrivate *private; + +}; + +struct _glPrefsDialogClass +{ + GtkDialogClass parent_class; +}; + +GtkType gl_prefs_dialog_get_type (void) G_GNUC_CONST; + +GtkWidget* gl_prefs_dialog_new (GtkWindow *parent); + +#endif /* __PREFS_DIALOG_H__ */ diff --git a/glabels2/src/prefs.c b/glabels2/src/prefs.c new file mode 100644 index 0000000..c30040c --- /dev/null +++ b/glabels2/src/prefs.c @@ -0,0 +1,635 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs.h: Application preferences module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <libgnome/libgnome.h> +#include <libgnomeui/libgnomeui.h> + +#include <bonobo-mdi.h> +#include <gconf/gconf-client.h> + +#include "prefs.h" +#include "glabels.h" +#include "util.h" + +#include "debug.h" + +glPreferences *gl_prefs = NULL; + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/* GConf keys */ +#define BASE_KEY "/apps/glabels" + +#define PREF_UNITS "/units" +#define PREF_DEFAULT_PAGE_SIZE "/default-page-size" + +#define PREF_DEFAULT_FONT_FAMILY "/default-font-family" +#define PREF_DEFAULT_FONT_SIZE "/default-font-size" +#define PREF_DEFAULT_FONT_WEIGHT "/default-font-weight" +#define PREF_DEFAULT_FONT_ITALIC_FLAG "/default-font-italic-flag" +#define PREF_DEFAULT_TEXT_COLOR "/default-text-color" +#define PREF_DEFAULT_TEXT_ALIGNMENT "/default-text-alignment" + +#define PREF_DEFAULT_LINE_WIDTH "/default-line-width" +#define PREF_DEFAULT_LINE_COLOR "/default-line-color" + +#define PREF_DEFAULT_FILL_COLOR "/default-fill-color" + +#define PREF_TOOLBAR_VISIBLE "/toolbar-visible" +#define PREF_TOOLBAR_BUTTONS_STYLE "/toolbar-buttons-style" +#define PREF_TOOLBAR_VIEW_TOOLTIPS "/toolbar-view-tooltips" + +#define PREF_MDI_MODE "/mdi-mode" +#define PREF_TABS_POSITION "/mdi-tabs-position" + +#define PREF_MAX_RECENTS "/max-recents" + +/* Default values */ +#define DEFAULT_UNITS_STRING units_to_string (GL_PREFS_UNITS_INCHES) +#define DEFAULT_PAGE_SIZE "US Letter" + +#define DEFAULT_FONT_FAMILY "Helvetica" +#define DEFAULT_FONT_SIZE 14.0 +#define DEFAULT_FONT_WEIGHT_STRING gl_util_weight_to_string (GNOME_FONT_BOOK) +#define DEFAULT_FONT_ITALIC_FLAG FALSE +#define DEFAULT_TEXT_JUST_STRING gl_util_just_to_string (GTK_JUSTIFY_LEFT) +#define DEFAULT_TEXT_COLOR GNOME_CANVAS_COLOR (0,0,0) + +#define DEFAULT_LINE_WIDTH 1.0 +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) + +#define DEFAULT_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 255) + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ +static GConfClient *gconf_client = NULL; + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data); + +static gchar *get_string (GConfClient* client, const gchar* key, const gchar* def); +static gboolean get_bool (GConfClient* client, const gchar* key, gboolean def); +static gint get_int (GConfClient* client, const gchar* key, gint def); +static gdouble get_float (GConfClient* client, const gchar* key, gdouble def); + +static glPrefsUnits string_to_units (const gchar *string); +static const gchar *units_to_string (glPrefsUnits units); + + + +/*****************************************************************************/ +/* Initialize preferences module. */ +/*****************************************************************************/ +void +gl_prefs_init (void) +{ + gl_debug (DEBUG_PREFS, ""); + + gconf_client = gconf_client_get_default (); + + g_return_if_fail (gconf_client != NULL); + + gconf_client_add_dir (gconf_client, + BASE_KEY, + GCONF_CLIENT_PRELOAD_ONELEVEL, + NULL); + + gconf_client_notify_add (gconf_client, + BASE_KEY, + notify_cb, + NULL, NULL, NULL); +} + + +/*****************************************************************************/ +/* Save all settings. */ +/*****************************************************************************/ +void +gl_prefs_save_settings (void) +{ + BonoboWindow* active_window = NULL; + + gl_debug (DEBUG_PREFS, "START"); + + g_return_if_fail (gconf_client != NULL); + g_return_if_fail (gl_prefs != NULL); + + /* Units */ + gconf_client_set_string (gconf_client, + BASE_KEY PREF_UNITS, + units_to_string(gl_prefs->units), + NULL); + + /* Default page size */ + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_PAGE_SIZE, + gl_prefs->default_page_size, + NULL); + + + /* Text properties */ + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_FAMILY, + gl_prefs->default_font_family, + NULL); + + gconf_client_set_float (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_SIZE, + gl_prefs->default_font_size, + NULL); + + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_WEIGHT, + gl_util_weight_to_string(gl_prefs->default_font_weight), + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_COLOR, + gl_prefs->default_text_color, + NULL); + + gconf_client_set_string (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_ALIGNMENT, + gl_util_just_to_string(gl_prefs->default_text_alignment), + NULL); + + + /* Line properties */ + gconf_client_set_float (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_WIDTH, + gl_prefs->default_line_width, + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_COLOR, + gl_prefs->default_line_color, + NULL); + + + /* Fill properties */ + gconf_client_set_int (gconf_client, + BASE_KEY PREF_DEFAULT_FILL_COLOR, + gl_prefs->default_fill_color, + NULL); + + + /* Toolbar */ + gconf_client_set_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VISIBLE, + gl_prefs->toolbar_visible, + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_TOOLBAR_BUTTONS_STYLE, + gl_prefs->toolbar_buttons_style, + NULL); + + gconf_client_set_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VIEW_TOOLTIPS, + gl_prefs->toolbar_view_tooltips, + NULL); + + + /* MDI */ + gconf_client_set_int (gconf_client, + BASE_KEY PREF_MDI_MODE, + gl_prefs->mdi_mode, + NULL); + + gconf_client_set_int (gconf_client, + BASE_KEY PREF_TABS_POSITION, + gl_prefs->mdi_tabs_position, + NULL); + + + /* Recent files */ + gconf_client_set_int (gconf_client, + BASE_KEY PREF_MAX_RECENTS, + gl_prefs->max_recents, + NULL); + + + gconf_client_suggest_sync (gconf_client, NULL); + + gl_debug (DEBUG_PREFS, "END"); +} + +/*****************************************************************************/ +/* Load all settings. */ +/*****************************************************************************/ +void +gl_prefs_load_settings (void) +{ + gchar *string; + + gl_debug (DEBUG_PREFS, "START"); + + if (gl_prefs == NULL) + gl_prefs = g_new0 (glPreferences, 1); + + if (gconf_client == NULL) + { + /* TODO: in any case set default values */ + g_warning ("Cannot load settings."); + return; + } + + + /* Units */ + string = + get_string (gconf_client, + BASE_KEY PREF_UNITS, + DEFAULT_UNITS_STRING); + gl_prefs->units = string_to_units( string ); + g_free( string ); + + + /* Page size */ + gl_prefs->default_page_size = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_PAGE_SIZE, + DEFAULT_PAGE_SIZE); + + /* Text properties */ + gl_prefs->default_font_family = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_FAMILY, + DEFAULT_FONT_FAMILY); + + gl_prefs->default_font_size = + get_float (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_SIZE, + DEFAULT_FONT_SIZE); + + string = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_FONT_WEIGHT, + DEFAULT_FONT_WEIGHT_STRING); + gl_prefs->default_font_weight = + gl_util_string_to_weight( string ); + g_free( string ); + + gl_prefs->default_text_color = + get_int (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_COLOR, + DEFAULT_TEXT_COLOR); + + string = + get_string (gconf_client, + BASE_KEY PREF_DEFAULT_TEXT_ALIGNMENT, + DEFAULT_TEXT_JUST_STRING); + gl_prefs->default_font_weight = gl_util_string_to_just( string ); + g_free( string ); + + + /* Line properties */ + gl_prefs->default_line_width = + get_float (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_WIDTH, + DEFAULT_LINE_WIDTH); + gl_prefs->default_line_color = + get_int (gconf_client, + BASE_KEY PREF_DEFAULT_LINE_COLOR, + DEFAULT_LINE_COLOR); + + /* Fill properties */ + gl_prefs->default_fill_color = + get_int (gconf_client, + BASE_KEY PREF_DEFAULT_FILL_COLOR, + DEFAULT_FILL_COLOR); + + + /* User Inferface/Toolbar */ + gl_prefs->toolbar_visible = + get_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VISIBLE, + TRUE); + + gl_prefs->toolbar_buttons_style = + get_int (gconf_client, + BASE_KEY PREF_TOOLBAR_BUTTONS_STYLE, + GL_TOOLBAR_SYSTEM); + + gl_prefs->toolbar_view_tooltips = + get_bool (gconf_client, + BASE_KEY PREF_TOOLBAR_VIEW_TOOLTIPS, + TRUE); + + + /* User Inferface/MDI */ + gl_prefs->mdi_mode = + get_int (gconf_client, + BASE_KEY PREF_MDI_MODE, + 0); + + gl_prefs->mdi_tabs_position = + get_int (gconf_client, + BASE_KEY PREF_TABS_POSITION, + 0); + + + /* Recent files */ + gl_prefs->max_recents = + get_int (gconf_client, + BASE_KEY PREF_MAX_RECENTS, + 4); + + + gl_debug (DEBUG_PREFS, "max_recents = %d", gl_prefs->max_recents); + + gl_debug (DEBUG_PREFS, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Key changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) +{ + gl_debug (DEBUG_PREFS, "Key was changed: %s", entry->key); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Utilities to get values with defaults. */ +/*---------------------------------------------------------------------------*/ +static gchar* +get_string (GConfClient* client, + const gchar* key, + const gchar* def) +{ + gchar* val; + + val = gconf_client_get_string (client, key, NULL); + + if (val != NULL) { + + return val; + + } else { + + return def ? g_strdup (def) : NULL; + + } +} + +static gboolean +get_bool (GConfClient* client, + const gchar* key, + gboolean def) +{ + GConfValue* val; + gboolean retval; + + val = gconf_client_get (client, key, NULL); + + if (val != NULL) { + + if ( val->type == GCONF_VALUE_BOOL ) { + retval = gconf_value_get_bool (val); + } else { + retval = def; + } + + gconf_value_free (val); + + return retval; + + } else { + + return def; + + } +} + +static gint +get_int (GConfClient* client, + const gchar* key, + gint def) +{ + GConfValue* val; + gint retval; + + val = gconf_client_get (client, key, NULL); + + if (val != NULL) { + + if ( val->type == GCONF_VALUE_INT) { + retval = gconf_value_get_int(val); + } else { + retval = def; + } + + gconf_value_free (val); + + return retval; + + } else { + + return def; + + } +} + +static gdouble +get_float (GConfClient* client, + const gchar* key, + gdouble def) +{ + GConfValue* val; + gdouble retval; + + val = gconf_client_get (client, key, NULL); + + if (val != NULL) { + + if ( val->type == GCONF_VALUE_FLOAT ) { + retval = gconf_value_get_float(val); + } else { + retval = def; + } + + gconf_value_free (val); + + return retval; + + } else { + + return def; + + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Utilities to deal with units. */ +/*---------------------------------------------------------------------------*/ +static glPrefsUnits string_to_units (const gchar *string) +{ + glPrefsUnits units; + + if (g_strcasecmp (string, "Points") == 0) { + units = GL_PREFS_UNITS_PTS; + } else if (g_strcasecmp (string, "Inches") == 0) { + units = GL_PREFS_UNITS_INCHES; + } else if (g_strcasecmp (string, "Millimeters") == 0) { + units = GL_PREFS_UNITS_MM; + } else { + units = GL_PREFS_UNITS_INCHES; + } + + return units; +} + +static const gchar *units_to_string (glPrefsUnits units) +{ + switch (units) { + case GL_PREFS_UNITS_PTS: + return "Points"; + break; + case GL_PREFS_UNITS_INCHES: + return "Inches"; + break; + case GL_PREFS_UNITS_MM: + return "Millimeters"; + break; + default: + return "Inches"; + break; + } +} + + + +/****************************************************************************/ +/* Get string representing desired units. */ +/****************************************************************************/ +const gchar * +gl_prefs_get_page_size (void) +{ + return (gl_prefs->default_page_size); +} + +/****************************************************************************/ +/* Get desired units. */ +/****************************************************************************/ +glPrefsUnits +gl_prefs_get_units (void) +{ + return gl_prefs->units; +} + +/****************************************************************************/ +/* Get desired units per point. */ +/****************************************************************************/ +gdouble +gl_prefs_get_units_per_point (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return 1.0; /* points */ + case GL_PREFS_UNITS_INCHES: + return 1.0 / 72.0; /* inches */ + case GL_PREFS_UNITS_MM: + return 0.35277778; /* mm */ + default: + g_warning ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get precision for desired units. */ +/****************************************************************************/ +gint +gl_prefs_get_units_precision (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return 1; /* points */ + case GL_PREFS_UNITS_INCHES: + return 3; /* inches */ + case GL_PREFS_UNITS_MM: + return 1; /* mm */ + default: + g_warning ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get step size for desired units. */ +/****************************************************************************/ +gdouble +gl_prefs_get_units_step_size (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return 0.1; /* points */ + case GL_PREFS_UNITS_INCHES: + return 0.001; /* inches */ + case GL_PREFS_UNITS_MM: + return 0.1; /* mm */ + default: + g_warning ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get string representing desired units. */ +/****************************************************************************/ +const gchar * +gl_prefs_get_units_string (void) +{ + + switch (gl_prefs->units) { + case GL_PREFS_UNITS_PTS: + return _("points"); + case GL_PREFS_UNITS_INCHES: + return _("inches"); + case GL_PREFS_UNITS_MM: + return _("mm"); + default: + g_warning ("Illegal units"); /* Should not happen */ + return _("points"); + } +} + diff --git a/glabels2/src/prefs.h b/glabels2/src/prefs.h new file mode 100644 index 0000000..40d6ae2 --- /dev/null +++ b/glabels2/src/prefs.h @@ -0,0 +1,91 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs.h: Application preferences module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PREFS_H__ +#define __PREFS_H__ + +#include <libgnomeprint/gnome-font.h> + +typedef struct _glPreferences glPreferences; + +typedef enum { + GL_TOOLBAR_SYSTEM = 0, + GL_TOOLBAR_ICONS, + GL_TOOLBAR_ICONS_AND_TEXT +} glToolbarSetting; + +typedef enum { + GL_PREFS_UNITS_PTS, + GL_PREFS_UNITS_INCHES, + GL_PREFS_UNITS_MM, +} glPrefsUnits; + +struct _glPreferences +{ + /* Units */ + glPrefsUnits units; + + /* Page size */ + gchar *default_page_size; + + /* Text properties */ + gchar *default_font_family; + gdouble default_font_size; + GnomeFontWeight default_font_weight; + gboolean default_font_italic_flag; + guint default_text_color; + GtkJustification default_text_alignment; + + /* Line properties */ + gdouble default_line_width; + guint default_line_color; + + /* Fill properties */ + guint default_fill_color; + + /* User Interface/Toolbar */ + gboolean toolbar_visible; + glToolbarSetting toolbar_buttons_style; + gboolean toolbar_view_tooltips; + + /* User Interface/MDI Mode */ + gint mdi_mode; + gint mdi_tabs_position; /* Tabs position in mdi notebook */ + + /* Recent files */ + gint max_recents; +}; + +extern glPreferences *gl_prefs; + +extern void gl_prefs_save_settings (void); +extern void gl_prefs_load_settings (void); +extern void gl_prefs_init (void); + +extern const gchar *gl_prefs_get_page_size (void); +extern glPrefsUnits gl_prefs_get_units (void); +extern const gchar *gl_prefs_get_units_string (void); +extern gdouble gl_prefs_get_units_per_point (void); +extern gdouble gl_prefs_get_units_step_size (void); +extern gint gl_prefs_get_units_precision (void); + +#endif /* __PREFS_H__ */ + diff --git a/glabels2/src/print-dialog.c b/glabels2/src/print-dialog.c new file mode 100644 index 0000000..3943b92 --- /dev/null +++ b/glabels2/src/print-dialog.c @@ -0,0 +1,392 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.c: Print module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include <math.h> +#include <time.h> +#include <ctype.h> +#include <gtk/gtk.h> +#include <libgnomeprint/gnome-print-paper.h> +#include <libgnomeprintui/gnome-printer-dialog.h> +#include <libgnomeprintui/gnome-print-dialog.h> +#include <libgnomeprint/gnome-print-master.h> +#include <libgnomeprintui/gnome-print-master-preview.h> + +#include "print-dialog.h" +#include "print.h" +#include "label.h" +#include "bc.h" +#include "template.h" +#include "mdi.h" +#include "glabels.h" + +#include "wdgt-print-copies.h" +#include "wdgt-print-merge.h" + +#include "debug.h" + +#define RED(x) ( (((x)>>24) & 0xff) / 255.0 ) +#define GREEN(x) ( (((x)>>16) & 0xff) / 255.0 ) +#define BLUE(x) ( (((x)>>8) & 0xff) / 255.0 ) +#define ALPHA(x) ( ( (x) & 0xff) / 255.0 ) + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals. */ +/*===========================================*/ + +/* remember state of dialog. */ +static gboolean outline_flag = FALSE; +static gboolean reverse_flag = FALSE; +static gboolean collate_flag = FALSE; +static gint first = 1, last = 1, n_sheets = 0, n_copies = 1; + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ +static GtkWidget *job_page_new (GtkWidget *dlg, glLabel *label); +static GtkWidget *printer_page_new (GtkWidget *dlg, glLabel *label); + +static void print_response (GtkDialog *dlg, + gint response, + glLabel *label); + +static void print_sheets (GnomePrintConfig *config, glLabel * label, + gboolean preview_flag, + gint n_sheets, gint first, gint last, + gboolean outline_flag, gboolean reverse_flag); + +static void print_sheets_merge (GnomePrintConfig *config, glLabel * label, + GList *record_list, + gboolean preview_flag, + gint n_copies, gint first, + gboolean collate_flag, + gboolean outline_flag, gboolean reverse_flag); + + +/*****************************************************************************/ +/* "Print" dialog. */ +/*****************************************************************************/ +void +gl_print_dialog (glLabel *label, BonoboWindow *win) +{ + GtkWidget *dlg; + GtkWidget *pp_button, *notebook, *page; + + g_return_if_fail (label != NULL); + g_return_if_fail (win != NULL); + + /* ----- Contstruct basic print dialog with notebook ----- */ + dlg = gtk_dialog_new_with_buttons (_("Print"), GTK_WINDOW(win), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_PRINT, GNOME_PRINT_DIALOG_RESPONSE_PRINT, + + NULL); + pp_button = gtk_dialog_add_button (GTK_DIALOG (dlg), + GTK_STOCK_PRINT_PREVIEW, + GNOME_PRINT_DIALOG_RESPONSE_PREVIEW); + gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (dlg)->action_area), + pp_button, TRUE); + gtk_dialog_set_default_response (GTK_DIALOG (dlg), + GNOME_PRINT_DIALOG_RESPONSE_PRINT); + notebook = gtk_notebook_new (); + gtk_container_set_border_width (GTK_CONTAINER (notebook), 4); + gtk_widget_show (notebook); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), notebook); + + + /* ----- Create Job notebook page ----- */ + page = job_page_new (dlg, label); + gtk_notebook_append_page (GTK_NOTEBOOK(notebook), page, + gtk_label_new_with_mnemonic (_("_Job"))); + + /* ----- Create Printer notebook page ----- */ + page = printer_page_new (dlg, label); + gtk_notebook_append_page (GTK_NOTEBOOK(notebook), page, + gtk_label_new_with_mnemonic (_("P_rinter"))); + + g_signal_connect (G_OBJECT(dlg), "response", + G_CALLBACK (print_response), label); + + gtk_widget_show_all (GTK_WIDGET (dlg)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create "Job" page. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +job_page_new (GtkWidget *dlg, + glLabel *label) +{ + GtkWidget *vbox; + glMerge *merge; + GtkWidget *wframe; + GtkWidget *copies = NULL, *prmerge = NULL; + GtkWidget *wvbox, *outline_check, *reverse_check; + GList *record_list; + gint n_records; + + vbox = gtk_vbox_new (FALSE, 0); + + merge = gl_label_get_merge (label); + if (merge->type == GL_MERGE_NONE) { + + /* ----------- Add simple-copies widget ------------ */ + wframe = gtk_frame_new (_("Copies")); + gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + + copies = gl_wdgt_print_copies_new (label); + gtk_container_set_border_width (GTK_CONTAINER (copies), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), copies); + + if (n_sheets) { + gl_wdgt_print_copies_set_range (GL_WDGT_PRINT_COPIES (copies), + n_sheets, first, last); + } + + } else { + + /* ------- Otherwise add merge control widget ------------ */ + wframe = gtk_frame_new (_("Document merge control")); + gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + + prmerge = gl_wdgt_print_merge_new (label); + gtk_container_set_border_width (GTK_CONTAINER (prmerge), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), prmerge); + + record_list = gl_merge_read_data (merge->type, + merge->field_defs, + merge->src); + n_records = gl_merge_count_records( record_list ); + gl_wdgt_print_merge_set_copies (GL_WDGT_PRINT_MERGE(prmerge), + n_copies, first, n_records, + collate_flag); + } + gtk_widget_show_all (wframe); + g_object_set_data (G_OBJECT(dlg), "copies", copies); + g_object_set_data (G_OBJECT(dlg), "prmerge", prmerge); + + /* ----------- Add custom print options area ------------ */ + wframe = gtk_frame_new (_("Options")); + gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), wvbox); + + /* add Outline check button */ + outline_check = + gtk_check_button_new_with_label ( + _("print outlines (to test printer alignment)")); + gtk_box_pack_start (GTK_BOX (wvbox), outline_check, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (outline_check), + outline_flag); + g_object_set_data (G_OBJECT(dlg), "outline_check", outline_check); + + /* add Reverse check button */ + reverse_check = + gtk_check_button_new_with_label ( + _("print in reverse (i.e. a mirror image)")); + gtk_box_pack_start (GTK_BOX (wvbox), reverse_check, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reverse_check), + reverse_flag); + g_object_set_data (G_OBJECT(dlg), "reverse_check", reverse_check); + + gtk_widget_show_all (wframe); + + return vbox; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create "Printer" page. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +printer_page_new (GtkWidget *dlg, + glLabel *label) +{ + GtkWidget *vbox; + GtkWidget *printer_select; + + vbox = gtk_vbox_new (FALSE, 0); + + printer_select = + gnome_printer_selection_new (gnome_print_config_default ()); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); + gtk_widget_show (printer_select); + gtk_box_pack_start (GTK_BOX(vbox), printer_select, FALSE, FALSE, 0); + + g_object_set_data (G_OBJECT(dlg), "printer_select", printer_select); + + return vbox; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Print "response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +print_response (GtkDialog *dlg, + gint response, + glLabel *label) +{ + GtkWidget *copies, *prmerge; + GtkWidget *outline_check, *reverse_check; + GtkWidget *printer_select; + GnomePrintConfig *config; + glMerge *merge; + GList *record_list; + + switch (response) { + + case GNOME_PRINT_DIALOG_RESPONSE_PRINT: + case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW: + copies = g_object_get_data (G_OBJECT(dlg), "copies"); + prmerge = g_object_get_data (G_OBJECT(dlg), "prmerge"); + outline_check = g_object_get_data (G_OBJECT(dlg), + "outline_check"); + reverse_check = g_object_get_data (G_OBJECT(dlg), + "reverse_check"); + printer_select = g_object_get_data (G_OBJECT(dlg), + "printer_select"); + + config = gnome_printer_selection_get_config (GNOME_PRINTER_SELECTION(printer_select)); + + outline_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (outline_check)); + reverse_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (reverse_check)); + + merge = gl_label_get_merge (label); + + if (merge->type == GL_MERGE_NONE) { + + gl_wdgt_print_copies_get_range (GL_WDGT_PRINT_COPIES (copies), + &n_sheets, &first, &last); + print_sheets (config, label, + (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW), + n_sheets, first, last, + outline_flag, reverse_flag); + + } else { + + record_list = gl_merge_read_data (merge->type, + merge->field_defs, + merge->src); + gl_wdgt_print_merge_get_copies (GL_WDGT_PRINT_MERGE (prmerge), + &n_copies, &first, + &collate_flag); + print_sheets_merge (config, label, record_list, + (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW), + n_copies, first, + collate_flag, + outline_flag, + reverse_flag); + } + + gl_merge_free (&merge); + break; + + default: + break; + + } + + gtk_widget_destroy (GTK_WIDGET (dlg)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. print the sheets */ +/*---------------------------------------------------------------------------*/ +static void +print_sheets (GnomePrintConfig *config, + glLabel * label, + gboolean preview_flag, + gint n_sheets, + gint first, + gint last, + gboolean outline_flag, + gboolean reverse_flag) +{ + GnomePrintMaster *master; + + master = gnome_print_master_new_from_config (config); + gl_print_simple (master, label, n_sheets, first, last, + outline_flag, reverse_flag); + gnome_print_master_close (master); + + if (preview_flag) { + GtkWidget *preview_widget = + gnome_print_master_preview_new (master, _("Print preview")); + gtk_widget_show (GTK_WIDGET (preview_widget)); + } else { + gnome_print_master_print (master); + } + + g_object_unref (G_OBJECT (master)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. print the sheets with merge data */ +/*---------------------------------------------------------------------------*/ +static void +print_sheets_merge (GnomePrintConfig *config, + glLabel * label, + GList * record_list, + gboolean preview_flag, + gint n_copies, + gint first, + gboolean collate_flag, + gboolean outline_flag, + gboolean reverse_flag) +{ + GnomePrintMaster *master; + + master = gnome_print_master_new_from_config (config); + if ( collate_flag ) { + gl_print_merge_collated (master, label, record_list, + n_copies, first, + outline_flag, reverse_flag); + } else { + gl_print_merge_uncollated (master, label, record_list, + n_copies, first, + outline_flag, reverse_flag); + } + gnome_print_master_close (master); + + if (preview_flag) { + GtkWidget *preview_widget = + gnome_print_master_preview_new (master, _("Print preview")); + gtk_widget_show (GTK_WIDGET (preview_widget)); + } else { + gnome_print_master_print (master); + } + + g_object_unref (G_OBJECT (master)); +} + diff --git a/glabels2/src/print-dialog.h b/glabels2/src/print-dialog.h new file mode 100644 index 0000000..af1cd6f --- /dev/null +++ b/glabels2/src/print-dialog.h @@ -0,0 +1,31 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_dialog.h: Print dialog module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PRINT_DIALOG_H__ +#define __PRINT_DIALOG_H__ + +#include <gnome.h> +#include <bonobo-mdi.h> +#include "label.h" + +extern void gl_print_dialog (glLabel *label, BonoboWindow *win); + +#endif diff --git a/glabels2/src/print.c b/glabels2/src/print.c new file mode 100644 index 0000000..b94765a --- /dev/null +++ b/glabels2/src/print.c @@ -0,0 +1,1070 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.c: Print module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + +#include <math.h> +#include <time.h> +#include <ctype.h> +#include <gtk/gtk.h> +#include <libgnomeprint/gnome-print-paper.h> +#include <libgnomeprintui/gnome-printer-dialog.h> + +#include "print.h" +#include "label.h" +#include "label-text.h" +#include "label-box.h" +#include "label-line.h" +#include "label-ellipse.h" +#include "label-image.h" +#include "label-barcode.h" +#include "bc.h" +#include "template.h" + +#include "debug.h" + +#define GL_PRINT_DEFAULT_PAPER "US Letter" + +#define RED(x) ( (((x)>>24) & 0xff) / 255.0 ) +#define GREEN(x) ( (((x)>>16) & 0xff) / 255.0 ) +#define BLUE(x) ( (((x)>>8) & 0xff) / 255.0 ) +#define ALPHA(x) ( ( (x) & 0xff) / 255.0 ) + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ +typedef struct _PrintInfo { + /* gnome print context */ + GnomePrintContext *pc; + + /* gnome print configuration */ + GnomePrintConfig *config; + + /* gLabels Template */ + const glTemplate *template; + gboolean label_rotate_flag; + +} PrintInfo; + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ +static PrintInfo *print_info_new (GnomePrintMaster * master, glLabel * label); +static void print_info_free (PrintInfo ** pi); + +static void print_label (PrintInfo * pi, glLabel * label, gint i, + glMergeRecord * record, gboolean outline_flag, + gboolean reverse_flag); + +static void draw_label (PrintInfo * pi, glLabel * label, + glMergeRecord * record); + +static void draw_text_object (PrintInfo * pi, glLabelText * object, + glMergeRecord * record); +static void draw_box_object (PrintInfo * pi, glLabelBox * object); +static void draw_line_object (PrintInfo * pi, glLabelLine * object); +static void draw_ellipse_object (PrintInfo * pi, glLabelEllipse * object); +static void draw_image_object (PrintInfo * pi, glLabelImage * object); +static void draw_barcode_object (PrintInfo * pi, glLabelBarcode * object, + glMergeRecord * record); + +static void draw_outline (PrintInfo * pi, glLabel * label); +static void clip_to_outline (PrintInfo * pi, glLabel * label); + +static void create_rectangle_path (GnomePrintContext * pc, + gdouble x0, gdouble y0, + gdouble w, gdouble h); +static void create_ellipse_path (GnomePrintContext * pc, + gdouble x0, gdouble y0, + gdouble rx, gdouble ry); +static void create_rounded_rectangle_path (GnomePrintContext * pc, + gdouble x0, gdouble y0, + gdouble w, gdouble h, gdouble r); + +/*****************************************************************************/ +/* Simple (no merge data) print command. */ +/*****************************************************************************/ +void +gl_print_simple (GnomePrintMaster * master, + glLabel * label, + gint n_sheets, + gint first, + gint last, + gboolean outline_flag, + gboolean reverse_flag) +{ + PrintInfo *pi; + gint i_sheet, i_label; + gchar *page_str = NULL; + + gl_debug (DEBUG_PRINT, "START"); + + pi = print_info_new (master, label); + + for (i_sheet = 0; i_sheet < n_sheets; i_sheet++) { + + page_str = g_strdup_printf ("sheet %d", i_sheet + 1); + gnome_print_beginpage (pi->pc, page_str); + g_free (page_str); + + for (i_label = first - 1; i_label < last; i_label++) { + + print_label (pi, label, i_label, NULL, + outline_flag, reverse_flag); + + } + + gnome_print_showpage (pi->pc); + } + + print_info_free (&pi); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*****************************************************************************/ +/* Merge print command (collated copies) */ +/*****************************************************************************/ +void +gl_print_merge_collated (GnomePrintMaster * master, + glLabel * label, + GList * record_list, + gint n_copies, + gint first, + gboolean outline_flag, + gboolean reverse_flag) +{ + PrintInfo *pi; + gint i_sheet, i_label, n_labels_per_page, i_copy; + gchar *str = NULL; + glMergeRecord *record; + GList *p; + + gl_debug (DEBUG_PRINT, "START"); + + pi = print_info_new (master, label); + + n_labels_per_page = (pi->template->nx) * (pi->template->ny); + + i_sheet = 0; + i_label = first - 1; + + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) { + for (i_copy = 0; i_copy < n_copies; i_copy++) { + + if ((i_label == 0) || (i_sheet == 0)) { + str = g_strdup_printf ("sheet %d", + ++i_sheet); + gnome_print_beginpage (pi->pc, str); + g_free (str); + } + + print_label (pi, label, i_label, record, + outline_flag, reverse_flag); + + i_label = (i_label + 1) % n_labels_per_page; + if (i_label == 0) { + gnome_print_showpage (pi->pc); + } + } + } + } + + if (i_label != 0) { + gnome_print_showpage (pi->pc); + } + + print_info_free (&pi); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*****************************************************************************/ +/* Merge print command (uncollated copies) */ +/*****************************************************************************/ +void +gl_print_merge_uncollated (GnomePrintMaster * master, + glLabel * label, + GList * record_list, + gint n_copies, + gint first, + gboolean outline_flag, + gboolean reverse_flag) +{ + PrintInfo *pi; + gint i_sheet, i_label, n_labels_per_page, i_copy; + gchar *str = NULL; + glMergeRecord *record; + GList *p; + + gl_debug (DEBUG_PRINT, "START"); + + pi = print_info_new (master, label); + + n_labels_per_page = (pi->template->nx) * (pi->template->ny); + + i_sheet = 0; + i_label = first - 1; + + for (i_copy = 0; i_copy < n_copies; i_copy++) { + + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) { + + + if ((i_label == 0) || (i_sheet == 0)) { + str = g_strdup_printf ("sheet %d", + ++i_sheet); + gnome_print_beginpage (pi->pc, str); + g_free (str); + } + + print_label (pi, label, i_label, record, + outline_flag, reverse_flag); + + i_label = (i_label + 1) % n_labels_per_page; + if (i_label == 0) { + gnome_print_showpage (pi->pc); + } + } + } + + } + if (i_label != 0) { + gnome_print_showpage (pi->pc); + } + + print_info_free (&pi); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*****************************************************************************/ +/* Batch print. Call appropriate function above. */ +/*****************************************************************************/ +void +gl_print_batch (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint n_copies, + gboolean outline_flag, gboolean reverse_flag) +{ + gint n_per_page; + GList *record_list = NULL; + glMerge *merge; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + merge = gl_label_get_merge (label); + template = gl_label_get_template (label); + + if ( merge->type == GL_MERGE_NONE ) { + n_per_page = (template->nx)*(template->ny); + + gl_print_simple (master, label, n_sheets, 1, n_per_page, + outline_flag, reverse_flag); + } else { + record_list = gl_merge_read_data (merge->type, + merge->field_defs, + merge->src); + + gl_print_merge_collated (master, label, record_list, + n_copies, 1, + outline_flag, reverse_flag); + } + gl_merge_free (&merge); + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. new print info structure */ +/*---------------------------------------------------------------------------*/ +static PrintInfo * +print_info_new (GnomePrintMaster * master, + glLabel * label) +{ + PrintInfo *pi = g_new0 (PrintInfo, 1); + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + if (template == NULL) { + g_warning ("Label has no template"); + return NULL; + } + + pi->pc = gnome_print_master_get_context (master); + pi->config = gnome_print_master_get_config (master); + + if ((template != NULL) && (template->page_size != NULL)) { + const GnomePrintPaper *paper = NULL; + + gl_debug (DEBUG_PRINT, + "setting page size = \"%s\"", template->page_size); + + + /* Currently cannot set page size directly from name, */ + /* since we must set Ids not Names and there is no */ + /* way to do the reverse lookup of Id from Name. */ + /* Sometimes they are the same, but not always */ + /* (e.g. for the name "US Letter" id="USLetter" */ + /* So we use the "Custom" Id. */ + paper = gnome_print_paper_get_by_name (template->page_size); + gnome_print_config_set (pi->config, + GNOME_PRINT_KEY_PAPER_SIZE, + "Custom"); + gnome_print_config_set_length (pi->config, + GNOME_PRINT_KEY_PAPER_WIDTH, + paper->width, + GNOME_PRINT_PS_UNIT); + gnome_print_config_set_length (pi->config, + GNOME_PRINT_KEY_PAPER_HEIGHT, + paper->height, + GNOME_PRINT_PS_UNIT); + } else { + gnome_print_config_set (pi->config, + GNOME_PRINT_KEY_PAPER_SIZE, + GL_PRINT_DEFAULT_PAPER); + } + +#if 1 + /* gnome_print_config_dump (pi->config); */ + { + GList *p, *list; + GnomePrintPaper *paper; + gchar *name; + + list = gnome_print_paper_get_list(); + for ( p=list; p != NULL; p=p->next ) { + paper = (GnomePrintPaper *)p->data; + gl_debug (DEBUG_PRINT, " \"%s\"", paper->name); + } + gl_debug (DEBUG_PRINT, + "template->page_size = \"%s\"", template->page_size); + + name = gnome_print_config_get (pi->config, + GNOME_PRINT_KEY_PAPER_SIZE); + gl_debug (DEBUG_PRINT, "config = \"%s\"", name); + } +#endif + + pi->template = template; + pi->label_rotate_flag = gl_label_get_rotate_flag (label); + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); + + return pi; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. free print info structure */ +/*---------------------------------------------------------------------------*/ +static void +print_info_free (PrintInfo ** pi) +{ + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_context_close ((*pi)->pc); + + g_free (*pi); + *pi = NULL; + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Print i'th label. */ +/*---------------------------------------------------------------------------*/ +static void +print_label (PrintInfo * pi, + glLabel * label, + gint i_label, + glMergeRecord * record, + gboolean outline_flag, + gboolean reverse_flag) +{ + gdouble a[6]; + gint ix, iy; + gdouble width, height; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + gl_label_get_size (label, &width, &height); + + ix = i_label % (template->nx); + iy = ((template->ny) - 1) - (i_label / (template->nx)); + + gnome_print_gsave (pi->pc); + + /* Transform coordinate system to be relative to upper corner */ + /* of the current label */ + gnome_print_translate (pi->pc, + ix * (template->dx) + template->x0, + iy * (template->dy) + template->y0); + if (gl_label_get_rotate_flag (label)) { + gl_debug (DEBUG_PRINT, "Rotate flag set"); + gnome_print_rotate (pi->pc, 90.0); + gnome_print_scale (pi->pc, 1.0, -1.0); + } else { + gl_debug (DEBUG_PRINT, "Rotate flag NOT set"); + art_affine_scale (a, 1.0, -1.0); + a[5] = height; + gnome_print_concat (pi->pc, a); + } + if ( reverse_flag ) { + gnome_print_translate (pi->pc, width, 0.0); + art_affine_scale (a, -1.0, 1.0); + gnome_print_concat (pi->pc, a); + } + if (outline_flag) { + draw_outline (pi, label); + } + clip_to_outline (pi, label); + draw_label (pi, label, record); + + gnome_print_grestore (pi->pc); + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw label. */ +/*---------------------------------------------------------------------------*/ +static void +draw_label (PrintInfo * pi, + glLabel * label, + glMergeRecord * record) +{ + GList *p_obj; + glLabelObject *object; + + gl_debug (DEBUG_PRINT, "START"); + + for (p_obj = label->objects; p_obj != NULL; p_obj = p_obj->next) { + object = (glLabelObject *) p_obj->data; + + if (GL_IS_LABEL_TEXT(object)) { + draw_text_object (pi, GL_LABEL_TEXT(object), record); + } else if (GL_IS_LABEL_BOX(object)) { + draw_box_object (pi, GL_LABEL_BOX(object)); + } else if (GL_IS_LABEL_LINE(object)) { + draw_line_object (pi, GL_LABEL_LINE(object)); + } else if (GL_IS_LABEL_ELLIPSE(object)) { + draw_ellipse_object (pi, GL_LABEL_ELLIPSE(object)); + } else if (GL_IS_LABEL_IMAGE(object)) { + draw_image_object (pi, GL_LABEL_IMAGE(object)); + } else if (GL_IS_LABEL_BARCODE(object)) { + draw_barcode_object (pi, GL_LABEL_BARCODE(object), + record); + } + + } + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw text object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_text_object (PrintInfo * pi, + glLabelText * object, + glMergeRecord * record) +{ + GnomeFont *font; + gchar **line; + gint i; + gdouble w; + gdouble x_offset, y_offset; + gdouble x, y; + gdouble x0, y0; + gchar *text; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + GnomeGlyphList *glyphlist; + ArtDRect bbox; + gdouble affine[6]; + + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x0, &y0); + lines = gl_label_text_get_lines (object); + gl_label_text_get_props (object, + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + font = gnome_font_find_closest_from_weight_slant ( + font_family, + font_weight, + font_italic_flag, + font_size); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, ALPHA (color)); + + text = gl_text_node_lines_expand (lines, record); + line = g_strsplit (text, "\n", -1); + g_free (text); + + art_affine_identity (affine); + + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, color, + 0.0, 0.0, + line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + w = bbox.x1; + + switch (just) { + case GTK_JUSTIFY_LEFT: + x_offset = 0.0; + break; + case GTK_JUSTIFY_CENTER: + x_offset = -w / 2.0; + break; + case GTK_JUSTIFY_RIGHT: + x_offset = -w; + break; + default: + x_offset = 0.0; + break; /* shouldn't happen */ + } + + y_offset = (i + 1) * font_size + + gnome_font_get_descender (font); + + x = x0 + x_offset; + y = y0 + y_offset; + gnome_print_moveto (pi->pc, x, y); + + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, line[i]); + gnome_print_grestore (pi->pc); + } + + g_strfreev (line); + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw box object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_box_object (PrintInfo * pi, + glLabelBox * object) +{ + gdouble x, y, w, h; + gdouble line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width (object); + line_color = gl_label_box_get_line_color (object); + fill_color = gl_label_box_get_fill_color (object); + + /* Paint fill color */ + create_rectangle_path (pi->pc, x, y, w, h); + gnome_print_setrgbcolor (pi->pc, + RED (fill_color), + GREEN (fill_color), + BLUE (fill_color)); + gnome_print_setopacity (pi->pc, ALPHA (fill_color)); + gnome_print_fill (pi->pc); + + /* Draw outline */ + create_rectangle_path (pi->pc, x, y, w, h); + gnome_print_setrgbcolor (pi->pc, + RED (line_color), + GREEN (line_color), + BLUE (line_color)); + gnome_print_setopacity (pi->pc, ALPHA (line_color)); + gnome_print_setlinewidth (pi->pc, line_width); + gnome_print_stroke (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw line object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_line_object (PrintInfo * pi, + glLabelLine * object) +{ + gdouble x, y, w, h; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width (object); + line_color = gl_label_line_get_line_color (object); + + gnome_print_moveto (pi->pc, x, y); + gnome_print_lineto (pi->pc, x + w, y + h); + gnome_print_setrgbcolor (pi->pc, + RED (line_color), + GREEN (line_color), + BLUE (line_color)); + gnome_print_setopacity (pi->pc, ALPHA (line_color)); + gnome_print_setlinewidth (pi->pc, line_width); + gnome_print_stroke (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw ellipse object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_ellipse_object (PrintInfo * pi, + glLabelEllipse * object) +{ + gdouble x, y, x0, y0, rx, ry, w, h; + gdouble line_width; + guint line_color, fill_color; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width (object); + line_color = gl_label_ellipse_get_line_color (object); + fill_color = gl_label_ellipse_get_fill_color (object); + + rx = w / 2.0; + ry = h / 2.0; + x0 = x + rx; + y0 = y + ry; + + /* Paint fill color */ + create_ellipse_path (pi->pc, x0, y0, rx, ry); + gnome_print_setrgbcolor (pi->pc, + RED (fill_color), + GREEN (fill_color), + BLUE (fill_color)); + gnome_print_setopacity (pi->pc, ALPHA (fill_color)); + gnome_print_fill (pi->pc); + + /* Draw outline */ + create_ellipse_path (pi->pc, x0, y0, rx, ry); + gnome_print_setrgbcolor (pi->pc, + RED (line_color), + GREEN (line_color), + BLUE (line_color)); + gnome_print_setopacity (pi->pc, ALPHA (line_color)); + gnome_print_setlinewidth (pi->pc, line_width); + gnome_print_stroke (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw image object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_image_object (PrintInfo * pi, + glLabelImage * object) +{ + gdouble x, y, w, h; + const GdkPixbuf *pixbuf; + guchar *image_data; + gint image_w, image_h, image_stride; + gboolean image_alpha_flag; + gint ret; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + + pixbuf = gl_label_image_get_pixbuf (object); + image_data = gdk_pixbuf_get_pixels (pixbuf); + image_w = gdk_pixbuf_get_width (pixbuf); + image_h = gdk_pixbuf_get_height (pixbuf); + image_stride = gdk_pixbuf_get_rowstride(pixbuf); + image_alpha_flag = gdk_pixbuf_get_has_alpha(pixbuf); + + gnome_print_gsave (pi->pc); + gnome_print_translate (pi->pc, x, y+h); + gnome_print_scale (pi->pc, w, -h); + if (image_alpha_flag) { + ret = gnome_print_rgbaimage (pi->pc, image_data, + image_w, image_h, image_stride); + gl_debug (DEBUG_PRINT, "Ret a = %d", ret); + } else { + ret = gnome_print_rgbimage (pi->pc, image_data, + image_w, image_h, image_stride); + gl_debug (DEBUG_PRINT, "Ret = %d", ret); + } + gnome_print_grestore (pi->pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw box object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_barcode_object (PrintInfo * pi, + glLabelBarcode * object, + glMergeRecord * record) +{ + glBarcode *gbc; + glBarcodeLine *line; + glBarcodeChar *bchar; + GList *li; + gdouble x, y, y_offset; + GnomeFont *font; + gchar *text, *cstring; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + gl_debug (DEBUG_PRINT, "START"); + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + text_node = gl_label_barcode_get_data (object); + gl_label_barcode_get_props (object, + &style, &text_flag, &color, &scale); + + text = gl_text_node_expand (text_node, record); + gbc = gl_barcode_new (style, text_flag, scale, text); + g_free (text); + gl_text_node_free (&text_node); + + if (gbc == NULL) { + + font = gnome_font_find_closest_from_weight_slant ( + GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, 12.0); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, + ALPHA (color)); + + y_offset = 12.0 - gnome_font_get_descender (font); + gnome_print_moveto (pi->pc, x, y + y_offset); + + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, _("Invalid barcode")); + gnome_print_grestore (pi->pc); + + } else { + + for (li = gbc->lines; li != NULL; li = li->next) { + line = (glBarcodeLine *) li->data; + + gnome_print_moveto (pi->pc, x + line->x, y + line->y); + gnome_print_lineto (pi->pc, x + line->x, + y + line->y + line->length); + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, + ALPHA (color)); + gnome_print_setlinewidth (pi->pc, line->width); + gnome_print_stroke (pi->pc); + } + + for (li = gbc->chars; li != NULL; li = li->next) { + bchar = (glBarcodeChar *) li->data; + + font = gnome_font_find_closest_from_weight_slant ( + GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, bchar->fsize); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (color), + GREEN (color), + BLUE (color)); + gnome_print_setopacity (pi->pc, + ALPHA (color)); + + y_offset = + bchar->y + bchar->fsize - + gnome_font_get_descender (font); + gnome_print_moveto (pi->pc, x + bchar->x, y + y_offset); + + cstring = g_strdup_printf ("%c", bchar->c); + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, cstring); + gnome_print_grestore (pi->pc); + g_free (cstring); + + } + + gl_barcode_free (&gbc); + + } + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw outline. */ +/*---------------------------------------------------------------------------*/ +static void +draw_outline (PrintInfo * pi, + glLabel * label) +{ + gdouble w, h, r; + gdouble r1, r2; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + gnome_print_setrgbcolor (pi->pc, 0.25, 0.25, 0.25); + gnome_print_setopacity (pi->pc, 1.0); + gnome_print_setlinewidth (pi->pc, 0.25); + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + gl_label_get_size (label, &w, &h); + r = template->label_round; + if (r == 0.0) { + /* simple rectangle */ + create_rectangle_path (pi->pc, 0.0, 0.0, w, h); + } else { + /* rectangle with rounded corners */ + create_rounded_rectangle_path (pi->pc, 0.0, 0.0, + w, h, r); + } + gnome_print_stroke (pi->pc); + break; + + case GL_TEMPLATE_STYLE_ROUND: + /* Round style */ + r1 = template->label_radius; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_stroke (pi->pc); + break; + + case GL_TEMPLATE_STYLE_CD: + /* CD style, round label w/ concentric round hole */ + r1 = template->label_radius; + r2 = template->label_hole; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_stroke (pi->pc); + create_ellipse_path (pi->pc, r1, r1, r2, r2); + gnome_print_stroke (pi->pc); + break; + + default: + g_warning ("Unknown template label style"); + break; + } + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Clip to outline. */ +/*---------------------------------------------------------------------------*/ +static void +clip_to_outline (PrintInfo * pi, + glLabel * label) +{ + gdouble w, h, r; + gdouble r1; + glTemplate *template; + + gl_debug (DEBUG_PRINT, "START"); + + template = gl_label_get_template (label); + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + gl_label_get_size (label, &w, &h); + r = template->label_round; + if (r == 0.0) { + /* simple rectangle */ + create_rectangle_path (pi->pc, 0.0, 0.0, w, h); + } else { + /* rectangle with rounded corners */ + create_rounded_rectangle_path (pi->pc, 0.0, 0.0, + w, h, r); + } + gnome_print_clip (pi->pc); + break; + + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + r1 = template->label_radius; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_clip (pi->pc); + break; + + default: + g_warning ("Unknown template label style"); + break; + } + + gl_template_free (&template); + + gl_debug (DEBUG_PRINT, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Path creation utilities. */ +/*---------------------------------------------------------------------------*/ +static void +create_rectangle_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble w, + gdouble h) +{ + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_newpath (pc); + gnome_print_moveto (pc, x0, y0); + gnome_print_lineto (pc, x0 + w, y0); + gnome_print_lineto (pc, x0 + w, y0 + h); + gnome_print_lineto (pc, x0, y0 + h); + gnome_print_lineto (pc, x0, y0); + gnome_print_closepath (pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +static void +create_ellipse_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble rx, + gdouble ry) +{ + gdouble x, y; + gint i_theta; + + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_newpath (pc); + gnome_print_moveto (pc, x0 + rx, y0); + for (i_theta = 2; i_theta <= 360; i_theta += 2) { + x = x0 + rx * cos (i_theta * M_PI / 180.0); + y = y0 + ry * sin (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + gnome_print_closepath (pc); + + gl_debug (DEBUG_PRINT, "END"); +} + +static void +create_rounded_rectangle_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble w, + gdouble h, + gdouble r) +{ + gdouble x, y; + gint i_theta; + + gl_debug (DEBUG_PRINT, "START"); + + gnome_print_newpath (pc); + + gnome_print_moveto (pc, x0 + r, y0); + for (i_theta = 5; i_theta <= 90; i_theta += 5) { + x = x0 + r - r * sin (i_theta * M_PI / 180.0); + y = y0 + r - r * cos (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + x = x0 + r - r * cos (i_theta * M_PI / 180.0); + y = y0 + (h - r) + r * sin (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + x = x0 + (w - r) + r * sin (i_theta * M_PI / 180.0); + y = y0 + (h - r) + r * cos (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + x = x0 + (w - r) + r * cos (i_theta * M_PI / 180.0); + y = y0 + r - r * sin (i_theta * M_PI / 180.0); + gnome_print_lineto (pc, x, y); + } + gnome_print_lineto (pc, x0 + r, y0); + + gnome_print_closepath (pc); + + gl_debug (DEBUG_PRINT, "END"); +} diff --git a/glabels2/src/print.h b/glabels2/src/print.h new file mode 100644 index 0000000..b79e5c5 --- /dev/null +++ b/glabels2/src/print.h @@ -0,0 +1,53 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.h: Print module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PRINT_H__ +#define __PRINT_H__ + +#include <gnome.h> +#include <libgnomeprint/gnome-print-master.h> +#include <libgnomeprintui/gnome-print-master-preview.h> +#include "label.h" + +extern void gl_print_simple (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint first, gint last, + gboolean outline_flag, gboolean reverse_flag); + +extern void gl_print_merge_collated (GnomePrintMaster * master, + glLabel * label, + GList *record_list, + gint n_copies, gint first, + gboolean outline_flag, + gboolean reverse_flag); + +extern void gl_print_merge_uncollated (GnomePrintMaster * master, + glLabel * label, + GList *record_list, + gint n_copies, gint first, + gboolean outline_flag, + gboolean reverse_flag); + +extern void gl_print_batch (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint n_copies, + gboolean outline_flag, gboolean reverse_flag); + + +#endif diff --git a/glabels2/src/recent.c b/glabels2/src/recent.c new file mode 100644 index 0000000..6e0e40d --- /dev/null +++ b/glabels2/src/recent.c @@ -0,0 +1,45 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * recent.c: gLabels recent files module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <config.h> + + +#include "recent.h" +#include "prefs.h" + +#include "debug.h" + +static GnomeRecentModel *model; + + +GnomeRecentModel * +gl_recent_get_model (void) +{ + return model; +} + +void +gl_recent_init (void) +{ + gl_debug (DEBUG_RECENT, "max_recents = %d", gl_prefs->max_recents); + + model = gnome_recent_model_new ("glabels", gl_prefs->max_recents); +} diff --git a/glabels2/src/recent.h b/glabels2/src/recent.h new file mode 100644 index 0000000..0be911d --- /dev/null +++ b/glabels2/src/recent.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * recent.h: gLabels recent files module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __RECENT_H__ +#define __RECENT_H__ + +#include "gnome-recent-model.h" + + +GnomeRecentModel * gl_recent_get_model (void); +void gl_recent_init (void); + +#endif /*__RECENT_H__*/ + diff --git a/glabels2/src/splash.c b/glabels2/src/splash.c new file mode 100644 index 0000000..1812455 --- /dev/null +++ b/glabels2/src/splash.c @@ -0,0 +1,115 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * splash.c: Splash screen module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include <gtk/gtk.h> +#include <libgnome/libgnome.h> + +#include "splash.h" + +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define SPLASH_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-logo.png") +#else +#define SPLASH_PIXMAP gnome_pixmap_file("glabels/glabels-logo.png") +#endif + +#define SPLASH_TIMEOUT 2000 + +static GtkWidget *splash = NULL; + +static gint splash_timeout (gpointer not_used); + + +/***************************************************************************/ +/* Create splash screen. */ +/***************************************************************************/ +void +gl_splash (void) +{ + GtkWidget *wimage, *wvbox, *whbox, *wframe1, *wframe2; + gchar *label; + GdkPixbuf *pixbuf; + GError *gerror = NULL; + + if (splash) + return; + + splash = gtk_window_new (GTK_WINDOW_POPUP); + gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER); + + wframe1 = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (wframe1), GTK_SHADOW_OUT); + wframe2 = gtk_frame_new (NULL); + + wvbox = gtk_vbox_new (FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 2); + + whbox = gtk_hbox_new (FALSE, 5); + + if (!g_file_test (SPLASH_PIXMAP, G_FILE_TEST_EXISTS)) { + g_warning ("Could not find %s", SPLASH_PIXMAP); + } + pixbuf = gdk_pixbuf_new_from_file (SPLASH_PIXMAP, &gerror); + if (gerror != NULL) { + g_warning ("cannot open splash pixbuf: %s", gerror->message ); + gtk_widget_destroy (splash); + return; + } + wimage = gtk_image_new_from_pixbuf (pixbuf); + + gtk_container_add (GTK_CONTAINER (splash), wframe1); + gtk_container_add (GTK_CONTAINER (wframe1), wframe2); + gtk_container_add (GTK_CONTAINER (wframe2), wvbox); + + gtk_box_pack_start (GTK_BOX (wvbox), wimage, TRUE, TRUE, 0); + + label = g_strdup_printf ("Version %s", VERSION); + gtk_box_pack_start (GTK_BOX (wvbox), + gtk_label_new (label), TRUE, TRUE, 0); + g_free (label); + + gtk_widget_show_all (splash); + + gtk_timeout_add (SPLASH_TIMEOUT, splash_timeout, NULL); + + while (gtk_events_pending ()) { + gtk_main_iteration (); + } +} + +/*-------------------------------------------------------------------------*/ +/* PRIVATE. Callback to tear-down splash screen once timer has expired. */ +/*-------------------------------------------------------------------------*/ +static gint +splash_timeout (gpointer not_used) +{ + if (splash) { + gtk_widget_destroy (splash); + splash = NULL; + } + + return FALSE; +} + diff --git a/glabels2/src/splash.h b/glabels2/src/splash.h new file mode 100644 index 0000000..25cd5b6 --- /dev/null +++ b/glabels2/src/splash.h @@ -0,0 +1,28 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * splash.c: Splash screen module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __SPLASH_H__ +#define __SPLASH_H__ + +void gl_splash (void); + +#endif diff --git a/glabels2/src/stock-pixmaps/Makefile.am b/glabels2/src/stock-pixmaps/Makefile.am new file mode 100644 index 0000000..fde0115 --- /dev/null +++ b/glabels2/src/stock-pixmaps/Makefile.am @@ -0,0 +1,30 @@ + +IMAGES = \ + stock_arrow_24.png \ + stock_barcode_24.png \ + stock_box_24.png \ + stock_ellipse_24.png \ + stock_image_24.png \ + stock_line_24.png \ + stock_merge_24.png \ + stock_text_24.png + +VARIABLES1 = \ + stock_arrow_24 $(srcdir)/stock_arrow_24.png \ + stock_barcode_24 $(srcdir)/stock_barcode_24.png \ + stock_box_24 $(srcdir)/stock_box_24.png \ + stock_ellipse_24 $(srcdir)/stock_ellipse_24.png \ + stock_image_24 $(srcdir)/stock_image_24.png \ + stock_line_24 $(srcdir)/stock_line_24.png \ + stock_merge_24 $(srcdir)/stock_merge_24.png \ + stock_text_24 $(srcdir)/stock_text_24.png + +noinst_DATA = stockpixbufs.h +CLEANFILES = $(noinst_DATA) + +stockpixbufs.h: $(IMAGES) + gdk-pixbuf-csource \ + --raw --build-list $(VARIABLES1) > $(srcdir)/stockpixbufs.h || \ + ( rm -f $(srcdir)/stockpixbufs.h && false ) + +EXTRA_DIST = $(IMAGES) stockpixbufs.h diff --git a/glabels2/src/stock-pixmaps/Makefile.in b/glabels2/src/stock-pixmaps/Makefile.in new file mode 100644 index 0000000..0a6dfe9 --- /dev/null +++ b/glabels2/src/stock-pixmaps/Makefile.in @@ -0,0 +1,207 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLABELS_CFLAGS = @GLABELS_CFLAGS@ +GLABELS_LIBS = @GLABELS_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_INTERFACE_VERSION = @GNOME_INTERFACE_VERSION@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +cxxflags_set = @cxxflags_set@ + +IMAGES = stock_arrow_24.png stock_barcode_24.png stock_box_24.png stock_ellipse_24.png stock_image_24.png stock_line_24.png stock_merge_24.png stock_text_24.png + + +VARIABLES1 = stock_arrow_24 $(srcdir)/stock_arrow_24.png stock_barcode_24 $(srcdir)/stock_barcode_24.png stock_box_24 $(srcdir)/stock_box_24.png stock_ellipse_24 $(srcdir)/stock_ellipse_24.png stock_image_24 $(srcdir)/stock_image_24.png stock_line_24 $(srcdir)/stock_line_24.png stock_merge_24 $(srcdir)/stock_merge_24.png stock_text_24 $(srcdir)/stock_text_24.png + + +noinst_DATA = stockpixbufs.h +CLEANFILES = $(noinst_DATA) + +EXTRA_DIST = $(IMAGES) stockpixbufs.h +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DATA = $(noinst_DATA) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/stock-pixmaps/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/stock-pixmaps + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +stockpixbufs.h: $(IMAGES) + gdk-pixbuf-csource \ + --raw --build-list $(VARIABLES1) > $(srcdir)/stockpixbufs.h || \ + ( rm -f $(srcdir)/stockpixbufs.h && false ) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/glabels2/src/stock-pixmaps/stock_arrow_24.png b/glabels2/src/stock-pixmaps/stock_arrow_24.png Binary files differnew file mode 100644 index 0000000..fcd7e57 --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_arrow_24.png diff --git a/glabels2/src/stock-pixmaps/stock_barcode_24.png b/glabels2/src/stock-pixmaps/stock_barcode_24.png Binary files differnew file mode 100644 index 0000000..f92e5d7 --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_barcode_24.png diff --git a/glabels2/src/stock-pixmaps/stock_box_24.png b/glabels2/src/stock-pixmaps/stock_box_24.png Binary files differnew file mode 100644 index 0000000..a3aadbe --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_box_24.png diff --git a/glabels2/src/stock-pixmaps/stock_ellipse_24.png b/glabels2/src/stock-pixmaps/stock_ellipse_24.png Binary files differnew file mode 100644 index 0000000..8ff2494 --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_ellipse_24.png diff --git a/glabels2/src/stock-pixmaps/stock_image_24.png b/glabels2/src/stock-pixmaps/stock_image_24.png Binary files differnew file mode 100644 index 0000000..dbf2526 --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_image_24.png diff --git a/glabels2/src/stock-pixmaps/stock_line_24.png b/glabels2/src/stock-pixmaps/stock_line_24.png Binary files differnew file mode 100644 index 0000000..ec4161e --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_line_24.png diff --git a/glabels2/src/stock-pixmaps/stock_merge_24.png b/glabels2/src/stock-pixmaps/stock_merge_24.png Binary files differnew file mode 100644 index 0000000..9462292 --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_merge_24.png diff --git a/glabels2/src/stock-pixmaps/stock_text_24.png b/glabels2/src/stock-pixmaps/stock_text_24.png Binary files differnew file mode 100644 index 0000000..7be40b4 --- /dev/null +++ b/glabels2/src/stock-pixmaps/stock_text_24.png diff --git a/glabels2/src/stock.c b/glabels2/src/stock.c new file mode 100644 index 0000000..653a68c --- /dev/null +++ b/glabels2/src/stock.c @@ -0,0 +1,137 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * stock.h: Stock image module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> +#include <gnome.h> +#include <gdk-pixbuf/gdk-pixdata.h> +#include "stock.h" +#include "stock-pixmaps/stockpixbufs.h" + +void +gl_stock_init (void) +{ + GdkPixbuf *pixbuf; + GtkIconFactory *factory; + GtkIconSet *icon_set; + GdkPixdata *pixdata; + + static GtkStockItem items[] = { + { GL_STOCK_ARROW, "Arrow", 0, 0, NULL }, + { GL_STOCK_TEXT, "Text", 0, 0, NULL }, + { GL_STOCK_LINE, "Line", 0, 0, NULL }, + { GL_STOCK_BOX, "Box", 0, 0, NULL }, + { GL_STOCK_ELLIPSE, "Ellipse", 0, 0, NULL }, + { GL_STOCK_IMAGE, "Image", 0, 0, NULL }, + { GL_STOCK_BARCODE, "Barcode", 0, 0, NULL }, + { GL_STOCK_MERGE, "Merge", 0, 0, NULL }, + }; + + gtk_stock_add (items, G_N_ELEMENTS (items)); + + factory = gtk_icon_factory_new (); + gtk_icon_factory_add_default (factory); + + pixdata = g_new0 (GdkPixdata, 1); + + /* Arrow */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_arrow_24), stock_arrow_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_ARROW, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Text */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_text_24), stock_text_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_TEXT, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Line */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_line_24), stock_line_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_LINE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Box */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_box_24), stock_box_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_BOX, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Ellipse */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_ellipse_24), stock_ellipse_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_ELLIPSE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Image */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_image_24), stock_image_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_IMAGE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Barcode */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_barcode_24), stock_barcode_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_BARCODE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + /* Merge */ + gdk_pixdata_deserialize (pixdata, + sizeof(stock_merge_24), stock_merge_24, + NULL); + pixbuf = gdk_pixbuf_from_pixdata (pixdata, FALSE, NULL); + icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); + gtk_icon_factory_add (factory, GL_STOCK_MERGE, icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT(pixbuf)); + + g_free (pixdata); + g_object_unref (G_OBJECT(factory)); +} diff --git a/glabels2/src/stock.h b/glabels2/src/stock.h new file mode 100644 index 0000000..c24f577 --- /dev/null +++ b/glabels2/src/stock.h @@ -0,0 +1,39 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * stock.h: Stock image module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __STOCK_H__ +#define __STOCK_H__ + +/* Stock names */ + +#define GL_STOCK_ARROW "gl_stock_arrow" +#define GL_STOCK_TEXT "gl_stock_text" +#define GL_STOCK_LINE "gl_stock_line" +#define GL_STOCK_BOX "gl_stock_box" +#define GL_STOCK_ELLIPSE "gl_stock_ellipse" +#define GL_STOCK_IMAGE "gl_stock_image" +#define GL_STOCK_BARCODE "gl_stock_barcode" +#define GL_STOCK_MERGE "gl_stock_merge" + +void gl_stock_init (void); + +#endif diff --git a/glabels2/src/template.c b/glabels2/src/template.c new file mode 100644 index 0000000..5562786 --- /dev/null +++ b/glabels2/src/template.c @@ -0,0 +1,804 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * template.c: template module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <string.h> +#include <libgnomeprint/gnome-print-paper.h> + +#include "template.h" + +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define GL_DATA_DIR (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "glabels") +#else +#define GL_DATA_DIR gnome_datadir_file("glabels") +#endif + +#define FULL_PAGE "Full-page" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GList *templates = NULL; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ +static glTemplate *template_full_page (const gchar *page_size); + +static GList *read_templates (void); + +static gchar *get_home_data_dir (void); +static GList *read_template_files_from_dir (GList * templates, + const gchar * dirname); +static GList *read_templates_from_file (GList * templates, + gchar * xml_filename); + +static void xml_parse_label (xmlNodePtr label_node, glTemplate * template); +static void xml_parse_layout (xmlNodePtr layout_node, glTemplate * template); +static void xml_parse_markup (xmlNodePtr markup_node, glTemplate * template); +static void xml_parse_alias (xmlNodePtr alias_node, glTemplate * template); + +static void xml_add_label (glTemplate *template, xmlNodePtr root, xmlNsPtr ns); +static void xml_add_layout (glTemplate *template, xmlNodePtr root, xmlNsPtr ns); +static void xml_add_markup_margin (glTemplate *template, xmlNodePtr root, xmlNsPtr ns); +static void xml_add_alias (gchar *name, xmlNodePtr root, xmlNsPtr ns); + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_template_init (void) +{ + GList *page_sizes, *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + templates = read_templates (); + + page_sizes = gl_template_get_page_size_list (); + for ( p=page_sizes; p != NULL; p=p->next ) { + templates = g_list_append (templates, + template_full_page (p->data)); + } + gl_template_free_page_size_list (&page_sizes); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*****************************************************************************/ +/* Get a list of valid page size names */ +/*****************************************************************************/ +GList * +gl_template_get_page_size_list (void) +{ + GList *names = NULL; + GList *p, *paper_list; + GnomePrintPaper *paper; + + gl_debug (DEBUG_TEMPLATE, "START"); + + paper_list = gnome_print_paper_get_list(); + for ( p=paper_list; p != NULL; p=p->next ) { + paper = (GnomePrintPaper *)p->data; + if ( g_strcasecmp(paper->name, "custom") != 0 ) { + names = g_list_append (names, g_strdup (paper->name)); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); + return names; +} + +/*****************************************************************************/ +/* Free a list of page size names. */ +/*****************************************************************************/ +void +gl_template_free_page_size_list (GList ** names) +{ + GList *p_name; + + gl_debug (DEBUG_TEMPLATE, "START"); + + for (p_name = *names; p_name != NULL; p_name = p_name->next) { + g_free (p_name->data); + p_name->data = NULL; + } + + g_list_free (*names); + *names = NULL; + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*****************************************************************************/ +/* Get a list of valid template names for given page size */ +/*****************************************************************************/ +GList * +gl_template_get_name_list (const gchar * page_size) +{ + GList *p_tmplt, *p_name; + glTemplate *template; + gchar *str; + GList *names = NULL; + + gl_debug (DEBUG_TEMPLATE, "START"); + + for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { + template = (glTemplate *) p_tmplt->data; + if (g_strcasecmp (page_size, template->page_size) == 0) { + for (p_name = template->name; p_name != NULL; + p_name = p_name->next) { + str = g_strdup_printf("%s: %s", + (gchar *) p_name->data, + template->description); + names = g_list_insert_sorted (names, str, + (GCompareFunc)g_strcasecmp); + } + } + } + + gl_debug (DEBUG_TEMPLATE, "templates = %p", templates); + gl_debug (DEBUG_TEMPLATE, "names = %p", names); + + gl_debug (DEBUG_TEMPLATE, "END"); + return names; +} + +/*****************************************************************************/ +/* Free a list of template names. */ +/*****************************************************************************/ +void +gl_template_free_name_list (GList ** names) +{ + GList *p_name; + + gl_debug (DEBUG_TEMPLATE, "START"); + + for (p_name = *names; p_name != NULL; p_name = p_name->next) { + g_free (p_name->data); + p_name->data = NULL; + } + + g_list_free (*names); + *names = NULL; + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*****************************************************************************/ +/* Return a template structure from a name. */ +/*****************************************************************************/ +glTemplate * +gl_template_from_name (const gchar * name) +{ + GList *p_tmplt, *p_name; + glTemplate *template; + gchar **split_name; + + gl_debug (DEBUG_TEMPLATE, "START"); + + if (name == NULL) { + /* If no name, return first template as a default */ + return (glTemplate *) templates->data; + } + + split_name = g_strsplit (name, ":", 2); + + for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { + template = (glTemplate *) p_tmplt->data; + for (p_name = template->name; p_name != NULL; + p_name = p_name->next) { + if (g_strcasecmp (p_name->data, split_name[0]) == 0) { + g_strfreev (split_name); + gl_debug (DEBUG_TEMPLATE, "END"); + return gl_template_dup (template); + } + } + } + + g_strfreev (split_name); + + gl_debug (DEBUG_TEMPLATE, "END"); + return NULL; +} + +/*****************************************************************************/ +/* Copy a template. */ +/*****************************************************************************/ +glTemplate *gl_template_dup (const glTemplate *orig_template) +{ + glTemplate *template; + GList *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + template = g_new0 (glTemplate,1); + + /* Shallow copy first */ + *template = *orig_template; + + /* Now the deep stuff */ + template->name = NULL; + for ( p=orig_template->name; p != NULL; p=p->next ) { + template->name = g_list_append (template->name, + g_strdup (p->data)); + } + template->description = g_strdup (orig_template->description); + template->page_size = g_strdup (orig_template->page_size); + + gl_debug (DEBUG_TEMPLATE, "END"); + return template; +} + +/*****************************************************************************/ +/* Free up a template. */ +/*****************************************************************************/ +void gl_template_free (glTemplate **template) +{ + GList *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + if ( *template != NULL ) { + + for ( p=(*template)->name; p != NULL; p=p->next ) { + g_free (p->data); + p->data = NULL; + } + g_list_free ((*template)->name); + (*template)->name = NULL; + + g_free ((*template)->description); + (*template)->description = NULL; + + g_free ((*template)->page_size); + (*template)->page_size = NULL; + + g_free (*template); + *template = NULL; + + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Make a template for a full page of the given page size. */ +/*--------------------------------------------------------------------------*/ +static glTemplate * +template_full_page (const gchar *page_size) +{ + const GnomePrintPaper *paper; + glTemplate *template; + + paper = gnome_print_paper_get_by_name (page_size); + if ( paper == NULL ) { + return NULL; + } + + template = g_new0 (glTemplate, 1); + + template->name = g_list_append (template->name, + g_strdup_printf("*%s", page_size)); + template->page_size = g_strdup(page_size); + template->description = g_strdup(FULL_PAGE); + + template->style = GL_TEMPLATE_STYLE_RECT; + + template->nx = 1; + template->ny = 1; + + template->label_width = paper->width; + template->label_height = paper->height; + template->label_round = 0.0; + + template->label_margin = 5.0; + + return template; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read templates from various files. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_templates (void) +{ + gchar *home_data_dir = get_home_data_dir (); + GList *templates = NULL; + + gl_debug (DEBUG_TEMPLATE, "START"); + + LIBXML_TEST_VERSION; + + templates = read_template_files_from_dir (templates, GL_DATA_DIR); + templates = read_template_files_from_dir (templates, home_data_dir); + + g_free (home_data_dir); + + if (templates == NULL) { + g_warning (_("No template files found!")); + } + + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. get '~/.glabels' directory path. */ +/*--------------------------------------------------------------------------*/ +static gchar * +get_home_data_dir (void) +{ + gchar *dir = gnome_util_prepend_user_home (".glabels"); + + gl_debug (DEBUG_TEMPLATE, "START"); + + /* Try to create ~/.glabels directory. If it exists, no problem. */ + mkdir (dir, 0775); + + gl_debug (DEBUG_TEMPLATE, "END"); + return dir; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read all template files from given directory. Append to list. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_template_files_from_dir (GList * templates, + const gchar * dirname) +{ + GDir *dp; + const gchar *filename, *extension; + gchar *full_filename = NULL; + GError *gerror = NULL; + + gl_debug (DEBUG_TEMPLATE, "START"); + + if (dirname == NULL) + return templates; + + dp = g_dir_open (dirname, 0, &gerror); + if (gerror != NULL) { + g_warning ("cannot open data directory: %s", gerror->message ); + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; + } + + while ((filename = g_dir_read_name (dp)) != NULL) { + + extension = strrchr (filename, '.'); + + if (extension != NULL) { + + if (strcasecmp (extension, ".template") == 0) { + + full_filename = + g_build_filename (dirname, filename, NULL); + templates = + read_templates_from_file (templates, + full_filename); + g_free (full_filename); + + } + + } + + } + + g_dir_close (dp); + + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read templates from template file. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_templates_from_file (GList * templates, + gchar * xml_filename) +{ + xmlDocPtr doc; + xmlNodePtr root, node; + glTemplate *template; + + gl_debug (DEBUG_TEMPLATE, "START"); + + doc = xmlParseFile (xml_filename); + if (!doc) { + g_warning ("\"%s\" is not a glabels template file (not XML)", + xml_filename); + return templates; + } + + root = xmlDocGetRootElement (doc); + if (!root || !root->name) { + g_warning ("\"%s\" is not a glabels template file (no root node)", + xml_filename); + xmlFreeDoc (doc); + return templates; + } + if (g_strcasecmp (root->name, "glabels-templates") != 0) { + g_warning ("\"%s\" is not a glabels template file (wrong root node)", + xml_filename); + xmlFreeDoc (doc); + return templates; + } + + for (node = root->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Sheet") == 0) { + template = gl_template_xml_parse_sheet (node); + templates = g_list_append (templates, template); + } else { + if ( !xmlNodeIsText(node) ) { + if (g_strcasecmp (node->name,"comment") != 0) { + g_warning ("bad node = \"%s\"",node->name); + } + } + } + } + + xmlFreeDoc (doc); + + gl_debug (DEBUG_TEMPLATE, "END"); + return templates; +} + +/*****************************************************************************/ +/* Parse XML template Node. */ +/*****************************************************************************/ +glTemplate * +gl_template_xml_parse_sheet (xmlNodePtr sheet_node) +{ + glTemplate *template; + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + template = g_new0 (glTemplate, 1); + + template->name = g_list_append (template->name, + xmlGetProp (sheet_node, "name")); + template->page_size = xmlGetProp (sheet_node, "size"); + if ( strcmp (template->page_size,"US-Letter") == 0 ) { + /* Compatibility with old pre-1.0 template files.*/ + template->page_size = "US Letter"; + } + template->description = xmlGetProp (sheet_node, "description"); + + for (node = sheet_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "Label") == 0) { + xml_parse_label (node, template); + } else if (g_strcasecmp (node->name, "Alias") == 0) { + xml_parse_alias (node, template); + } else { + if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); + + return template; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_label (xmlNodePtr label_node, + glTemplate * template) +{ + xmlNodePtr node; + gchar *style; + + gl_debug (DEBUG_TEMPLATE, "START"); + + style = xmlGetProp (label_node, "style"); + if (g_strcasecmp (style, "rectangle") == 0) { + template->style = GL_TEMPLATE_STYLE_RECT; + } else if (g_strcasecmp (style, "round") == 0) { + template->style = GL_TEMPLATE_STYLE_ROUND; + } else if (g_strcasecmp (style, "cd") == 0) { + template->style = GL_TEMPLATE_STYLE_CD; + } else { + g_warning ("Unknown label style in template"); + } + + if (template->style == GL_TEMPLATE_STYLE_RECT) { + template->label_width = + g_strtod (xmlGetProp (label_node, "width"), NULL); + template->label_height = + g_strtod (xmlGetProp (label_node, "height"), NULL); + template->label_round = + g_strtod (xmlGetProp (label_node, "round"), NULL); + } else if (template->style == GL_TEMPLATE_STYLE_ROUND) { + template->label_radius = + g_strtod (xmlGetProp (label_node, "radius"), NULL); + template->label_width = 2.0 * template->label_radius; + template->label_height = 2.0 * template->label_radius; + } else if (template->style == GL_TEMPLATE_STYLE_CD) { + template->label_radius = + g_strtod (xmlGetProp (label_node, "radius"), NULL); + template->label_hole = + g_strtod (xmlGetProp (label_node, "hole"), NULL); + template->label_width = 2.0 * template->label_radius; + template->label_height = 2.0 * template->label_radius; + } + + for (node = label_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "Layout") == 0) { + xml_parse_layout (node, template); + } else if (g_strcasecmp (node->name, "Markup") == 0) { + xml_parse_markup (node, template); + } else if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label->Layout Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_layout (xmlNodePtr layout_node, + glTemplate * template) +{ + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + sscanf (xmlGetProp (layout_node, "nx"), "%d", &(template->nx)); + sscanf (xmlGetProp (layout_node, "ny"), "%d", &(template->ny)); + template->x0 = g_strtod (xmlGetProp (layout_node, "x0"), NULL); + template->y0 = g_strtod (xmlGetProp (layout_node, "y0"), NULL); + template->dx = g_strtod (xmlGetProp (layout_node, "dx"), NULL); + template->dy = g_strtod (xmlGetProp (layout_node, "dy"), NULL); + + for (node = layout_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label->Markup Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_markup (xmlNodePtr markup_node, + glTemplate * template) +{ + gchar *type; + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + type = xmlGetProp (markup_node, "type"); + if (g_strcasecmp (type, "margin") == 0) { + template->label_margin = + g_strtod (xmlGetProp (markup_node, "size"), NULL); + } + + for (node = markup_node->xmlChildrenNode; node != NULL; + node = node->next) { + if (g_strcasecmp (node->name, "text") != 0) { + g_warning ("bad node = \"%s\"", node->name); + } + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Alias Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_alias (xmlNodePtr alias_node, + glTemplate * template) +{ + gl_debug (DEBUG_TEMPLATE, "START"); + + template->name = g_list_append (template->name, + xmlGetProp (alias_node, "name")); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/****************************************************************************/ +/* Add XML Template Node */ +/****************************************************************************/ +void +gl_template_xml_add_sheet (glTemplate * template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + GList *p; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild (root, ns, "Sheet", NULL); + + xmlSetProp (node, "name", template->name->data); + xmlSetProp (node, "size", template->page_size); + xmlSetProp (node, "description", template->description); + + xml_add_label (template, node, ns); + + for ( p=template->name->next; p != NULL; p=p->next ) { + xml_add_alias( p->data, node, ns ); + } + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_label (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild(root, ns, "Label", NULL); + + xmlSetProp (node, "id", "0"); + + switch (template->style) { + case GL_TEMPLATE_STYLE_RECT: + xmlSetProp (node, "style", "rectangle"); + string = g_strdup_printf ("%g", template->label_width); + xmlSetProp (node, "width", string); + g_free (string); + string = g_strdup_printf ("%g", template->label_height); + xmlSetProp (node, "height", string); + g_free (string); + string = g_strdup_printf ("%g", template->label_round); + xmlSetProp (node, "round", string); + g_free (string); + break; + case GL_TEMPLATE_STYLE_ROUND: + xmlSetProp (node, "style", "round"); + string = g_strdup_printf ("%g", template->label_radius); + xmlSetProp (node, "radius", string); + g_free (string); + break; + case GL_TEMPLATE_STYLE_CD: + xmlSetProp (node, "style", "cd"); + string = g_strdup_printf ("%g", template->label_radius); + xmlSetProp (node, "radius", string); + g_free (string); + string = g_strdup_printf ("%g", template->label_hole); + xmlSetProp (node, "hole", string); + g_free (string); + break; + default: + g_warning ("Unknown label style"); + break; + } + + xml_add_markup_margin (template, node, ns); + xml_add_layout (template, node, ns); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label->Layout Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_layout (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild(root, ns, "Layout", NULL); + string = g_strdup_printf ("%d", template->nx); + xmlSetProp (node, "nx", string); + g_free (string); + string = g_strdup_printf ("%d", template->ny); + xmlSetProp (node, "ny", string); + g_free (string); + string = g_strdup_printf ("%g", template->x0); + xmlSetProp (node, "x0", string); + g_free (string); + string = g_strdup_printf ("%g", template->y0); + xmlSetProp (node, "y0", string); + g_free (string); + string = g_strdup_printf ("%g", template->dx); + xmlSetProp (node, "dx", string); + g_free (string); + string = g_strdup_printf ("%g", template->dy); + xmlSetProp (node, "dy", string); + g_free (string); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label->Markup Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_markup_margin (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild(root, ns, "Markup", NULL); + xmlSetProp (node, "type", "margin"); + + string = g_strdup_printf ("%g", template->label_margin); + xmlSetProp (node, "size", string); + g_free (string); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Alias Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_alias (gchar *name, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + + gl_debug (DEBUG_TEMPLATE, "START"); + + node = xmlNewChild (root, ns, "Alias", NULL); + xmlSetProp (node, "name", name); + + gl_debug (DEBUG_TEMPLATE, "END"); +} + diff --git a/glabels2/src/template.h b/glabels2/src/template.h new file mode 100644 index 0000000..4ec025f --- /dev/null +++ b/glabels2/src/template.h @@ -0,0 +1,74 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * template.h: template module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __TEMPLATE_H__ +#define __TEMPLATE_H__ + +#include <libgnome/libgnome.h> +#include <libxml/tree.h> +#include <libxml/parser.h> + +typedef enum { + GL_TEMPLATE_STYLE_RECT, + GL_TEMPLATE_STYLE_ROUND, + GL_TEMPLATE_STYLE_CD, +} glTemplateStyle; + +typedef struct { + GList *name; + gchar *description; + gchar *page_size; + glTemplateStyle style; + + /* Suggested margin */ + gdouble label_margin; + + /* Simple and rounded rectangles. */ + gdouble label_width, label_height, label_round; + + /* CD/DVD labels */ + gdouble label_radius, label_hole; + + /* Layout */ + gint nx, ny; + gdouble x0, y0, dx, dy; +} glTemplate; + +extern void gl_template_init (void); + +extern GList *gl_template_get_page_size_list (void); +extern void gl_template_free_page_size_list (GList **sizes); + +extern GList *gl_template_get_name_list (const gchar *page_size); +extern void gl_template_free_name_list (GList **names); + +extern glTemplate *gl_template_from_name (const gchar * name); + +extern glTemplate *gl_template_dup (const glTemplate *orig); +extern void gl_template_free (glTemplate **template); + +extern glTemplate *gl_template_xml_parse_sheet (xmlNodePtr sheet_node); + +extern void gl_template_xml_add_sheet (glTemplate * template, + xmlNodePtr root, + xmlNsPtr ns); +#endif diff --git a/glabels2/src/text-node.c b/glabels2/src/text-node.c new file mode 100644 index 0000000..7c5ba20 --- /dev/null +++ b/glabels2/src/text-node.c @@ -0,0 +1,268 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * text_node.c: text node module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "text-node.h" + +#include "merge.h" + +#include "debug.h" + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static glTextNode *extract_text_node (gchar * text, gint * n); + + +/*--------------------------------------------------------------------------*/ +/* Expand single node into representative string. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_text_node_expand (glTextNode * text_node, + glMergeRecord * record) +{ + gchar *text; + + if (text_node->field_flag) { + text = gl_merge_eval_key (text_node->data, record); + if (text != NULL) { + return text; + } else { + return g_strdup_printf ("FIELD{%s}", text_node->data); + } + } else { + return g_strdup (text_node->data); + } +} + +/*--------------------------------------------------------------------------*/ +/* Create a single text node from given text. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_text_node_new_from_text (gchar * text) +{ + gint n; + + return extract_text_node (text, &n); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create a single text node from given text. n = characters used */ +/*--------------------------------------------------------------------------*/ +static glTextNode * +extract_text_node (gchar * text, + gint * n) +{ + glTextNode *text_node; + gchar *p; + gint m; + + text_node = g_new0 (glTextNode, 1); + + if (strncmp (text, "FIELD{", strlen ("FIELD{")) == 0) { + /* We are at the beginning of a "FIELD" node */ + text_node->field_flag = TRUE; + *n = strlen ("FIELD{"); + text += *n; + for (p = text, m = 0; *p != 0; p++, m++, (*n)++) { + if (*p == '}') { + (*n)++; + break; + } + } + text_node->data = g_strndup (text, m); + } else { + /* We are at the beginning of a literal node */ + text_node->field_flag = FALSE; + for (p = text, *n = 0; *p != 0; p++, (*n)++) { + if (strncmp (p, "FIELD{", strlen ("FIELD{")) == 0) + break; + if (*p == '\n') + break; + } + text_node->data = g_strndup (text, *n); + } + + return text_node; +} + +/*--------------------------------------------------------------------------*/ +/* Copy a single text node. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_text_node_dup (glTextNode *src) +{ + glTextNode *dst; + + dst = g_new0 (glTextNode, 1); + + dst->field_flag = src->field_flag; + dst->data = g_strdup (src->data); + + return dst; +} + +/*--------------------------------------------------------------------------*/ +/* Free a single text node. */ +/*--------------------------------------------------------------------------*/ +void +gl_text_node_free (glTextNode ** text_node) +{ + if ( *text_node == NULL ) return; + + g_free ((*text_node)->data); + (*text_node)->data = NULL; + g_free (*text_node); + *text_node = NULL; +} + +/*--------------------------------------------------------------------------*/ +/* Expand text lines into single string. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_text_node_lines_expand (GList * lines, + glMergeRecord * record) +{ + GList *p_line, *p_node; + glTextNode *text_node; + gchar *text, *old_text, *expanded_node; + + text = g_strdup (""); /* prime pointer for concatenation */ + for (p_line = lines; p_line != NULL; p_line = p_line->next) { + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + text_node = (glTextNode *) p_node->data; + old_text = text; + expanded_node = gl_text_node_expand (text_node, record); + text = g_strconcat (text, expanded_node, NULL); + g_free (old_text); + g_free (expanded_node); + } + if ( p_line->next != NULL ) { + old_text = text; + text = g_strconcat (text, "\n", NULL); + g_free (old_text); + } + } + + return text; +} + +/*--------------------------------------------------------------------------*/ +/* Parse a string back into text lines. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_text_node_lines_new_from_text (gchar * text) +{ + GList *lines, *nodes; + glTextNode *text_node; + gchar *p; + gint n; + + lines = NULL; + nodes = NULL; + for (p = text; *p != 0; p += n) { + if (*p != '\n') { + text_node = extract_text_node (p, &n); + nodes = g_list_append (nodes, text_node); + } else { + n = 1; + lines = g_list_append (lines, nodes); + nodes = NULL; + } + } + if (*(p - 1) != '\n') { + lines = g_list_append (lines, nodes); + } + + return lines; +} + +/*--------------------------------------------------------------------------*/ +/* Copy a list of text lines. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_text_node_lines_dup (GList * src_lines) +{ + GList *dst_lines=NULL; + GList *p_line, *line, *p_node; + glTextNode *node; + + for (p_line = src_lines; p_line != NULL; p_line = p_line->next) { + line = NULL; + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + node = gl_text_node_dup ((glTextNode *)p_node->data); + line = g_list_append (line, node); + } + dst_lines = g_list_append (dst_lines, line); + } + + return dst_lines; +} + +/*--------------------------------------------------------------------------*/ +/* Free a list of text lines. */ +/*--------------------------------------------------------------------------*/ +void +gl_text_node_lines_free (GList ** lines) +{ + GList *p_line, *p_node; + + for (p_line = *lines; p_line != NULL; p_line = p_line->next) { + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + gl_text_node_free ( (glTextNode **) &(p_node->data) ); + } + g_list_free ((GList *) p_line->data); + p_line->data = NULL; + } + + g_list_free (*lines); + *lines = NULL; +} + +/****************************************************************************/ +/* For debugging: descend and print lines list. */ +/****************************************************************************/ +void +gl_text_node_lines_print (GList * lines ) +{ + GList *p_line, *p_node; + glTextNode *text_node; + gint i_line, i_node; + + for (p_line=lines, i_line=0; p_line != NULL; p_line=p_line->next, i_line++) { + for (p_node = (GList *) p_line->data, i_node=0; p_node != NULL; + p_node = p_node->next, i_node++) { + text_node = (glTextNode *) p_node->data; + g_print( "LINE[%d], NODE[%d] = { %d, \"%s\" }\n", + i_line, i_node, + text_node->field_flag, text_node->data ); + + } + } + +} + diff --git a/glabels2/src/text-node.h b/glabels2/src/text-node.h new file mode 100644 index 0000000..2cd8509 --- /dev/null +++ b/glabels2/src/text-node.h @@ -0,0 +1,48 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * text_node.h: text node module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TEXT_NODE_H__ +#define __TEXT_NODE_H__ + +#include <gnome.h> +#include "merge.h" + +typedef struct { + gboolean field_flag; + gchar *data; +} glTextNode; + +extern gchar *gl_text_node_expand (glTextNode * text_node, + glMergeRecord * record); +extern glTextNode *gl_text_node_new_from_text (gchar * text); +extern glTextNode *gl_text_node_dup (glTextNode * text_node); +extern void gl_text_node_free (glTextNode ** text_node); + +extern gchar *gl_text_node_lines_expand (GList * lines, + glMergeRecord * record); +extern GList *gl_text_node_lines_new_from_text (gchar * text); +extern GList *gl_text_node_lines_dup (GList *lines); +extern void gl_text_node_lines_free (GList ** lines); + +/* debug function */ +extern void gl_text_node_lines_print (GList * lines ); + +#endif diff --git a/glabels2/src/tools.c b/glabels2/src/tools.c new file mode 100644 index 0000000..d93aafe --- /dev/null +++ b/glabels2/src/tools.c @@ -0,0 +1,230 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * tools.c: toolbar module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "tools.h" +#include "glabels.h" +#include "merge-properties.h" + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals. */ +/*===========================================*/ + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ + + + +/*****************************************************************************/ +/* arrow callback. */ +/*****************************************************************************/ +void +gl_tools_arrow (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_arrow_mode (view); + } +} + +/*****************************************************************************/ +/* text callback. */ +/*****************************************************************************/ +void +gl_tools_text (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_TEXT); + } +} + +/*****************************************************************************/ +/* box callback. */ +/*****************************************************************************/ +void +gl_tools_box (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_BOX); + } +} + +/*****************************************************************************/ +/* line callback. */ +/*****************************************************************************/ +void +gl_tools_line (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_LINE); + } +} + +/*****************************************************************************/ +/* ellipse callback. */ +/*****************************************************************************/ +void +gl_tools_ellipse (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, + GL_LABEL_OBJECT_ELLIPSE); + } +} + +/*****************************************************************************/ +/* image callback. */ +/*****************************************************************************/ +void +gl_tools_image (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, GL_LABEL_OBJECT_IMAGE); + } +} + +/*****************************************************************************/ +/* barcode callback. */ +/*****************************************************************************/ +void +gl_tools_barcode (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_object_create_mode (view, + GL_LABEL_OBJECT_BARCODE); + } +} + +/*****************************************************************************/ +/* zoom in callback. */ +/*****************************************************************************/ +void +gl_tools_zoomin (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_zoom_in (view); + } +} + +/*****************************************************************************/ +/* zoom out callback. */ +/*****************************************************************************/ +void +gl_tools_zoomout (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_zoom_out (view); + } +} + +/*****************************************************************************/ +/* zoom 1:1 callback. */ +/*****************************************************************************/ +void +gl_tools_zoom1to1 (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_view_set_zoom (view, 1.0); + } +} + +/*****************************************************************************/ +/* edit merge properties callback. */ +/*****************************************************************************/ +void +gl_tools_merge_properties (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname) + +{ + glView *view; + + view = glabels_get_active_view (); + if (view != NULL) { + gl_merge_properties_dialog (view); + } +} + diff --git a/glabels2/src/tools.h b/glabels2/src/tools.h new file mode 100644 index 0000000..955c513 --- /dev/null +++ b/glabels2/src/tools.h @@ -0,0 +1,71 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * tools.h: toolbar module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TOOLS_H__ +#define __TOOLS_H__ + +#include <bonobo/bonobo-ui-component.h> + +extern void gl_tools_arrow (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_text (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_box (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_line (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_ellipse (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_image (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_barcode (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_zoomin (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_zoomout (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_zoom1to1 (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +extern void gl_tools_merge_properties (BonoboUIComponent *uic, + gpointer user_data, + const gchar* verbname); + +#endif diff --git a/glabels2/src/util.c b/glabels2/src/util.c new file mode 100644 index 0000000..d762a7c --- /dev/null +++ b/glabels2/src/util.c @@ -0,0 +1,252 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * util.c: various small utility functions + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <string.h> +#include <glib.h> +#include <math.h> +#include <libgnomeprint/gnome-font.h> + +#include "util.h" + +#define FRAC_DELTA 0.00005 + + +/****************************************************************************/ +/* Append ".glabels" extension to filename if needed. */ +/****************************************************************************/ +gchar * +gl_util_add_extension (const gchar * orig_filename) +{ + gchar *new_filename, *extension; + + extension = strrchr (orig_filename, '.'); + if (extension == NULL) { + new_filename = g_strconcat (orig_filename, ".glabels", NULL); + } else { + if (g_strcasecmp (extension, ".glabels") != 0) { + new_filename = + g_strconcat (orig_filename, ".glabels", NULL); + } else { + new_filename = g_strdup (orig_filename); + } + } + + return new_filename; +} + +/****************************************************************************/ +/* Make sure we have an absolute path to filename. */ +/****************************************************************************/ +gchar * +gl_util_make_absolute (const gchar * filename) +{ + gchar *pwd, *absolute_filename; + + if (g_path_is_absolute (filename)) { + absolute_filename = g_strdup (filename); + } else { + pwd = g_get_current_dir (); + absolute_filename = + g_strjoin (G_DIR_SEPARATOR_S, pwd, filename, NULL); + g_free (pwd); + } + + return absolute_filename; +} + +/****************************************************************************/ +/* Create fractional representation of number, if possible. */ +/****************************************************************************/ +gchar * +gl_util_fraction( gdouble x ) +{ + static gdouble denom[] = { 1., 2., 3., 4., 8., 16., 32., 0. }; + gint i; + gdouble product, remainder; + gint n, d; + + for ( i=0; denom[i] != 0.0; i++ ) { + product = x * denom[i]; + remainder = fabs(product - ((gint)(product+0.5))); + if ( remainder < FRAC_DELTA ) break; + } + + if ( denom[i] == 0.0 ) { + /* None of our denominators work. */ + return g_strdup_printf ("%.5g", x); + } + if ( denom[i] == 1.0 ) { + /* Simple integer. */ + return g_strdup_printf ("%d", (gint)x); + } + n = (gint)( x * denom[i] + 0.5 ); + d = (gint)denom[i]; + if ( n > d ) { + return g_strdup_printf ("%d_%d/%d", (n/d), (n%d), d); + } else { + return g_strdup_printf ("%d/%d", (n%d), d); + } +} + +/****************************************************************************/ +/* Create button w/ both text and stock image. */ +/****************************************************************************/ +GtkWidget* +gl_button_new_with_stock_image (const gchar* text, const gchar* stock_id) +{ + GtkWidget *button; + GtkStockItem item; + GtkWidget *label; + GtkWidget *image; + GtkWidget *hbox; + GtkWidget *align; + + button = gtk_button_new (); + + if (GTK_BIN (button)->child) + gtk_container_remove (GTK_CONTAINER (button), + GTK_BIN (button)->child); + + if (gtk_stock_lookup (stock_id, &item)) + { + label = gtk_label_new_with_mnemonic (text); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button)); + + image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON); + hbox = gtk_hbox_new (FALSE, 2); + + align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); + + gtk_container_add (GTK_CONTAINER (button), align); + gtk_container_add (GTK_CONTAINER (align), hbox); + gtk_widget_show_all (align); + + return button; + } + + label = gtk_label_new_with_mnemonic (text); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button)); + + gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); + + gtk_widget_show (label); + gtk_container_add (GTK_CONTAINER (button), label); + + return button; +} + +/****************************************************************************/ +/* Add button to gtk_dialog w/ text and stock image. */ +/****************************************************************************/ +GtkWidget* +gl_util_dialog_add_button (GtkDialog *dialog, + const gchar* text, + const gchar* stock_id, + gint response_id) +{ + GtkWidget *button; + + g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL); + g_return_val_if_fail (text != NULL, NULL); + g_return_val_if_fail (stock_id != NULL, NULL); + + button = gl_button_new_with_stock_image (text, stock_id); + g_return_val_if_fail (button != NULL, NULL); + + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + + gtk_widget_show (button); + + gtk_dialog_add_action_widget (dialog, button, response_id); + + return button; +} + +/****************************************************************************/ +/* Utilities to deal with GTK_JUSTIFICATION types. */ +/****************************************************************************/ +const gchar * +gl_util_just_to_string (GtkJustification just) +{ + switch (just) { + case GTK_JUSTIFY_LEFT: + return "Left"; + case GTK_JUSTIFY_CENTER: + return "Center"; + case GTK_JUSTIFY_RIGHT: + return "Right"; + default: + return "?"; + } +} + +GtkJustification +gl_util_string_to_just (const gchar * string) +{ + + if (g_strcasecmp (string, "Left") == 0) { + return GTK_JUSTIFY_LEFT; + } else if (g_strcasecmp (string, "Center") == 0) { + return GTK_JUSTIFY_CENTER; + } else if (g_strcasecmp (string, "Right") == 0) { + return GTK_JUSTIFY_RIGHT; + } else { + return GTK_JUSTIFY_LEFT; + } + +} + +/****************************************************************************/ +/* Utilities to deal with GNOME_FONT_WEIGHT types */ +/****************************************************************************/ +const gchar * +gl_util_weight_to_string (GnomeFontWeight weight) +{ + switch (weight) { + case GNOME_FONT_BOOK: + return "Regular"; + case GNOME_FONT_BOLD: + return "Bold"; + default: + return "?"; + } +} + +GnomeFontWeight +gl_util_string_to_weight (const gchar * string) +{ + + if (g_strcasecmp (string, "Regular") == 0) { + return GNOME_FONT_BOOK; + } else if (g_strcasecmp (string, "Bold") == 0) { + return GNOME_FONT_BOLD; + } else { + return GNOME_FONT_BOOK; + } + +} diff --git a/glabels2/src/util.h b/glabels2/src/util.h new file mode 100644 index 0000000..33f5867 --- /dev/null +++ b/glabels2/src/util.h @@ -0,0 +1,49 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * util.h: various small utility functions + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __UTIL_H__ +#define __UTIL_H__ + +#include <gtk/gtk.h> +#include <libgnomeprint/gnome-font.h> + +extern gchar *gl_util_add_extension (const gchar * orig_filename); + +extern gchar *gl_util_make_absolute (const gchar * filename); + +extern gchar *gl_util_fraction( gdouble x ); + +extern GtkWidget* gl_util_button_new_with_stock_image (const gchar* text, + const gchar* stock_id); + +extern GtkWidget* gl_util_dialog_add_button (GtkDialog *dialog, + const gchar* text, + const gchar* stock_id, + gint response_id); + +extern const gchar *gl_util_just_to_string (GtkJustification just); +extern GtkJustification gl_util_string_to_just (const gchar * string); + +extern const gchar *gl_util_weight_to_string (GnomeFontWeight weight); +extern GnomeFontWeight gl_util_string_to_weight (const gchar * string); + +#endif /* __UTIL_H__ */ diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c new file mode 100644 index 0000000..49bae83 --- /dev/null +++ b/glabels2/src/view-barcode.c @@ -0,0 +1,835 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_barcode.c: GLabels label barcode object widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include <libgnomeprint/gnome-glyphlist.h> + +#include "view-barcode.h" +#include "canvas-hacktext.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-bc-data.h" +#include "wdgt-bc-props.h" +#include "wdgt-bc-style.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_barcode.xbm" +#include "pixmaps/cursor_barcode_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewBarcodePrivate { + + GList *item_list; + + /* Page 0 widgets */ + GtkWidget *bc_data; + + /* Page 1 widgets */ + GtkWidget *bc_props; + GtkWidget *bc_style; + + /* Page 2 widgets */ + GtkWidget *position; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_barcode_class_init (glViewBarcodeClass *klass); +static void gl_view_barcode_instance_init (glViewBarcode *view_barcode); +static void gl_view_barcode_finalize (GObject *object); + +static void update_view_barcode_cb (glLabelObject *object, + glViewBarcode *view_barcode); + +static GtkWidget *construct_properties_dialog (glViewBarcode *view_barcode); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewBarcode *view_barcode); + +static void bc_data_changed_cb (glWdgtBCData *bc_data, + glViewBarcode *view_barcode); + +static void bc_props_changed_cb (glWdgtBCProps *bc_props, + glViewBarcode *view_barcode); + +static void bc_style_changed_cb (glWdgtBCStyle *bc_style, + glViewBarcode *view_barcode); + +static void position_changed_cb (glWdgtPosition *position, + glViewBarcode *view_barcode); + +static void update_dialog_cb (glLabelObject *object, + glViewBarcode *view_barcode); + +static void draw_barcode (glViewBarcode *view_barcode); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_barcode_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewBarcodeClass), + NULL, + NULL, + (GClassInitFunc) gl_view_barcode_class_init, + NULL, + NULL, + sizeof (glViewBarcode), + 0, + (GInstanceInitFunc) gl_view_barcode_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewBarcode", &info, 0); + } + + return type; +} + +static void +gl_view_barcode_class_init (glViewBarcodeClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_barcode_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_barcode_instance_init (glViewBarcode *view_barcode) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_barcode->private = g_new0 (glViewBarcodePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_barcode_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_BARCODE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW barcode object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_barcode_new (glLabelBarcode *object, + glView *view) +{ + glViewBarcode *view_barcode; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_BARCODE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_barcode = g_object_new (gl_view_barcode_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_barcode), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_barcode), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_SIMPLE); + + /* Create analogous canvas items. */ + draw_barcode (view_barcode); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_barcode_cb), view_barcode); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_barcode); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_barcode), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_barcode); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_barcode_cb (glLabelObject *object, + glViewBarcode *view_barcode) +{ + glView *view; + GnomeCanvasItem *group; + + gl_debug (DEBUG_VIEW, "START"); + + view = gl_view_object_get_view (GL_VIEW_OBJECT(view_barcode)); + + /* Adjust appearance of analogous canvas items. */ + draw_barcode (view_barcode); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_barcode)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a barcode object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewBarcode *view_barcode) +{ + GtkWidget *dialog, *notebook, *wvbox, *wbutton; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble x, y, w, h, label_width, label_height; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + glMerge *merge; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + gl_debug (DEBUG_VIEW, "Creating dialog..."); + dialog = gtk_dialog_new_with_buttons ( _("Edit barcode object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_barcode); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Data Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating data tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Data"))); + + /* barcode data */ + gl_debug (DEBUG_VIEW, "Creating data entry..."); + view_barcode->private->bc_data = + gl_wdgt_bc_data_new (_("Barcode data"), merge->field_defs); + gl_debug (DEBUG_VIEW, "1"); + gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data), + (merge->type != GL_MERGE_NONE), + text_node); + gl_debug (DEBUG_VIEW, "2"); + gtk_box_pack_start (GTK_BOX (wvbox), view_barcode->private->bc_data, + FALSE, FALSE, 0); + gl_debug (DEBUG_VIEW, "3"); + g_signal_connect ( G_OBJECT(view_barcode->private->bc_data), + "changed", G_CALLBACK (bc_data_changed_cb), + view_barcode); + + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating props tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* barcode props entry */ + gl_debug (DEBUG_VIEW, "Creating props entry..."); + view_barcode->private->bc_props = + gl_wdgt_bc_props_new (_("Barcode Properties")); + gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props), + scale, color); + gtk_box_pack_start (GTK_BOX (wvbox), view_barcode->private->bc_props, + FALSE, FALSE, 0); + g_signal_connect ( G_OBJECT(view_barcode->private->bc_props), + "changed", G_CALLBACK (bc_props_changed_cb), + view_barcode); + + /* ------ Barcode Style Frame ------ */ + view_barcode->private->bc_style = gl_wdgt_bc_style_new (_("Style")); + gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE (view_barcode->private->bc_style), + style, text_flag); + gtk_box_pack_start (GTK_BOX (wvbox), view_barcode->private->bc_style, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_barcode->private->bc_style), + "changed", G_CALLBACK (bc_style_changed_cb), + view_barcode); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + gl_debug (DEBUG_VIEW, "Creating position tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position"))); + + /* ------ Position Frame ------ */ + gl_debug (DEBUG_VIEW, "Creating position entry..."); + view_barcode->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_barcode->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_barcode->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_barcode->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_barcode); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_barcode); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewBarcode *view_barcode) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. barcode data "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +bc_data_changed_cb (glWdgtBCData *bc_data, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + glTextNode *text_node; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + text_node = gl_wdgt_bc_data_get_data (bc_data); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. barcode props "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +bc_props_changed_cb (glWdgtBCProps *text_props, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_wdgt_bc_props_get_params (text_props, &scale, &color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + style, text_flag, color, scale); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. barcode style "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +bc_style_changed_cb (glWdgtBCStyle *bc_style, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_wdgt_bc_style_get_params (bc_style, &style, &text_flag); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + style, text_flag, color, scale); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewBarcode *view_barcode) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_barcode); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewBarcode *view_barcode) +{ + gdouble x, y; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + glMerge *merge; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_data), + bc_data_changed_cb, view_barcode); + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_props), + bc_props_changed_cb, view_barcode); + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_style), + bc_style_changed_cb, view_barcode); + g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->position), + position_changed_cb, view_barcode); + + /* Update widgets in property dialog */ + + gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data), + (merge->type != GL_MERGE_NONE), + text_node); + gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props), + scale, color); + gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE(view_barcode->private->bc_style), + style, text_flag); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_barcode->private->position), + x, y); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_data), + bc_data_changed_cb, view_barcode); + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_props), + bc_props_changed_cb, view_barcode); + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_style), + bc_style_changed_cb, view_barcode); + g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->position), + position_changed_cb, view_barcode); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_barcode_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_barcode_bits, + cursor_barcode_width, + cursor_barcode_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_barcode_mask_bits, + cursor_barcode_mask_width, + cursor_barcode_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_barcode_x_hot, + cursor_barcode_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating barcode objects. */ +/*****************************************************************************/ +int +gl_view_barcode_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_barcode; + static GObject *object; + gdouble x, y; + glTextNode *text_node; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_barcode_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + text_node = gl_text_node_new_from_text ("123456789"); + gl_label_barcode_set_data (GL_LABEL_BARCODE(object), + text_node); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + GL_BARCODE_STYLE_POSTNET, + FALSE, + GNOME_CANVAS_COLOR_A (0,0,0,255), + 1.0); + view_barcode = gl_view_barcode_new (GL_LABEL_BARCODE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_barcode)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw barcode to item (group). */ +/*--------------------------------------------------------------------------*/ +static void +draw_barcode (glViewBarcode *view_barcode) +{ + glLabelObject *object; + GnomeCanvasItem *group, *item; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + glBarcodeLine *line; + glBarcodeChar *bchar; + glBarcode *gbc; + GList *li; + GList *item_list = NULL; + GnomeCanvasPoints *points; + gchar *digits, *cstring; + GnomeFont *font; + GnomeGlyphList *glyphlist; + gdouble y_offset; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query label object and properties */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object)); + if (text_node->field_flag) { + digits = gl_barcode_default_digits (style); + } else { + digits = gl_text_node_expand (text_node, NULL); + } + + /* get parent item/group to render to. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_barcode)); + + /* remove previous items from group. */ + for (li = view_barcode->private->item_list; li!=NULL; li = li->next) { + gl_debug (DEBUG_VIEW, "in loop"); + gtk_object_destroy (GTK_OBJECT (li->data)); + } + gl_debug (DEBUG_VIEW, "1"); + g_list_free (view_barcode->private->item_list); + view_barcode->private->item_list = NULL; + gl_debug (DEBUG_VIEW, "2"); + + /* get Gnome Font */ + font = gnome_font_find_closest_from_weight_slant (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, + 10.0); + + gbc = gl_barcode_new (style, text_flag, scale, digits); + if (gbc == NULL) { + + cstring = _("Invalid barcode"); + glyphlist = gnome_glyphlist_from_text_sized_dumb (font, + color, + 0.0, 0.0, + cstring, + strlen + (cstring)); + y_offset = 10.0 - gnome_font_get_descender (font); + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gl_canvas_hacktext_get_type (), + "x", 0.0, + "y", y_offset, + "glyphlist", glyphlist, NULL); + + view_barcode->private->item_list = + g_list_prepend (view_barcode->private->item_list, item); + } else { + + points = gnome_canvas_points_new (2); + for (li = gbc->lines; li != NULL; li = li->next) { + line = (glBarcodeLine *) li->data; + + points->coords[0] = line->x; + points->coords[1] = line->y; + points->coords[2] = line->x; + points->coords[3] = line->y + line->length; + + item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_line_get_type + (), "points", points, + "width_units", line->width, + "fill_color_rgba", color, + NULL); + view_barcode->private->item_list = + g_list_prepend (view_barcode->private->item_list, item); + } + gnome_canvas_points_free (points); + + for (li = gbc->chars; li != NULL; li = li->next) { + bchar = (glBarcodeChar *) li->data; + + font = gnome_font_find_closest_from_weight_slant ( + GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, bchar->fsize); + glyphlist = gnome_glyphlist_from_text_sized_dumb (font, + color, + 0.0, + 0.0, + & + (bchar-> + c), + 1); + y_offset = + bchar->fsize - gnome_font_get_descender (font); + item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_hacktext_get_type + (), "x", bchar->x, "y", + bchar->y + y_offset, + "glyphlist", glyphlist, + NULL); + + view_barcode->private->item_list = + g_list_prepend (view_barcode->private->item_list, item); + + } + + } + + /* clean up */ + gl_barcode_free (&gbc); + g_free (digits); + + gl_debug (DEBUG_VIEW, "END"); +} + diff --git a/glabels2/src/view-barcode.h b/glabels2/src/view-barcode.h new file mode 100644 index 0000000..7bb9112 --- /dev/null +++ b/glabels2/src/view-barcode.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_barcode.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_BARCODE_H__ +#define __VIEW_BARCODE_H__ + +#include "view-object.h" +#include "label-barcode.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_BARCODE (gl_view_barcode_get_type ()) +#define GL_VIEW_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_BARCODE, glViewBarcode)) +#define GL_VIEW_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_BARCODE, glViewBarcodeClass)) +#define GL_IS_VIEW_BARCODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_BARCODE)) +#define GL_IS_VIEW_BARCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_BARCODE)) + +typedef struct _glViewBarcode glViewBarcode; +typedef struct _glViewBarcodeClass glViewBarcodeClass; + +typedef struct _glViewBarcodePrivate glViewBarcodePrivate; + +struct _glViewBarcode { + glViewObject parent_object; + + glViewBarcodePrivate *private; +}; + +struct _glViewBarcodeClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_barcode_get_type (void); + +extern glViewObject *gl_view_barcode_new (glLabelBarcode *object, + glView *view); + + +/* cursor for creating barcode objects */ +extern GdkCursor *gl_view_barcode_get_create_cursor (void); + +/* event handler for creating barcode objects */ +extern gint gl_view_barcode_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_BARCODE_H__ */ diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c new file mode 100644 index 0000000..545fd8d --- /dev/null +++ b/glabels2/src/view-box.c @@ -0,0 +1,707 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_box.c: GLabels label box object widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "view-box.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-size.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_box.xbm" +#include "pixmaps/cursor_box_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define CREATE_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 192) +#define CREATE_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 192) + +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) +#define DEFAULT_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 255) + +#define DELTA 0.01 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewBoxPrivate { + GnomeCanvasItem *item; + + /* Property dialog Page 0 widgets */ + GtkWidget *line; + GtkWidget *fill; + + /* Property dialog Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_box_class_init (glViewBoxClass *klass); +static void gl_view_box_instance_init (glViewBox *view_box); +static void gl_view_box_finalize (GObject *object); + +static void update_view_box_cb (glLabelObject *object, + glViewBox *view_box); + +static GtkWidget *construct_properties_dialog (glViewBox *view_box); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewBox *view_box); + +static void line_changed_cb (glWdgtLine *line, + glViewBox *view_box); + +static void fill_changed_cb (glWdgtFill *fill, + glViewBox *view_box); + +static void position_changed_cb (glWdgtPosition *position, + glViewBox *view_box); + +static void size_changed_cb (glWdgtSize *size, + glViewBox *view_box); + +static void update_dialog_cb (glLabelObject *object, + glViewBox *view_box); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_box_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewBoxClass), + NULL, + NULL, + (GClassInitFunc) gl_view_box_class_init, + NULL, + NULL, + sizeof (glViewBox), + 0, + (GInstanceInitFunc) gl_view_box_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewBox", &info, 0); + } + + return type; +} + +static void +gl_view_box_class_init (glViewBoxClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_box_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_box_instance_init (glViewBox *view_box) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_box->private = g_new0 (glViewBoxPrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_box_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_BOX (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW box object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_box_new (glLabelBox *object, + glView *view) +{ + glViewBox *view_box; + GnomeCanvasItem *group; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_BOX (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_box = g_object_new (gl_view_box_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_box), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_box), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_BOX_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(object); + line_color = gl_label_box_get_line_color(object); + fill_color = gl_label_box_get_fill_color(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_box)); + view_box->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_box_cb), view_box); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_box); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_box), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_box); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_box_cb (glLabelObject *object, + glViewBox *view_box) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + + /* Adjust appearance of analogous canvas item. */ + gnome_canvas_item_set (view_box->private->item, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_box)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a box object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewBox *view_box) +{ + GtkWidget *dialog, *notebook, *wvbox; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit box object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_box); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line box ------ */ + view_box->private->line = gl_wdgt_line_new (_("Outline")); + gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line), + line_width, + line_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->line, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->line), "changed", + G_CALLBACK(line_changed_cb), view_box); + + /* ------ Fill box ------ */ + view_box->private->fill = gl_wdgt_fill_new (_("Fill")); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill), + fill_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->fill, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->fill), "changed", + G_CALLBACK(fill_changed_cb), view_box); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_box->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_box->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->position), "changed", + G_CALLBACK(position_changed_cb), view_box); + + + /* ------ Size Frame ------ */ + view_box->private->size = gl_wdgt_size_new (_("Size")); + gl_wdgt_size_set_params (GL_WDGT_SIZE (view_box->private->size), + w, h, + TRUE, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->size, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_box->private->size), "changed", + G_CALLBACK(size_changed_cb), view_box); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_box); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewBox *view_box) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. line properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +line_changed_cb (glWdgtLine *line, + glViewBox *view_box) +{ + glLabelObject *object; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + gl_wdgt_line_get_params (GL_WDGT_LINE (line), + &line_width, + &line_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_box_set_line_width(GL_LABEL_BOX(object), line_width); + gl_label_box_set_line_color(GL_LABEL_BOX(object), line_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. fill properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +fill_changed_cb (glWdgtFill *fill, + glViewBox *view_box) +{ + glLabelObject *object; + guint fill_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + gl_wdgt_fill_get_params (GL_WDGT_FILL (fill), + &fill_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_box_set_fill_color(GL_LABEL_BOX(object), fill_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewBox *view_box) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_changed_cb (glWdgtSize *size, + glViewBox *view_box) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_size_get_size (GL_WDGT_SIZE (size), + &w, &h, &keep_aspect_ratio_flag); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_box); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewBox *view_box) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->line), + line_changed_cb, view_box); + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->fill), + fill_changed_cb, view_box); + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->position), + position_changed_cb, view_box); + g_signal_handlers_block_by_func (G_OBJECT(view_box->private->size), + size_changed_cb, view_box); + + /* Update widgets in property dialog */ + gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line), + line_width, + line_color); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill), + fill_color); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_box->private->position), + x, y); + gl_wdgt_size_set_size (GL_WDGT_SIZE(view_box->private->size), w, h); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->line), + line_changed_cb, view_box); + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->fill), + fill_changed_cb, view_box); + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->position), + position_changed_cb, view_box); + g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->size), + size_changed_cb, view_box); + + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_box_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_box_bits, + cursor_box_width, + cursor_box_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_box_mask_bits, + cursor_box_mask_width, + cursor_box_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_box_x_hot, + cursor_box_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating box objects. */ +/*****************************************************************************/ +int +gl_view_box_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_box; + static GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_debug (DEBUG_VIEW, "BUTTON_PRESS (%f, %f) -> (%f, %f)", event->button.x, event->button.y, x, y); + object = gl_label_box_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + line_width = 1.0; + line_color = CREATE_LINE_COLOR; + fill_color = CREATE_FILL_COLOR; + gl_label_box_set_line_width (GL_LABEL_BOX(object), + line_width); + gl_label_box_set_line_color (GL_LABEL_BOX(object), + line_color); + gl_label_box_set_fill_color (GL_LABEL_BOX(object), + fill_color); + view_box = gl_view_box_new (GL_LABEL_BOX(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE (%f, %f) -> (%f, %f)", event->button.x, event->button.y, x, y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + line_color = DEFAULT_LINE_COLOR; + fill_color = DEFAULT_FILL_COLOR; + gl_label_box_set_line_color (GL_LABEL_BOX(object), + line_color); + gl_label_box_set_fill_color (GL_LABEL_BOX(object), + fill_color); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_box)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + gl_debug (DEBUG_VIEW, "BUTTON_MOTION (%f, %f) -> (%f, %f)", event->button.x, event->button.y, x, y); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-box.h b/glabels2/src/view-box.h new file mode 100644 index 0000000..12cb904 --- /dev/null +++ b/glabels2/src/view-box.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_box.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_BOX_H__ +#define __VIEW_BOX_H__ + +#include "view-object.h" +#include "label-box.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_BOX (gl_view_box_get_type ()) +#define GL_VIEW_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_BOX, glViewBox)) +#define GL_VIEW_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_BOX, glViewBoxClass)) +#define GL_IS_VIEW_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_BOX)) +#define GL_IS_VIEW_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_BOX)) + +typedef struct _glViewBox glViewBox; +typedef struct _glViewBoxClass glViewBoxClass; + +typedef struct _glViewBoxPrivate glViewBoxPrivate; + +struct _glViewBox { + glViewObject parent_object; + + glViewBoxPrivate *private; +}; + +struct _glViewBoxClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_box_get_type (void); + +extern glViewObject *gl_view_box_new (glLabelBox *object, + glView *view); + + +/* cursor for creating box objects */ +extern GdkCursor *gl_view_box_get_create_cursor (void); + +/* event handler for creating box objects */ +extern gint gl_view_box_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_BOX_H__ */ diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c new file mode 100644 index 0000000..b21c646 --- /dev/null +++ b/glabels2/src/view-ellipse.c @@ -0,0 +1,706 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_ellipse.c: GLabels label ellipse object widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "view-ellipse.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-size.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_ellipse.xbm" +#include "pixmaps/cursor_ellipse_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define CREATE_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 192) +#define CREATE_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 192) + +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) +#define DEFAULT_FILL_COLOR GNOME_CANVAS_COLOR_A (0, 255, 0, 255) + +#define DELTA 0.01 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewEllipsePrivate { + GnomeCanvasItem *item; + + /* Property dialog Page 0 widgets */ + GtkWidget *line; + GtkWidget *fill; + + /* Property dialog Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_ellipse_class_init (glViewEllipseClass *klass); +static void gl_view_ellipse_instance_init (glViewEllipse *view_ellipse); +static void gl_view_ellipse_finalize (GObject *object); + +static void update_view_ellipse_cb (glLabelObject *object, + glViewEllipse *view_ellipse); + +static GtkWidget *construct_properties_dialog (glViewEllipse *view_ellipse); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewEllipse *view_ellipse); + +static void line_changed_cb (glWdgtLine *line, + glViewEllipse *view_ellipse); + +static void fill_changed_cb (glWdgtFill *fill, + glViewEllipse *view_ellipse); + +static void position_changed_cb (glWdgtPosition *position, + glViewEllipse *view_ellipse); + +static void size_changed_cb (glWdgtSize *size, + glViewEllipse *view_ellipse); + +static void update_dialog_cb (glLabelObject *object, + glViewEllipse *view_ellipse); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_ellipse_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewEllipseClass), + NULL, + NULL, + (GClassInitFunc) gl_view_ellipse_class_init, + NULL, + NULL, + sizeof (glViewEllipse), + 0, + (GInstanceInitFunc) gl_view_ellipse_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewEllipse", &info, 0); + } + + return type; +} + +static void +gl_view_ellipse_class_init (glViewEllipseClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_ellipse_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_ellipse_instance_init (glViewEllipse *view_ellipse) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_ellipse->private = g_new0 (glViewEllipsePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_ellipse_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_ELLIPSE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW ellipse object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_ellipse_new (glLabelEllipse *object, + glView *view) +{ + glViewEllipse *view_ellipse; + GnomeCanvasItem *group; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_ELLIPSE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_ellipse = g_object_new (gl_view_ellipse_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_ellipse), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_ellipse), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(object); + line_color = gl_label_ellipse_get_line_color(object); + fill_color = gl_label_ellipse_get_fill_color(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_ellipse)); + view_ellipse->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_ellipse_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_ellipse_cb), view_ellipse); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_ellipse); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_ellipse), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_ellipse); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_ellipse_cb (glLabelObject *object, + glViewEllipse *view_ellipse) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + + /* Adjust appearance of analogous canvas item. */ + gnome_canvas_item_set (view_ellipse->private->item, + "x2", w + DELTA, + "y2", h + DELTA, + "width_units", line_width, + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, + NULL); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_ellipse)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a ellipse object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewEllipse *view_ellipse) +{ + GtkWidget *dialog, *notebook, *wvbox; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit ellipse object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_ellipse); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line ellipse ------ */ + view_ellipse->private->line = gl_wdgt_line_new (_("Outline")); + gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line), + line_width, + line_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->line, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->line), "changed", + G_CALLBACK(line_changed_cb), view_ellipse); + + /* ------ Fill ellipse ------ */ + view_ellipse->private->fill = gl_wdgt_fill_new (_("Fill")); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill), + fill_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->fill, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->fill), "changed", + G_CALLBACK(fill_changed_cb), view_ellipse); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_ellipse->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_ellipse->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_ellipse->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_ellipse); + + + /* ------ Size Frame ------ */ + view_ellipse->private->size = gl_wdgt_size_new (_("Size")); + gl_wdgt_size_set_params (GL_WDGT_SIZE (view_ellipse->private->size), + w, h, + TRUE, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->size, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_ellipse->private->size), "changed", + G_CALLBACK(size_changed_cb), view_ellipse); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewEllipse *view_ellipse) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. line properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +line_changed_cb (glWdgtLine *line, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + gl_wdgt_line_get_params (GL_WDGT_LINE (line), + &line_width, + &line_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_ellipse_set_line_width(GL_LABEL_ELLIPSE(object), line_width); + gl_label_ellipse_set_line_color(GL_LABEL_ELLIPSE(object), line_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. fill properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +fill_changed_cb (glWdgtFill *fill, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + guint fill_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + gl_wdgt_fill_get_params (GL_WDGT_FILL (fill), + &fill_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_ellipse_set_fill_color(GL_LABEL_ELLIPSE(object), fill_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_changed_cb (glWdgtSize *size, + glViewEllipse *view_ellipse) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_size_get_size (GL_WDGT_SIZE (size), + &w, &h, &keep_aspect_ratio_flag); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_ellipse); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewEllipse *view_ellipse) +{ + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->line), + line_changed_cb, view_ellipse); + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->fill), + fill_changed_cb, view_ellipse); + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->position), + position_changed_cb, view_ellipse); + g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->size), + size_changed_cb, view_ellipse); + + /* Update widgets in property dialog */ + gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line), + line_width, + line_color); + gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill), + fill_color); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_ellipse->private->position), + x, y); + gl_wdgt_size_set_size (GL_WDGT_SIZE(view_ellipse->private->size), w, h); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->line), + line_changed_cb, view_ellipse); + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->fill), + fill_changed_cb, view_ellipse); + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->position), + position_changed_cb, view_ellipse); + g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->size), + size_changed_cb, view_ellipse); + + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_ellipse_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_ellipse_bits, + cursor_ellipse_width, + cursor_ellipse_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_ellipse_mask_bits, + cursor_ellipse_mask_width, + cursor_ellipse_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_ellipse_x_hot, + cursor_ellipse_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating ellipse objects. */ +/*****************************************************************************/ +int +gl_view_ellipse_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_ellipse; + static GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_ellipse_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + line_width = 1.0; + line_color = CREATE_LINE_COLOR; + fill_color = CREATE_FILL_COLOR; + gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), + line_width); + gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), + line_color); + gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), + fill_color); + view_ellipse = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + line_color = DEFAULT_LINE_COLOR; + fill_color = DEFAULT_FILL_COLOR; + gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), + line_color); + gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), + fill_color); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_ellipse)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-ellipse.h b/glabels2/src/view-ellipse.h new file mode 100644 index 0000000..ad0ce23 --- /dev/null +++ b/glabels2/src/view-ellipse.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_ellipse.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_ELLIPSE_H__ +#define __VIEW_ELLIPSE_H__ + +#include "view-object.h" +#include "label-ellipse.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_ELLIPSE (gl_view_ellipse_get_type ()) +#define GL_VIEW_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_ELLIPSE, glViewEllipse)) +#define GL_VIEW_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_ELLIPSE, glViewEllipseClass)) +#define GL_IS_VIEW_ELLIPSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_ELLIPSE)) +#define GL_IS_VIEW_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_ELLIPSE)) + +typedef struct _glViewEllipse glViewEllipse; +typedef struct _glViewEllipseClass glViewEllipseClass; + +typedef struct _glViewEllipsePrivate glViewEllipsePrivate; + +struct _glViewEllipse { + glViewObject parent_object; + + glViewEllipsePrivate *private; +}; + +struct _glViewEllipseClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_ellipse_get_type (void); + +extern glViewObject *gl_view_ellipse_new (glLabelEllipse *object, + glView *view); + + +/* cursor for creating ellipse objects */ +extern GdkCursor *gl_view_ellipse_get_create_cursor (void); + +/* event handler for creating ellipse objects */ +extern gint gl_view_ellipse_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_ELLIPSE_H__ */ diff --git a/glabels2/src/view-highlight.c b/glabels2/src/view-highlight.c new file mode 100644 index 0000000..5c148b7 --- /dev/null +++ b/glabels2/src/view-highlight.c @@ -0,0 +1,1637 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_highlight.c: GLabels Resizable Highlight module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <math.h> + +#include "view-highlight.h" + +#include "debug.h" + +#define MIN_ITEM_SIZE 1.0 +#define FG_COLOR GNOME_CANVAS_COLOR_A (0, 0, 255, 255) +#define BG_COLOR GNOME_CANVAS_COLOR_A (255, 255, 255, 255) + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static GnomeCanvasItem *highlight_resizable_box (glViewObject *view_object, + glViewHighlightStyle style); +static GnomeCanvasItem *highlight_resizable_line (glViewObject *view_object); +static GnomeCanvasItem *highlight_simple (glViewObject *view_object); + +static void update_resizable_box (GnomeCanvasItem *highlight, + glViewHighlightStyle style); +static void update_resizable_line (GnomeCanvasItem *highlight); +static void update_simple (GnomeCanvasItem *highlight); + +static int tl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int tr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int bl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int br_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +static int sl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int sr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int st_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int sb_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +static int p1_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); +static int p2_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +static int passthrough_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object); + +/*****************************************************************************/ +/* Create a resizable highlight for given object. */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_view_highlight_new (glViewObject *view_object, + glViewHighlightStyle style) +{ + GnomeCanvasItem *highlight; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT(view_object)); + + switch (style) { + + case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: + case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: + highlight = highlight_resizable_box (view_object, style); + break; + + case GL_VIEW_HIGHLIGHT_LINE_RESIZABLE: + highlight = highlight_resizable_line (view_object); + break; + + case GL_VIEW_HIGHLIGHT_SIMPLE: + highlight = highlight_simple (view_object); + break; + + default: + g_warning ("Invalid resizable highlight style"); + + } + + g_object_set_data (G_OBJECT(highlight), "style", + GINT_TO_POINTER(style)); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*****************************************************************************/ +/* Update a resizable highlight for given item. */ +/*****************************************************************************/ +void +gl_view_highlight_update (GnomeCanvasItem * highlight) +{ + glViewHighlightStyle style; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + style = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(highlight), + "style")); + + switch (style) { + + case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: + case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: + update_resizable_box (highlight, style); + break; + + case GL_VIEW_HIGHLIGHT_LINE_RESIZABLE: + update_resizable_line (highlight); + break; + + case GL_VIEW_HIGHLIGHT_SIMPLE: + update_simple (highlight); + break; + + default: + g_warning ("Invalid resizable highlight style"); + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create a resizable box highlight. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +highlight_resizable_box (glViewObject *view_object, + glViewHighlightStyle style) +{ + GnomeCanvasItem *highlight; + glLabelObject *object; + glView *view; + gdouble x, y, w, h; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *tl, *tr, *bl, *br; /* Handles at four corners */ + GnomeCanvasItem *sl, *sr, *st, *sb; /* Handles at each side */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + view = gl_view_object_get_view (view_object); + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (view->canvas)), + gnome_canvas_group_get_type (), + "x", x, "y", y, NULL); + + gnome_canvas_item_hide (highlight); + + switch (style) { + case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: + outline = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + "width_pixels", 2, + "outline_color_rgba", FG_COLOR, + NULL); + break; + case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: + outline = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_ellipse_get_type (), + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + "width_pixels", 2, + "outline_color_rgba", FG_COLOR, + NULL); + break; + default: + outline = NULL; + g_warning ("Invalid resizable highlight style"); + } + + tl = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + tr = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w - 1.0, + "y1", -1.0, + "x2", w + 1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + bl = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", h - 1.0, + "x2", +1.0, + "y2", h + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + br = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w - 1.0, + "y1", h - 1.0, + "x2", w + 1.0, + "y2", h + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + sl = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", h / 2.0 - 1.0, + "x2", +1.0, + "y2", h / 2.0 + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + sr = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w - 1.0, + "y1", h / 2.0 - 1.0, + "x2", w + 1.0, + "y2", h / 2.0 + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + st = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w / 2.0 - 1.0, + "y1", -1.0, + "x2", w / 2.0 + 1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + sb = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", w / 2.0 - 1.0, + "y1", h - 1.0, + "x2", w / 2.0 + 1.0, + "y2", h + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + g_object_set_data (G_OBJECT (highlight), "object", object); + + g_object_set_data (G_OBJECT (highlight), "outline", outline); + + g_object_set_data (G_OBJECT (highlight), "tl", tl); + g_object_set_data (G_OBJECT (highlight), "tr", tr); + g_object_set_data (G_OBJECT (highlight), "bl", bl); + g_object_set_data (G_OBJECT (highlight), "br", br); + g_object_set_data (G_OBJECT (highlight), "sl", sl); + g_object_set_data (G_OBJECT (highlight), "sr", sr); + g_object_set_data (G_OBJECT (highlight), "st", st); + g_object_set_data (G_OBJECT (highlight), "sb", sb); + + g_signal_connect (G_OBJECT (tl), "event", + G_CALLBACK (tl_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (tr), "event", + G_CALLBACK (tr_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (bl), "event", + G_CALLBACK (bl_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (br), "event", + G_CALLBACK (br_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (sl), "event", + G_CALLBACK (sl_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (sr), "event", + G_CALLBACK (sr_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (st), "event", + G_CALLBACK (st_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (sb), "event", + G_CALLBACK (sb_resize_event_handler), view_object); + + g_signal_connect (G_OBJECT (outline), "event", + G_CALLBACK (passthrough_event_handler), view_object); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create a resizable line highlight. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +highlight_resizable_line (glViewObject *view_object) +{ + GnomeCanvasItem *highlight; + glLabelObject *object; + glView *view; + gdouble x, y, dx, dy; + GnomeCanvasPoints *points; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *p1, *p2; /* Handles at endpoints */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &dx, &dy); + + view = gl_view_object_get_view (view_object); + + points = gnome_canvas_points_new (2); + + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (view->canvas)), + gnome_canvas_group_get_type (), + "x", x, "y", y, NULL); + + gnome_canvas_item_hide (highlight); + + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = dx; + points->coords[3] = dy; + outline = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_line_get_type (), + "points", points, + "width_pixels", 3, + "fill_color_rgba", FG_COLOR, + NULL); + + p1 = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + p2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP (highlight), + gnome_canvas_rect_get_type (), + "x1", dx - 1.0, + "y1", dy - 1.0, + "x2", dx + 1.0, + "y2", dy + 1.0, + "fill_color_rgba", FG_COLOR, + "outline_color_rgba", BG_COLOR, + NULL); + + g_object_set_data (G_OBJECT (highlight), "object", object); + + g_object_set_data (G_OBJECT (highlight), "outline", outline); + + g_object_set_data (G_OBJECT (highlight), "p1", p1); + g_object_set_data (G_OBJECT (highlight), "p2", p2); + + g_signal_connect (G_OBJECT (p1), "event", + G_CALLBACK (p1_resize_event_handler), view_object); + g_signal_connect (G_OBJECT (p2), "event", + G_CALLBACK (p2_resize_event_handler), view_object); + + g_signal_connect (G_OBJECT (outline), "event", + G_CALLBACK (passthrough_event_handler), view_object); + + gnome_canvas_points_free (points); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create a simple box highlight. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +highlight_simple (glViewObject *view_object) +{ + GnomeCanvasItem *highlight, *outline; + glLabelObject *object; + glView *view; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + view = gl_view_object_get_view (view_object); + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (view->canvas)), + gnome_canvas_group_get_type (), + "x", x, "y", y, NULL); + + gnome_canvas_item_hide (highlight); + + outline = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(highlight), + gnome_canvas_rect_get_type (), + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + "width_pixels", 2, + "outline_color_rgba", FG_COLOR, + NULL); + + + g_object_set_data (G_OBJECT (highlight), "outline", outline); + + g_object_set_data (G_OBJECT (highlight), "object", object); + + g_signal_connect (G_OBJECT (highlight), "event", + G_CALLBACK (passthrough_event_handler), view_object); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); + + return highlight; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a resizable box highlight. */ +/*---------------------------------------------------------------------------*/ +static void +update_resizable_box (GnomeCanvasItem *highlight, + glViewHighlightStyle style) +{ + glLabelObject *object; + gdouble w, h; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *tl, *tr, *bl, *br; /* Handles at four corners */ + GnomeCanvasItem *sl, *sr, *st, *sb; /* Handles at each side */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + object = g_object_get_data (G_OBJECT (highlight), "object"); + gl_label_object_get_size (object, &w, &h); + + outline = g_object_get_data (G_OBJECT (highlight), "outline"); + + tl = g_object_get_data (G_OBJECT (highlight), "tl"); + tr = g_object_get_data (G_OBJECT (highlight), "tr"); + bl = g_object_get_data (G_OBJECT (highlight), "bl"); + br = g_object_get_data (G_OBJECT (highlight), "br"); + sl = g_object_get_data (G_OBJECT (highlight), "sl"); + sr = g_object_get_data (G_OBJECT (highlight), "sr"); + st = g_object_get_data (G_OBJECT (highlight), "st"); + sb = g_object_get_data (G_OBJECT (highlight), "sb"); + + gnome_canvas_item_set (outline, + "x1", -0.5, + "y1", -0.5, + "x2", w + 0.5, + "y2", h + 0.5, + NULL); + + gnome_canvas_item_set (tl, + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (tr, + "x1", w - 1.0, + "y1", -1.0, + "x2", w + 1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (bl, + "x1", -1.0, + "y1", h - 1.0, + "x2", +1.0, + "y2", h + 1.0, + NULL); + + gnome_canvas_item_set (br, + "x1", w - 1.0, + "y1", h - 1.0, + "x2", w + 1.0, + "y2", h + 1.0, + NULL); + + gnome_canvas_item_set (sl, + "x1", -1.0, + "y1", h / 2.0 - 1.0, + "x2", +1.0, + "y2", h / 2.0 + 1.0, + NULL); + + gnome_canvas_item_set (sr, + "x1", w - 1.0, + "y1", h / 2.0 - 1.0, + "x2", w + 1.0, + "y2", h / 2.0 + 1.0, + NULL); + + gnome_canvas_item_set (st, + "x1", w / 2.0 - 1.0, + "y1", -1.0, + "x2", w / 2.0 + 1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (sb, + "x1", w / 2.0 - 1.0, + "y1", h - 1.0, + "x2", w / 2.0 + 1.0, + "y2", h + 1.0, + NULL); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a resizable line highlight. */ +/*---------------------------------------------------------------------------*/ +static void +update_resizable_line (GnomeCanvasItem *highlight) +{ + glLabelObject *object; + gdouble dx, dy; + GnomeCanvasPoints *points; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *p1, *p2; /* Handles at endpoints */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + object = g_object_get_data (G_OBJECT (highlight), "object"); + gl_label_object_get_size (object, &dx, &dy); + + points = gnome_canvas_points_new (2); + + outline = g_object_get_data (G_OBJECT (highlight), "outline"); + + p1 = g_object_get_data (G_OBJECT (highlight), "p1"); + p2 = g_object_get_data (G_OBJECT (highlight), "p2"); + + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = dx; + points->coords[3] = dy; + gnome_canvas_item_set (outline, "points", points, NULL); + + gnome_canvas_item_set (p1, + "x1", -1.0, + "y1", -1.0, + "x2", +1.0, + "y2", +1.0, + NULL); + + gnome_canvas_item_set (p2, + "x1", dx - 1.0, + "y1", dy - 1.0, + "x2", dx + 1.0, + "y2", dy + 1.0, + NULL); + + gnome_canvas_points_free (points); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a simple box highlight. */ +/*---------------------------------------------------------------------------*/ +static void +update_simple (GnomeCanvasItem *highlight) +{ + glLabelObject *object; + gdouble w, h; + GnomeCanvasItem *outline; /* Outline around item */ + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (highlight)); + + object = g_object_get_data (G_OBJECT (highlight), "object"); + gl_label_object_get_size (object, &w, &h); + + outline = g_object_get_data (G_OBJECT (highlight), "outline"); + + gnome_canvas_item_set (outline, + "x2", w + 0.5, + "y2", h + 0.5, + NULL); + + gnome_canvas_item_raise_to_top (highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-left" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +tl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x2, y2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to bottom-right corner */ + x2 = x + w; + y2 = y + h; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-right" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +tr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x1, y2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to bottom-left corner */ + x1 = x; + y2 = y + h; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x1; + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x1; + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-left" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +bl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x2, y1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to top-right corner */ + x2 = x + w; + y1 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = y1; + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + y = y1; + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-right" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +br_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x1, y1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + gl_debug (DEBUG_VIEW, ""); + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to top-left corner */ + x1 = x; + y1 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x1; + y = y1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x1; + y = y1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Left-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to right side */ + x2 = x + w; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = MIN (event->button.x, x2 - MIN_ITEM_SIZE); + w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Right-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble x1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to left side */ + x1 = x; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x1; + w = MAX (event->button.x - x1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +st_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble y2; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to bottom-right corner */ + y2 = y + h; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + y = MIN (event->button.y, y2 - MIN_ITEM_SIZE); + h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sb_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, w, h; + static gdouble y1; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &w, &h); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to top side */ + y1 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + y = y1; + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + y = y1; + h = MAX (event->button.y - y1, MIN_ITEM_SIZE); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, w, h); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Resize "P1" event handler. */ +/*---------------------------------------------------------------------------*/ +static int +p1_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, dx, dy; + static gdouble x0, y0; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &dx, &dy); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to P2 */ + x0 = x + dx; + y0 = y + dy; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Resize "P2" event handler. */ +/*---------------------------------------------------------------------------*/ +static int +p2_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + gdouble x, y, dx, dy; + static gdouble x0, y0; + static gboolean dragging = FALSE; + glLabelObject *object; + glView *view; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view (view_object); + if ( view->state != GL_VIEW_STATE_ARROW ) { + /* don't interfere with object creation modes */ + return FALSE; + } + + object = gl_view_object_get_object (view_object); + gl_label_object_get_position (object, &x, &y); + gl_label_object_get_size (object, &dx, &dy); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gnome_canvas_item_grab (handle_item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + /* Anchor to P1 */ + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gnome_canvas_item_ungrab (handle_item, + event->button.time); + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + x = x0; + y = y0; + dx = (event->button.x - x0); + dy = (event->button.y - y0); + gl_label_object_set_position (object, x, y); + gl_label_object_set_size (object, dx, dy); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Passthrough event handler. */ +/*---------------------------------------------------------------------------*/ +static int +passthrough_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + glViewObject *view_object) +{ + GnomeCanvasItem *group; + + gl_debug (DEBUG_VIEW, ""); + + group = gl_view_object_get_group (view_object); + return gl_view_item_event_handler (group, event, view_object); + +} diff --git a/glabels2/src/view-highlight.h b/glabels2/src/view-highlight.h new file mode 100644 index 0000000..269b6ee --- /dev/null +++ b/glabels2/src/view-highlight.h @@ -0,0 +1,41 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_highlight.h: GLabels Resizable Highlight module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __VIEW_HIGHLIGHT_H__ +#define __VIEW_HIGHLIGHT_H__ + +#include <gnome.h> + +typedef enum { + GL_VIEW_HIGHLIGHT_BOX_RESIZABLE, + GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE, + GL_VIEW_HIGHLIGHT_LINE_RESIZABLE, + GL_VIEW_HIGHLIGHT_SIMPLE, +} glViewHighlightStyle; + +#include "view-object.h" + +extern GnomeCanvasItem *gl_view_highlight_new (glViewObject *view_object, + glViewHighlightStyle style); + +extern void gl_view_highlight_update (GnomeCanvasItem * highlight); + +#endif diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c new file mode 100644 index 0000000..a00db39 --- /dev/null +++ b/glabels2/src/view-image.c @@ -0,0 +1,685 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_image.c: GLabels label image object widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "view-image.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-fill.h" +#include "wdgt-size.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_image.xbm" +#include "pixmaps/cursor_image_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +#define DELTA 0.01 + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewImagePrivate { + GnomeCanvasItem *item; + + /* Page 0 widgets */ + GtkWidget *pixmap_entry; + + /* Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + +/* Save state of image file entry */ +static gchar *image_path = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_image_class_init (glViewImageClass *klass); +static void gl_view_image_instance_init (glViewImage *view_image); +static void gl_view_image_finalize (GObject *object); + +static void update_view_image_cb (glLabelObject *object, + glViewImage *view_image); + +static GtkWidget *construct_properties_dialog (glViewImage *view_image); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewImage *view_image); + +static void file_changed_cb (GtkEntry *pixmap_entry, + glViewImage *view_image); + +static void position_changed_cb (glWdgtPosition *position, + glViewImage *view_image); + +static void size_changed_cb (glWdgtSize *size, + glViewImage *view_image); + +static void size_reset_cb (GtkButton *button, + glViewImage *view_image); + +static void update_dialog_cb (glLabelObject *object, + glViewImage *view_image); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_image_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewImageClass), + NULL, + NULL, + (GClassInitFunc) gl_view_image_class_init, + NULL, + NULL, + sizeof (glViewImage), + 0, + (GInstanceInitFunc) gl_view_image_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewImage", &info, 0); + } + + return type; +} + +static void +gl_view_image_class_init (glViewImageClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_image_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_image_instance_init (glViewImage *view_image) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_image->private = g_new0 (glViewImagePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_image_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_IMAGE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW image object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_image_new (glLabelImage *object, + glView *view) +{ + glViewImage *view_image; + GnomeCanvasItem *group; + const GdkPixbuf *pixbuf; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_IMAGE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_image = g_object_new (gl_view_image_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_image), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_image), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_BOX_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + pixbuf = gl_label_image_get_pixbuf(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_image)); + view_image->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_pixbuf_get_type (), + "x", 0.0, + "y", 0.0, + "width_set", TRUE, + "height_set", TRUE, + "width", w, + "height", h, + "pixbuf", pixbuf, + NULL); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_image_cb), view_image); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_image); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_image), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_image); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_image_cb (glLabelObject *object, + glViewImage *view_image) +{ + const GdkPixbuf *pixbuf; + gdouble w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object)); + + /* Adjust appearance of analogous canvas item. */ + gnome_canvas_item_set (view_image->private->item, + "width_set", TRUE, + "height_set", TRUE, + "width", w, + "height", h, + "pixbuf", pixbuf, + NULL); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_image)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a image object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewImage *view_image) +{ + GtkWidget *dialog, *notebook, *wvbox, *wbutton; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble x, y, w, h, label_width, label_height; + gchar *filename; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit image object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_image); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Image Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Image"))); + + /* image entry */ + view_image->private->pixmap_entry = + gnome_pixmap_entry_new ("image", "Load image", TRUE); + gnome_pixmap_entry_set_preview_size (GNOME_PIXMAP_ENTRY + (view_image->private->pixmap_entry), + 128, 128); + + /* Set default path for image entry */ + if (filename != NULL) { + /* Set default path to the directory containing image. */ + if (image_path != NULL) + g_free (image_path); + image_path = g_path_get_dirname (filename); + if (image_path != NULL) { + image_path = g_strconcat (image_path, "/", NULL); + } + } else if (image_path == NULL) { + /* First time, set it to our CWD. */ + image_path = g_get_current_dir (); + } + + gtk_box_pack_start (GTK_BOX (wvbox), view_image->private->pixmap_entry, + FALSE, FALSE, 0); + g_signal_connect ( G_OBJECT(gnome_file_entry_gtk_entry + (GNOME_FILE_ENTRY (view_image->private->pixmap_entry))), + "changed", G_CALLBACK (file_changed_cb), + view_image); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_image->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_image->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_image->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_image->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_image); + + + /* ------ Size Frame ------ */ + view_image->private->size = gl_wdgt_size_new (_("Size")); + gl_wdgt_size_set_params (GL_WDGT_SIZE (view_image->private->size), + w, h, + TRUE, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_image->private->size, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_image->private->size), "changed", + G_CALLBACK(size_changed_cb), view_image); + + /* ------ Size Reset Button ------ */ + wbutton = gtk_button_new_with_label (_("Reset image size")); + gtk_box_pack_start (GTK_BOX (wvbox), wbutton, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (wbutton), "clicked", + G_CALLBACK (size_reset_cb), view_image); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_image); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewImage *view_image) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. file "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +file_changed_cb (GtkEntry *pixmap_entry, + glViewImage *view_image) +{ + glLabelObject *object; + gchar *filename; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + filename = gnome_pixmap_entry_get_filename (GNOME_PIXMAP_ENTRY(view_image->private->pixmap_entry)); + gl_debug (DEBUG_VIEW, "filename = %s", filename); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + gl_label_image_set_filename(GL_LABEL_IMAGE(object), filename); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + + g_free (filename); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewImage *view_image) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_changed_cb (glWdgtSize *size, + glViewImage *view_image) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_size_get_size (GL_WDGT_SIZE (size), + &w, &h, &keep_aspect_ratio_flag); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_image); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. size "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +size_reset_cb (GtkButton *button, + glViewImage *view_image) +{ + glLabelObject *object; + gdouble image_w, image_h; + const GdkPixbuf *pixbuf; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object)); + + image_w = gdk_pixbuf_get_width (pixbuf); + image_h = gdk_pixbuf_get_height (pixbuf); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), image_w, image_h); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewImage *view_image) +{ + gchar *filename; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_image->private->pixmap_entry), + file_changed_cb, view_image); + g_signal_handlers_block_by_func (G_OBJECT(view_image->private->position), + position_changed_cb, view_image); + g_signal_handlers_block_by_func (G_OBJECT(view_image->private->size), + size_changed_cb, view_image); + + /* Update widgets in property dialog */ + + if ( filename != NULL ) { + gnome_file_entry_set_filename (GNOME_FILE_ENTRY (view_image->private->pixmap_entry), + filename); + } + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_image->private->position), + x, y); + gl_wdgt_size_set_size (GL_WDGT_SIZE(view_image->private->size), w, h); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->pixmap_entry), + file_changed_cb, view_image); + g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->position), + position_changed_cb, view_image); + g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->size), + size_changed_cb, view_image); + + g_free (filename); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_image_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_image_bits, + cursor_image_width, + cursor_image_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_image_mask_bits, + cursor_image_mask_width, + cursor_image_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_image_x_hot, + cursor_image_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating image objects. */ +/*****************************************************************************/ +int +gl_view_image_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_image; + static GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_image_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + view_image = gl_view_image_new (GL_LABEL_IMAGE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_image)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + MIN (x, x0), MIN (y, y0)); + w = MAX (x, x0) - MIN (x, x0); + h = MAX (y, y0) - MIN (y, y0); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-image.h b/glabels2/src/view-image.h new file mode 100644 index 0000000..e36154a --- /dev/null +++ b/glabels2/src/view-image.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_image.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_IMAGE_H__ +#define __VIEW_IMAGE_H__ + +#include "view-object.h" +#include "label-image.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_IMAGE (gl_view_image_get_type ()) +#define GL_VIEW_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_IMAGE, glViewImage)) +#define GL_VIEW_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_IMAGE, glViewImageClass)) +#define GL_IS_VIEW_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_IMAGE)) +#define GL_IS_VIEW_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_IMAGE)) + +typedef struct _glViewImage glViewImage; +typedef struct _glViewImageClass glViewImageClass; + +typedef struct _glViewImagePrivate glViewImagePrivate; + +struct _glViewImage { + glViewObject parent_object; + + glViewImagePrivate *private; +}; + +struct _glViewImageClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_image_get_type (void); + +extern glViewObject *gl_view_image_new (glLabelImage *object, + glView *view); + + +/* cursor for creating image objects */ +extern GdkCursor *gl_view_image_get_create_cursor (void); + +/* event handler for creating image objects */ +extern gint gl_view_image_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_IMAGE_H__ */ diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c new file mode 100644 index 0000000..27dc800 --- /dev/null +++ b/glabels2/src/view-line.c @@ -0,0 +1,652 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_line.c: GLabels label line object widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "view-line.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-line.h" +#include "wdgt-vector.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_line.xbm" +#include "pixmaps/cursor_line_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define CREATE_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 192) + +#define DEFAULT_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 0, 255) + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewLinePrivate { + GnomeCanvasItem *item; + + /* Property dialog Page 0 widgets */ + GtkWidget *line; + + /* Property dialog Page 1 widgets */ + GtkWidget *position; + GtkWidget *vector; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_line_class_init (glViewLineClass *klass); +static void gl_view_line_instance_init (glViewLine *view_line); +static void gl_view_line_finalize (GObject *object); + +static void update_view_line_cb (glLabelObject *object, + glViewLine *view_line); + +static GtkWidget *construct_properties_dialog (glViewLine *view_line); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewLine *view_line); + +static void line_changed_cb (glWdgtLine *line, + glViewLine *view_line); + +static void position_changed_cb (glWdgtPosition *position, + glViewLine *view_line); + +static void vector_changed_cb (glWdgtVector *vector, + glViewLine *view_line); + +static void update_dialog_cb (glLabelObject *object, + glViewLine *view_line); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_line_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewLineClass), + NULL, + NULL, + (GClassInitFunc) gl_view_line_class_init, + NULL, + NULL, + sizeof (glViewLine), + 0, + (GInstanceInitFunc) gl_view_line_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewLine", &info, 0); + } + + return type; +} + +static void +gl_view_line_class_init (glViewLineClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_line_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_line_instance_init (glViewLine *view_line) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_line->private = g_new0 (glViewLinePrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_line_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_LINE (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW line object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_line_new (glLabelLine *object, + glView *view) +{ + glViewLine *view_line; + GnomeCanvasItem *group; + gdouble line_width; + guint line_color; + gdouble w, h; + GtkMenu *menu; + GtkWidget *dialog; + GnomeCanvasPoints *points; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_LINE (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_line = g_object_new (gl_view_line_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_line), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_line), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_LINE_RESIZABLE); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(object); + line_color = gl_label_line_get_line_color(object); + + /* Create analogous canvas item. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_line)); + + points = gnome_canvas_points_new (2); + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = w; + points->coords[3] = h; + view_line->private->item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), + gnome_canvas_line_get_type (), + "points", points, + "width_units", line_width, + "fill_color_rgba", line_color, + NULL); + gnome_canvas_points_free (points); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_line_cb), view_line); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_line); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_line), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_line); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_line_cb (glLabelObject *object, + glViewLine *view_line) +{ + gdouble line_width; + guint line_color; + gdouble w, h; + GnomeCanvasPoints *points; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + + /* Adjust appearance of analogous canvas item. */ + points = gnome_canvas_points_new (2); + points->coords[0] = 0.0; + points->coords[1] = 0.0; + points->coords[2] = w; + points->coords[3] = h; + gnome_canvas_item_set (view_line->private->item, + "points", points, + "width_units", line_width, + "fill_color_rgba", line_color, + NULL); + gnome_canvas_points_free (points); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_line)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a line object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewLine *view_line) +{ + GtkWidget *dialog, *notebook, *wvbox; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble line_width; + guint line_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + dialog = gtk_dialog_new_with_buttons ( _("Edit line object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_line); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line line ------ */ + view_line->private->line = gl_wdgt_line_new (_("Outline")); + gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line), + line_width, + line_color); + gtk_box_pack_start (GTK_BOX (wvbox), view_line->private->line, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_line->private->line), "changed", + G_CALLBACK(line_changed_cb), view_line); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + view_line->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_line->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_line->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_line->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_line); + + + /* ------ Size Frame ------ */ + view_line->private->vector = gl_wdgt_vector_new (_("Size")); + gl_wdgt_vector_set_params (GL_WDGT_VECTOR (view_line->private->vector), + w, h, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), view_line->private->vector, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_line->private->vector), "changed", + G_CALLBACK(vector_changed_cb), view_line); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_line); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewLine *view_line) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. line properties "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +line_changed_cb (glWdgtLine *line, + glViewLine *view_line) +{ + glLabelObject *object; + gdouble line_width; + guint line_color; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + gl_wdgt_line_get_params (GL_WDGT_LINE (line), + &line_width, + &line_color); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + gl_label_line_set_line_width(GL_LABEL_LINE(object), line_width); + gl_label_line_set_line_color(GL_LABEL_LINE(object), line_color); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewLine *view_line) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. vector "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +vector_changed_cb (glWdgtVector *vector, + glViewLine *view_line) +{ + glLabelObject *object; + gdouble w, h; + gboolean keep_aspect_ratio_flag; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_vector_get_params (GL_WDGT_VECTOR (vector), &w, &h); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_line); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewLine *view_line) +{ + gdouble line_width; + guint line_color; + gdouble x, y, w, h, label_width, label_height; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object)); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_line->private->line), + line_changed_cb, view_line); + g_signal_handlers_block_by_func (G_OBJECT(view_line->private->position), + position_changed_cb, view_line); + g_signal_handlers_block_by_func (G_OBJECT(view_line->private->vector), + vector_changed_cb, view_line); + + /* Update widgets in property dialog */ + gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line), + line_width, + line_color); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_line->private->position), + x, y); + gl_wdgt_vector_set_params (GL_WDGT_VECTOR(view_line->private->vector), + w, h, label_width, label_height); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->line), + line_changed_cb, view_line); + g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->position), + position_changed_cb, view_line); + g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->vector), + vector_changed_cb, view_line); + + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_line_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_line_bits, + cursor_line_width, + cursor_line_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_line_mask_bits, + cursor_line_mask_width, + cursor_line_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_line_x_hot, + cursor_line_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating line objects. */ +/*****************************************************************************/ +int +gl_view_line_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_line; + static GObject *object; + gdouble line_width; + guint line_color; + gdouble x, y, w, h; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_line_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_label_object_set_size (GL_LABEL_OBJECT(object), + 0.0, 0.0); + line_width = 1.0; + line_color = CREATE_LINE_COLOR; + gl_label_line_set_line_width (GL_LABEL_LINE(object), + line_width); + gl_label_line_set_line_color (GL_LABEL_LINE(object), + line_color); + view_line = gl_view_line_new (GL_LABEL_LINE(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + if ((x0 == x) && (y0 == y)) { + x = x0 + 36.0; + y = y0 + 36.0; + } + w = x - x0; + h = y - y0; + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + line_color = DEFAULT_LINE_COLOR; + gl_label_line_set_line_color (GL_LABEL_LINE(object), + line_color); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_line)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + w = x - x0; + h = y - y0; + gl_label_object_set_size (GL_LABEL_OBJECT(object), + w, h); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels2/src/view-line.h b/glabels2/src/view-line.h new file mode 100644 index 0000000..2361899 --- /dev/null +++ b/glabels2/src/view-line.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_line.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_LINE_H__ +#define __VIEW_LINE_H__ + +#include "view-object.h" +#include "label-line.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_LINE (gl_view_line_get_type ()) +#define GL_VIEW_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_LINE, glViewLine)) +#define GL_VIEW_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_LINE, glViewLineClass)) +#define GL_IS_VIEW_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_LINE)) +#define GL_IS_VIEW_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_LINE)) + +typedef struct _glViewLine glViewLine; +typedef struct _glViewLineClass glViewLineClass; + +typedef struct _glViewLinePrivate glViewLinePrivate; + +struct _glViewLine { + glViewObject parent_object; + + glViewLinePrivate *private; +}; + +struct _glViewLineClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_line_get_type (void); + +extern glViewObject *gl_view_line_new (glLabelLine *object, + glView *view); + + +/* cursor for creating line objects */ +extern GdkCursor *gl_view_line_get_create_cursor (void); + +/* event handler for creating line objects */ +extern gint gl_view_line_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_LINE_H__ */ diff --git a/glabels2/src/view-object.c b/glabels2/src/view-object.c new file mode 100644 index 0000000..9897b3f --- /dev/null +++ b/glabels2/src/view-object.c @@ -0,0 +1,524 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_object.c: GLabels label object base class + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include "view-object.h" + +#include "debug.h" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewObjectPrivate { + + glView *view; + glLabelObject *object; + + GnomeCanvasItem *group; + GnomeCanvasItem *highlight; + + GtkWidget *menu; + GtkWidget *property_dialog; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static GObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_object_class_init (glViewObjectClass *klass); +static void gl_view_object_instance_init (glViewObject *view_object); +static void gl_view_object_finalize (GObject *object); + +static GtkMenu *new_menu (glViewObject *view_object); + +static void object_moved_cb (glLabelObject *object, + gdouble x, gdouble y, + glViewObject *view_object); +static void raise_object_cb (GtkWidget * widget, glViewObject *view_object); +static void lower_object_cb (GtkWidget * widget, glViewObject *view_object); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_object_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewObjectClass), + NULL, + NULL, + (GClassInitFunc) gl_view_object_class_init, + NULL, + NULL, + sizeof (glViewObject), + 0, + (GInstanceInitFunc) gl_view_object_instance_init, + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "glViewObject", &info, 0); + } + + return type; +} + +static void +gl_view_object_class_init (glViewObjectClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_object_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_object_instance_init (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_object->private = g_new0 (glViewObjectPrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_object_finalize (GObject *object) +{ + glLabel *parent; + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_OBJECT (object)); + + view = GL_VIEW_OBJECT(object)->private->view; + view->object_list = g_list_remove (view->object_list, object); + view->selected_object_list = + g_list_remove (view->selected_object_list, object); + + g_object_unref (GL_VIEW_OBJECT(object)->private->object); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->group)); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->highlight)); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->menu)); + gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->property_dialog)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW object view. */ +/*****************************************************************************/ +GObject * +gl_view_object_new (void) +{ + glViewObject *view_object; + + gl_debug (DEBUG_VIEW, "START"); + + view_object = g_object_new (gl_view_object_get_type(), NULL); + + gl_debug (DEBUG_VIEW, "END"); + + return G_OBJECT (view_object); +} + +/*****************************************************************************/ +/* Set parent view to which this object view belongs. */ +/*****************************************************************************/ +void +gl_view_object_set_view (glViewObject *view_object, + glView *view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_object->private->view = view; + + view->object_list = g_list_prepend (view->object_list, view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set Label object to follow. */ +/*****************************************************************************/ +void +gl_view_object_set_object (glViewObject *view_object, + glLabelObject *object, + glViewHighlightStyle style) +{ + GnomeCanvas *canvas; + GnomeCanvasGroup *root; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); + + view_object->private->object = object; + + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + + /* create canvas group to contain items representing object */ + canvas = GNOME_CANVAS (view_object->private->view->canvas); + root = gnome_canvas_root (canvas); + view_object->private->group = + gnome_canvas_item_new (root, gnome_canvas_group_get_type (), + "x", x, + "y", y, + NULL); + + /* Create appropriate selection highlight canvas item. */ + view_object->private->highlight = + gl_view_highlight_new (view_object, style); + + view_object->private->menu = GTK_WIDGET(new_menu (view_object)); + + g_signal_connect (G_OBJECT (object), "moved", + G_CALLBACK (object_moved_cb), + view_object); + + g_signal_connect (G_OBJECT (object), "top", + G_CALLBACK (raise_object_cb), + view_object); + + g_signal_connect (G_OBJECT (object), "bottom", + G_CALLBACK (lower_object_cb), + view_object); + + g_signal_connect (G_OBJECT (view_object->private->group), "event", + G_CALLBACK (gl_view_item_event_handler), + view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set dialog for controlling/viewing object properties. */ +/*****************************************************************************/ +void +gl_view_object_set_dialog (glViewObject *view_object, + GtkWidget *dialog) + +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (dialog && GTK_IS_WIDGET (dialog)); + + view_object->private->property_dialog = dialog; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return parent view associated with this view. */ +/*****************************************************************************/ +glView * +gl_view_object_get_view (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->view; +} + +/*****************************************************************************/ +/* Return label object that we are following. */ +/*****************************************************************************/ +glLabelObject * +gl_view_object_get_object (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->object; +} + +/*****************************************************************************/ +/* Return canvas item representing our object in this view. */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_view_object_get_group (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->group; +} + +/*****************************************************************************/ +/* Return dialog for controlling/viewing object properties. */ +/*****************************************************************************/ +GtkWidget * +gl_view_object_get_dialog (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return view_object->private->property_dialog; +} + +/*****************************************************************************/ +/* Popup menu for this object. */ +/*****************************************************************************/ +GtkMenu * +gl_view_object_get_menu (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gl_debug (DEBUG_VIEW, "END"); + + return GTK_MENU(view_object->private->menu); +} + +/*****************************************************************************/ +/* Update Highlight of object. */ +/*****************************************************************************/ +void +gl_view_object_update_highlight (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view_object->private->highlight); + + gl_view_highlight_update (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Highlight view of object. */ +/*****************************************************************************/ +void +gl_view_object_show_highlight (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view_object->private->highlight); + + gnome_canvas_item_show (view_object->private->highlight); + gnome_canvas_item_raise_to_top (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Remove highlight from view of object. */ +/*****************************************************************************/ +void +gl_view_object_hide_highlight (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + g_return_if_fail (view_object->private->highlight); + + gnome_canvas_item_hide (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + + +/*---------------------------------------------------------------------------*/ +/* Create a popup menu for this object view. */ +/*---------------------------------------------------------------------------*/ +static GtkMenu * +new_menu (glViewObject *view_object) +{ + GtkWidget *menu, *menuitem; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_val_if_fail (view_object && GL_VIEW_OBJECT(view_object), NULL); + + menu = gtk_menu_new (); + + menuitem = gtk_menu_item_new_with_label (_("Edit properties...")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_view_object_show_dialog), + view_object); + + menuitem = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Delete")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (g_object_unref), view_object); + + menuitem = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Bring to front")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_label_object_raise_to_top), + view_object->private->object); + + menuitem = gtk_menu_item_new_with_label (_("Send to back")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_label_object_lower_to_bottom), + view_object->private->object); + + gl_debug (DEBUG_VIEW, "END"); + + return GTK_MENU(menu); +} + +/*****************************************************************************/ +/* Show property dialog. */ +/*****************************************************************************/ +void +gl_view_object_show_dialog (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); + + gtk_widget_show_all (view_object->private->property_dialog); + + gl_debug (DEBUG_VIEW, "END"); +} + + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Object moved callback. */ +/*---------------------------------------------------------------------------*/ +static void +object_moved_cb (glLabelObject *object, + gdouble dx, + gdouble dy, + glViewObject *view_object) +{ + GnomeCanvasItem *item, *highlight; + + gl_debug (DEBUG_VIEW, "START"); + + /* Adjust location of analogous canvas group. */ + gnome_canvas_item_move (view_object->private->group, dx, dy); + + /* Adjust location of highlight group */ + gnome_canvas_item_move (view_object->private->highlight, dx, dy); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. raise item to front callback. */ +/*---------------------------------------------------------------------------*/ +static void +raise_object_cb (GtkWidget * widget, + glViewObject *view_object) +{ + glLabelObject *object; + + gl_debug (DEBUG_VIEW, "START"); + + gnome_canvas_item_raise_to_top (view_object->private->group); + gnome_canvas_item_raise_to_top (view_object->private->highlight); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. lower item to back callback. */ +/*---------------------------------------------------------------------------*/ +static void +lower_object_cb (GtkWidget * widget, + glViewObject *view_object) +{ + glLabelObject *object; + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + /* Send to bottom */ + gnome_canvas_item_lower_to_bottom (view_object->private->group); + + /* now raise it above all items that form the backgound */ + gnome_canvas_item_raise (view_object->private->group, + view_object->private->view->n_bg_items); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Select object. */ +/*****************************************************************************/ +void +gl_view_object_select (glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + gl_view_select_object(view_object->private->view, view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + diff --git a/glabels2/src/view-object.h b/glabels2/src/view-object.h new file mode 100644 index 0000000..4defc53 --- /dev/null +++ b/glabels2/src/view-object.h @@ -0,0 +1,85 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_object.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_OBJECT_H__ +#define __VIEW_OBJECT_H__ + +#include <glib-object.h> +#include <gnome.h> +#include "label-object.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_OBJECT (gl_view_object_get_type ()) +#define GL_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_OBJECT, glViewObject)) +#define GL_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_OBJECT, glViewObjectClass)) +#define GL_IS_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_OBJECT)) +#define GL_IS_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_OBJECT)) + +typedef struct _glViewObject glViewObject; +typedef struct _glViewObjectClass glViewObjectClass; + +typedef struct _glViewObjectPrivate glViewObjectPrivate; + + +#include "view.h" +#include "view-highlight.h" + +struct _glViewObject { + GObject parent_object; + + glViewObjectPrivate *private; +}; + +struct _glViewObjectClass { + GObjectClass parent_class; +}; + +extern GType gl_view_object_get_type (void); + +extern GObject *gl_view_object_new (void); + +extern void gl_view_object_set_view (glViewObject *view_object, + glView *view); +extern void gl_view_object_set_object (glViewObject *view_object, + glLabelObject *object, + glViewHighlightStyle style); +extern void gl_view_object_set_dialog (glViewObject *view_object, + GtkWidget *dialog); + +extern glView *gl_view_object_get_view (glViewObject *view_object); +extern glLabelObject *gl_view_object_get_object (glViewObject *view_object); +extern GnomeCanvasItem *gl_view_object_get_group (glViewObject *view_object); +extern GtkMenu *gl_view_object_get_menu (glViewObject *view_object); + +extern void gl_view_object_update_highlight (glViewObject *view_object); +extern void gl_view_object_show_highlight (glViewObject *view_object); +extern void gl_view_object_hide_highlight (glViewObject *view_object); + +extern void gl_view_object_show_dialog (glViewObject *view_object); + +extern void gl_view_object_select (glViewObject *view_object); + +G_END_DECLS + +#endif /* __VIEW_OBJECT_H__ */ diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c new file mode 100644 index 0000000..228f0c7 --- /dev/null +++ b/glabels2/src/view-text.c @@ -0,0 +1,759 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_text.c: GLabels label text object widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <glib.h> + +#include <libgnomeprint/gnome-glyphlist.h> + +#include "view-text.h" +#include "canvas-hacktext.h" + +#include "view-highlight.h" + +#include "glabels.h" +#include "wdgt-text-entry.h" +#include "wdgt-text-props.h" +#include "wdgt-position.h" + +#include "pixmaps/cursor_text.xbm" +#include "pixmaps/cursor_text_mask.xbm" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +struct _glViewTextPrivate { + + GList *item_list; + + /* Page 0 widgets */ + GtkWidget *text_entry; + + /* Page 1 widgets */ + GtkWidget *text_props; + + /* Page 2 widgets */ + GtkWidget *position; +}; + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +static glViewObjectClass *parent_class = NULL; + + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static void gl_view_text_class_init (glViewTextClass *klass); +static void gl_view_text_instance_init (glViewText *view_text); +static void gl_view_text_finalize (GObject *object); + +static void update_view_text_cb (glLabelObject *object, + glViewText *view_text); + +static GtkWidget *construct_properties_dialog (glViewText *view_text); + +static void response_cb (GtkDialog *dialog, + gint response, + glViewText *view_text); + +static void text_entry_changed_cb (glWdgtTextEntry *text_entry, + glViewText *view_text); + +static void text_props_changed_cb (glWdgtTextProps *text_props, + glViewText *view_text); + +static void position_changed_cb (glWdgtPosition *position, + glViewText *view_text); + +static void update_dialog_cb (glLabelObject *object, + glViewText *view_text); + +static void draw_hacktext (glViewText *view_text); + + +/*****************************************************************************/ +/* Boilerplate object stuff. */ +/*****************************************************************************/ +GType +gl_view_text_get_type (void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof (glViewTextClass), + NULL, + NULL, + (GClassInitFunc) gl_view_text_class_init, + NULL, + NULL, + sizeof (glViewText), + 0, + (GInstanceInitFunc) gl_view_text_instance_init, + }; + + type = g_type_register_static (GL_TYPE_VIEW_OBJECT, + "glViewText", &info, 0); + } + + return type; +} + +static void +gl_view_text_class_init (glViewTextClass *klass) +{ + GObjectClass *object_class = (GObjectClass *) klass; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gl_view_text_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_text_instance_init (glViewText *view_text) +{ + gl_debug (DEBUG_VIEW, "START"); + + view_text->private = g_new0 (glViewTextPrivate, 1); + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_text_finalize (GObject *object) +{ + glLabel *parent; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object && GL_IS_VIEW_TEXT (object)); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* NEW text object view. */ +/*****************************************************************************/ +glViewObject * +gl_view_text_new (glLabelText *object, + glView *view) +{ + glViewText *view_text; + GtkMenu *menu; + GtkWidget *dialog; + + gl_debug (DEBUG_VIEW, "START"); + g_return_if_fail (object && GL_IS_LABEL_TEXT (object)); + g_return_if_fail (view && GL_IS_VIEW (view)); + + view_text = g_object_new (gl_view_text_get_type(), NULL); + + gl_view_object_set_view (GL_VIEW_OBJECT(view_text), view); + gl_view_object_set_object (GL_VIEW_OBJECT(view_text), + GL_LABEL_OBJECT(object), + GL_VIEW_HIGHLIGHT_SIMPLE); + + /* Create analogous canvas item. */ + draw_hacktext (view_text); + + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_view_text_cb), view_text); + + /* Create a dialog for controlling/viewing object properties. */ + dialog = construct_properties_dialog (view_text); + gl_view_object_set_dialog (GL_VIEW_OBJECT(view_text), dialog); + + gl_debug (DEBUG_VIEW, "END"); + + return GL_VIEW_OBJECT (view_text); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_view_text_cb (glLabelObject *object, + glViewText *view_text) +{ + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + view = gl_view_object_get_view (GL_VIEW_OBJECT(view_text)); + + /* Adjust appearance of analogous canvas item. */ + draw_hacktext (view_text); + + /* Adjust highlight */ + gl_view_object_update_highlight (GL_VIEW_OBJECT(view_text)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Create a properties dialog for a text object. */ +/*****************************************************************************/ +static GtkWidget * +construct_properties_dialog (glViewText *view_text) +{ + GtkWidget *dialog, *notebook, *wvbox, *wbutton; + BonoboWindow *win = glabels_get_active_window (); + glLabelObject *object; + gdouble x, y, w, h, label_width, label_height; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + glMerge *merge; + + gl_debug (DEBUG_VIEW, "START"); + + /* retrieve object and query parameters */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + lines = gl_label_text_get_lines(GL_LABEL_TEXT(object)); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, + &font_weight, &font_italic_flag, + &color, &just); + gl_label_get_size (GL_LABEL(object->parent), + &label_width, &label_height); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + gl_debug (DEBUG_VIEW, "Creating dialog..."); + dialog = gtk_dialog_new_with_buttons ( _("Edit text object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, + GTK_RESPONSE_CLOSE, + NULL ); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (response_cb), view_text); + + notebook = gtk_notebook_new (); + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), + notebook, TRUE, TRUE, 0); + + /*---------------------------*/ + /* Text Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating text tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Text"))); + + /* text entry */ + gl_debug (DEBUG_VIEW, "Creating text entry..."); + view_text->private->text_entry = + gl_wdgt_text_entry_new ("Text", merge->field_defs); + gl_debug (DEBUG_VIEW, "1"); + gl_wdgt_text_entry_set_text (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry), + (merge->type != GL_MERGE_NONE), + lines); + gl_debug (DEBUG_VIEW, "2"); + gtk_box_pack_start (GTK_BOX (wvbox), view_text->private->text_entry, + FALSE, FALSE, 0); + gl_debug (DEBUG_VIEW, "3"); + g_signal_connect ( G_OBJECT(view_text->private->text_entry), + "changed", G_CALLBACK (text_entry_changed_cb), + view_text); + + + /*---------------------------*/ + /* Text Props Notebook Tab */ + /*---------------------------*/ + gl_debug (DEBUG_VIEW, "Creating props tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Appearance"))); + + /* text props entry */ + gl_debug (DEBUG_VIEW, "Creating props entry..."); + view_text->private->text_props = + gl_wdgt_text_props_new ("Text Properties"); + gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props), + font_family, font_size, font_weight, + font_italic_flag, color, just); + gtk_box_pack_start (GTK_BOX (wvbox), view_text->private->text_props, + FALSE, FALSE, 0); + g_signal_connect ( G_OBJECT(view_text->private->text_props), + "changed", G_CALLBACK (text_props_changed_cb), + view_text); + + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + gl_debug (DEBUG_VIEW, "Creating position tab..."); + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, + gtk_label_new (_("Position"))); + + /* ------ Position Frame ------ */ + gl_debug (DEBUG_VIEW, "Creating position entry..."); + view_text->private->position = gl_wdgt_position_new (_("Position")); + gl_wdgt_position_set_params (GL_WDGT_POSITION (view_text->private->position), + x, y, + label_width, label_height); + gtk_box_pack_start (GTK_BOX (wvbox), + view_text->private->position, + FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (view_text->private->position), + "changed", + G_CALLBACK(position_changed_cb), view_text); + + + /*----------------------------*/ + /* Track object changes. */ + /*----------------------------*/ + g_signal_connect (G_OBJECT (object), "changed", + G_CALLBACK (update_dialog_cb), view_text); + + gl_debug (DEBUG_VIEW, "END"); + + return dialog; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Response" callback. */ +/*---------------------------------------------------------------------------*/ +static void +response_cb (GtkDialog *dialog, + gint response, + glViewText *view_text) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); + + switch(response) { + case GTK_RESPONSE_CLOSE: + gtk_widget_hide (GTK_WIDGET(dialog)); + break; + default: + g_assert_not_reached(); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. text_entry "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +text_entry_changed_cb (glWdgtTextEntry *text_entry, + glViewText *view_text) +{ + glLabelObject *object; + GList *lines; + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + lines = gl_wdgt_text_entry_get_text (text_entry); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + + gl_text_node_lines_free (&lines); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. text_props "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +text_props_changed_cb (glWdgtTextProps *text_props, + glViewText *view_text) +{ + glLabelObject *object; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + + + gl_debug (DEBUG_VIEW, "START"); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + gl_wdgt_text_props_get_params (text_props, + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + gl_label_text_set_props (GL_LABEL_TEXT(object), + font_family, font_size, font_weight, + font_italic_flag, + color, just); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + + g_free (font_family); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. position "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +position_changed_cb (glWdgtPosition *position, + glViewText *view_text) +{ + glLabelObject *object; + gdouble x, y; + + gl_debug (DEBUG_VIEW, "START"); + + gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y); + + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + g_signal_handlers_block_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); + g_signal_handlers_unblock_by_func (G_OBJECT(object), + update_dialog_cb, view_text); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. label object "changed" callback. */ +/*---------------------------------------------------------------------------*/ +static void +update_dialog_cb (glLabelObject *object, + glViewText *view_text) +{ + gdouble x, y; + GList *lines; + glMerge *merge; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query properties of object. */ + lines = gl_label_text_get_lines(GL_LABEL_TEXT(object)); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, + &font_weight, &font_italic_flag, + &color, &just); + gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); + merge = gl_label_get_merge (GL_LABEL(object->parent)); + + /* Block widget handlers to prevent recursion */ + g_signal_handlers_block_by_func (G_OBJECT(view_text->private->text_entry), + text_entry_changed_cb, view_text); + g_signal_handlers_block_by_func (G_OBJECT(view_text->private->text_props), + text_props_changed_cb, view_text); + g_signal_handlers_block_by_func (G_OBJECT(view_text->private->position), + position_changed_cb, view_text); + + /* Update widgets in property dialog */ + + gl_wdgt_text_entry_set_text (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry), + (merge->type != GL_MERGE_NONE), + lines); + gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props), + font_family, font_size, font_weight, + font_italic_flag, color, just); + gl_wdgt_position_set_position (GL_WDGT_POSITION(view_text->private->position), + x, y); + + /* Unblock widget handlers */ + g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->text_entry), + text_entry_changed_cb, view_text); + g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->text_props), + text_props_changed_cb, view_text); + g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->position), + position_changed_cb, view_text); + + gl_text_node_lines_free (&lines); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_view_text_get_create_cursor (void) +{ + static GdkCursor *cursor = NULL; + GdkPixmap *pixmap_data, *pixmap_mask; + GdkColor fg = { 0, 0, 0, 0 }; + GdkColor bg = { 0, 65535, 65535, 65535 }; + + gl_debug (DEBUG_VIEW, "START"); + + if (!cursor) { + pixmap_data = gdk_bitmap_create_from_data (NULL, + cursor_text_bits, + cursor_text_width, + cursor_text_height); + pixmap_mask = gdk_bitmap_create_from_data (NULL, + cursor_text_mask_bits, + cursor_text_mask_width, + cursor_text_mask_height); + cursor = + gdk_cursor_new_from_pixmap (pixmap_data, pixmap_mask, &fg, + &bg, cursor_text_x_hot, + cursor_text_y_hot); + } + + gl_debug (DEBUG_VIEW, "END"); + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler for creating text objects. */ +/*****************************************************************************/ +int +gl_view_text_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static glViewObject *view_text; + static GObject *object; + gdouble x, y; + GList *lines; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + NULL, NULL, event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = gl_label_text_new (view->label); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + lines = gl_text_node_lines_new_from_text (_("Text")); + gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); + view_text = gl_view_text_new (GL_LABEL_TEXT(object), + view); + x0 = x; + y0 = y; + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + gl_view_unselect_all (view); + gl_view_object_select (GL_VIEW_OBJECT(view_text)); + gl_view_arrow_mode (view); + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + gl_label_object_set_position (GL_LABEL_OBJECT(object), + x, y); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw hacktext to item (group). */ +/*--------------------------------------------------------------------------*/ +static void +draw_hacktext (glViewText *view_text) +{ + glLabelObject *object; + GnomeCanvasItem *group, *item; + GList *lines; + gchar *text; + gchar *font_family; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + gdouble font_size; + guint color; + GtkJustification just; + GnomeFont *font; + GnomeGlyphList *glyphlist; + ArtDRect bbox; + gdouble affine[6]; + gdouble x_offset, y_offset, w, object_w, object_h; + gint i; + gchar **line; + GList *li; + + gl_debug (DEBUG_VIEW, "START"); + + /* Query label object and properties */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + gl_label_object_get_size (object, &object_w, &object_h); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, + &font_weight, &font_italic_flag, + &color, &just); + lines = gl_label_text_get_lines(GL_LABEL_TEXT(object)); + text = gl_text_node_lines_expand (lines, NULL); + line = g_strsplit (text, "\n", -1); + + /* get parent item/group to render to. */ + group = gl_view_object_get_group (GL_VIEW_OBJECT(view_text)); + + /* remove previous items from group. */ + for (li = view_text->private->item_list; li != NULL; li = li->next) { + gl_debug (DEBUG_VIEW, "in loop"); + gtk_object_destroy (GTK_OBJECT (li->data)); + } + gl_debug (DEBUG_VIEW, "1"); + g_list_free (view_text->private->item_list); + view_text->private->item_list = NULL; + gl_debug (DEBUG_VIEW, "2"); + + /* get Gnome Font */ + font = gnome_font_find_closest_from_weight_slant (font_family, + font_weight, + font_italic_flag, + font_size); + art_affine_identity (affine); + + /* render to group, one item per line. */ + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, color, + 0.0, 0.0, + line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + w = bbox.x1; + + switch (just) { + case GTK_JUSTIFY_LEFT: + x_offset = 0.0; + break; + case GTK_JUSTIFY_CENTER: + x_offset = (object_w - w) / 2.0; + break; + case GTK_JUSTIFY_RIGHT: + x_offset = object_w - w; + break; + default: + x_offset = 0.0; + break; /* shouldn't happen */ + } + + y_offset = + (i + 1) * font_size + gnome_font_get_descender (font); + + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gl_canvas_hacktext_get_type (), + "x", x_offset, + "y", y_offset, + "glyphlist", glyphlist, NULL); + view_text->private->item_list = + g_list_prepend (view_text->private->item_list, item); + + } + + /* clean up */ + g_strfreev (line); + gl_text_node_lines_free (&lines); + g_free (text); + + gl_debug (DEBUG_VIEW, "END"); +} + diff --git a/glabels2/src/view-text.h b/glabels2/src/view-text.h new file mode 100644 index 0000000..392f467 --- /dev/null +++ b/glabels2/src/view-text.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view_text.h: GLabels canvas item wrapper widget + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_TEXT_H__ +#define __VIEW_TEXT_H__ + +#include "view-object.h" +#include "label-text.h" + +G_BEGIN_DECLS + + +#define GL_TYPE_VIEW_TEXT (gl_view_text_get_type ()) +#define GL_VIEW_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_TEXT, glViewText)) +#define GL_VIEW_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_TEXT, glViewTextClass)) +#define GL_IS_VIEW_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_TEXT)) +#define GL_IS_VIEW_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_TEXT)) + +typedef struct _glViewText glViewText; +typedef struct _glViewTextClass glViewTextClass; + +typedef struct _glViewTextPrivate glViewTextPrivate; + +struct _glViewText { + glViewObject parent_object; + + glViewTextPrivate *private; +}; + +struct _glViewTextClass { + glViewObjectClass parent_class; +}; + + +extern GType gl_view_text_get_type (void); + +extern glViewObject *gl_view_text_new (glLabelText *object, + glView *view); + + +/* cursor for creating text objects */ +extern GdkCursor *gl_view_text_get_create_cursor (void); + +/* event handler for creating text objects */ +extern gint gl_view_text_create_event_handler (GnomeCanvas *canvas, + GdkEvent *event, + glView *view); + +G_END_DECLS + +#endif /* __VIEW_TEXT_H__ */ diff --git a/glabels2/src/view.c b/glabels2/src/view.c new file mode 100644 index 0000000..d6e3a3d --- /dev/null +++ b/glabels2/src/view.c @@ -0,0 +1,1885 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view.c: GLabels View module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gtk/gtk.h> +#include <gtk/gtkinvisible.h> + +#include <string.h> +#include <math.h> + +#include "view.h" +#include "view-object.h" +#include "view-box.h" +#include "view-ellipse.h" +#include "view-line.h" +#include "view-image.h" +#include "view-text.h" +#include "view-barcode.h" +#include "xml-label.h" + +#include "debug.h" + +#define SEL_LINE_COLOR GNOME_CANVAS_COLOR_A (0, 0, 255, 128) +#define SEL_FILL_COLOR GNOME_CANVAS_COLOR_A (192, 192, 255, 128) + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +/* "CLIPBOARD" selection */ +static GdkAtom clipboard_atom = GDK_NONE; + +#define HOME_SCALE 2.0 +static gdouble scales[] = { 8.0, 6.0, 4.0, 3.0, + 2.0, + 1.5, 1.0, 0.5, 0.25, + 0.0 +}; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_view_class_init (glViewClass *class); +static void gl_view_init (glView * view); +static void gl_view_finalize (GObject * object); + +static void gl_view_construct (glView *view); +static GtkWidget *gl_view_construct_canvas (glView *view); +static void gl_view_construct_selection (glView *view); + +static gdouble get_apropriate_scale (gdouble w, gdouble h); + +static void draw_rect_bg (glView * view); +static void draw_rounded_rect_bg (glView * view); +static void draw_round_bg (glView * view); +static void draw_cd_bg (glView * view); + +static int canvas_event (GnomeCanvas * canvas, + GdkEvent * event, + glView *view); +static int canvas_event_arrow_mode (GnomeCanvas * canvas, + GdkEvent * event, glView *view); + +static void select_region (glView * view, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); +static void select_object (glViewObject *view_object); +static void unselect_object (glViewObject *view_object); +static gboolean object_at (glView * view, + gdouble x, gdouble y); +static gboolean object_selected (glViewObject *view_object); +static gboolean multiple_items_selected (glView * view); + +static int item_event_arrow_mode (GnomeCanvasItem * item, + GdkEvent * event, + glViewObject *view_object); + +static GtkWidget *new_selection_menu (glView * view); + +static void popup_selection_menu (glView *view, + glViewObject *view_object, GdkEvent *event); + +static void move_selected_items (glView * view, gdouble dx, gdouble dy); +static void move_item (GnomeCanvasItem * item, gdouble dx, gdouble dy); + +static void raise_selection_cb (GtkWidget * widget, glView * view); +static void lower_selection_cb (GtkWidget * widget, glView * view); + +static void selection_clear_cb (GtkWidget * widget, + GdkEventSelection * event, gpointer data); + +static void selection_get_cb (GtkWidget * widget, + GtkSelectionData * selection_data, guint info, + guint time, gpointer data); + +static void selection_received_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint time, gpointer data); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_view_get_type (void) +{ + static guint view_type = 0; + + if (!view_type) { + GTypeInfo view_info = { + sizeof (glViewClass), + NULL, + NULL, + (GClassInitFunc) gl_view_class_init, + NULL, + NULL, + sizeof (glView), + 0, + (GInstanceInitFunc) gl_view_init, + }; + + view_type = + g_type_register_static (gtk_vbox_get_type (), + "glView", &view_info, 0); + } + + return view_type; +} + +static void +gl_view_class_init (glViewClass * class) +{ + GObjectClass *object_class = (GObjectClass *) class; + + gl_debug (DEBUG_VIEW, "START"); + + parent_class = g_type_class_peek_parent (class); + + object_class->finalize = gl_view_finalize; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_init (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + view->label = NULL; + + gl_debug (DEBUG_VIEW, "END"); +} + +static void +gl_view_finalize (GObject * object) +{ + glView *view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_VIEW (object)); + + view = GL_VIEW (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_VIEW, "END"); +} + +GtkWidget * +gl_view_new (glLabel * label) +{ + glView *view = g_object_new (gl_view_get_type (), NULL); + + gl_debug (DEBUG_VIEW, "START"); + + view->label = label; + + gl_view_construct (view); + + gl_debug (DEBUG_VIEW, "END"); + + return GTK_WIDGET (view); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_view_construct (glView * view) +{ + GtkWidget *wvbox, *wscroll; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + wvbox = GTK_WIDGET (view); + + view->state = GL_VIEW_STATE_ARROW; + view->object_list = NULL; + + gl_view_construct_canvas (view); + wscroll = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (wvbox), wscroll, TRUE, TRUE, 0); + gtk_container_add (GTK_CONTAINER (wscroll), view->canvas); + + gl_view_construct_selection (view); + + view->menu = new_selection_menu (view); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create canvas w/ a background in the shape of the label/card. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +gl_view_construct_canvas (glView * view) +{ + gdouble scale; + glLabel *label = view->label; + gdouble label_width, label_height; + glTemplate *label_template; + GList *p_obj; + glLabelObject *object; + glViewObject *view_object; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_val_if_fail (GL_IS_VIEW (view), NULL); + g_return_val_if_fail (label != NULL, NULL); + + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + view->canvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + + gl_label_get_size (label, &label_width, &label_height); + gl_debug (DEBUG_VIEW, "Label size: w=%lf, h=%lf", + label_width, label_height); + label_template = gl_label_get_template (label); + + scale = get_apropriate_scale (label_width, label_height); + gl_debug (DEBUG_VIEW, "scale =%lf", scale); + + gl_debug (DEBUG_VIEW, "Canvas size: w=%lf, h=%lf", + scale * label_width + 40, + scale * label_height + 40); + gtk_widget_set_size_request (GTK_WIDGET(view->canvas), + scale * label_width + 40, + scale * label_height + 40); + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas), + scale); + view->scale = scale; + + gnome_canvas_set_scroll_region (GNOME_CANVAS (view->canvas), + 0.0, 0.0, label_width, label_height); + + /* Draw background shape of label/card */ + switch (label_template->style) { + + case GL_TEMPLATE_STYLE_RECT: + if (label_template->label_round == 0.0) { + /* Square corners. */ + draw_rect_bg (view); + } else { + /* Rounded corners. */ + draw_rounded_rect_bg (view); + } + break; + + case GL_TEMPLATE_STYLE_ROUND: + draw_round_bg (view); + break; + + case GL_TEMPLATE_STYLE_CD: + draw_cd_bg (view); + break; + + default: + g_warning ("Unknown template label style"); + break; + } + + g_signal_connect (G_OBJECT (view->canvas), "event", + G_CALLBACK (canvas_event), view); + + for (p_obj = label->objects; p_obj != NULL; p_obj = p_obj->next) { + object = (glLabelObject *) p_obj->data; + + if (GL_IS_LABEL_BOX (object)) { + view_object = gl_view_box_new (GL_LABEL_BOX(object), + view); + } else if (GL_IS_LABEL_ELLIPSE (object)) { + view_object = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), + view); + } else if (GL_IS_LABEL_LINE (object)) { + view_object = gl_view_line_new (GL_LABEL_LINE(object), + view); + } else if (GL_IS_LABEL_IMAGE (object)) { + view_object = gl_view_image_new (GL_LABEL_IMAGE(object), + view); + } else if (GL_IS_LABEL_TEXT (object)) { + view_object = gl_view_text_new (GL_LABEL_TEXT(object), + view); + } else if (GL_IS_LABEL_BARCODE (object)) { + view_object = gl_view_barcode_new (GL_LABEL_BARCODE(object), + view); + } else { + /* Should not happen! */ + view_object = NULL; + g_warning ("Invalid label object type."); + } + } + + gl_debug (DEBUG_VIEW, "END"); + + return view->canvas; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create selection targets. */ +/*---------------------------------------------------------------------------*/ +static void +gl_view_construct_selection (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + view->have_selection = FALSE; + view->selection_data = NULL; + view->invisible = gtk_invisible_new (); + + view->selected_object_list = NULL; + + if (!clipboard_atom) { + clipboard_atom = gdk_atom_intern ("GLABELS_CLIPBOARD", FALSE); + } + + gtk_selection_add_target (view->invisible, + clipboard_atom, GDK_SELECTION_TYPE_STRING, 1); + + g_signal_connect (G_OBJECT (view->invisible), + "selection_clear_event", + G_CALLBACK (selection_clear_cb), view); + + g_signal_connect (G_OBJECT (view->invisible), "selection_get", + G_CALLBACK (selection_get_cb), view); + + g_signal_connect (G_OBJECT (view->invisible), + "selection_received", + G_CALLBACK (selection_received_cb), view); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Determine an apropriate scale for given label & screen size */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_apropriate_scale (gdouble w, gdouble h) +{ + gdouble w_screen, h_screen; + gint i; + gdouble k; + + gl_debug (DEBUG_VIEW, ""); + + w_screen = (gdouble) gdk_screen_width (); + h_screen = (gdouble) gdk_screen_height (); + + for (i = 0; scales[i] > 0.0; i++) { + k = scales[i]; + if (k <= HOME_SCALE) { + if ((k * w < (w_screen - 256)) + && (k * h < (h_screen - 256))) + return k; + } + } + + return 0.25; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw simple recangular background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_rect_bg (glView * view) +{ + glLabel *label = view->label; + glTemplate *template; + gdouble w, h, margin; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + gl_label_get_size (label, &w, &h); + template = gl_label_get_template (label); + margin = template->label_margin; + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", w, + "y2", h, + "fill_color", "white", + NULL); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", margin, + "y1", margin, + "x2", w - margin, + "y2", h - margin, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw rounded recangular background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_rounded_rect_bg (glView * view) +{ + glLabel *label = view->label; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + glTemplate *template; + gdouble r, w, h, m; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + gl_label_get_size (label, &w, &h); + template = gl_label_get_template (label); + r = template->label_round; + m = template->label_margin; + + points = gnome_canvas_points_new (4 * (1 + 90 / 5)); + i_coords = 0; + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + r - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r - r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + r - r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + (h - r) + r * sin (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + (w - r) + r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + (h - r) + r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + (w - r) + r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r - r * sin (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "fill_color", "white", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + if (template->label_margin >= template->label_round) { + /* simple rectangle */ + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", m, + "y1", m, + "x2", w - m, + "y2", h - m, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + view->n_bg_items++; + view->bg_item_list = + g_list_append (view->bg_item_list, item); + } else { + r = r - m; + w = w - 2 * m; + h = h - 2 * m; + + /* rectangle with rounded corners */ + points = gnome_canvas_points_new (4 * (1 + 90 / 5)); + i_coords = 0; + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + r - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + r - r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + r - r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + (h - r) + r * sin (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + (w - r) + r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + (h - r) + r * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 90; i_theta += 5) { + points->coords[i_coords++] = + m + (w - r) + r * cos (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + m + r - r * sin (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = + g_list_append (view->bg_item_list, item); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw round background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_round_bg (glView * view) +{ + glLabel *label = view->label; + glTemplate *template; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, r1; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + template = gl_label_get_template (label); + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + r1 = template->label_radius; + points = gnome_canvas_points_new (1 + 360/2); + i_coords = 0; + for (i_theta = 0; i_theta <= 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r1 * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r1 * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "fill_color", "white", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + r = template->label_radius - template->label_margin; + points = gnome_canvas_points_new (360 / 2); + i_coords = 0; + for (i_theta = 0; i_theta < 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw CD style background, circular w/ concentric hole. */ +/*---------------------------------------------------------------------------*/ +static void +draw_cd_bg (glView * view) +{ + glLabel *label = view->label; + glTemplate *template; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, r1, r2; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (label != NULL); + + template = gl_label_get_template (label); + + group = gnome_canvas_root (GNOME_CANVAS (view->canvas)); + + view->n_bg_items = 0; + view->bg_item_list = NULL; + + r1 = template->label_radius; + r2 = template->label_hole; + points = gnome_canvas_points_new (2 * (1 + 360 / 2)); + i_coords = 0; + for (i_theta = 0; i_theta <= 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r1 * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r1 * cos (i_theta * M_PI / 180.0); + } + for (i_theta = 0; i_theta <= 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r2 * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r2 * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "fill_color", "white", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* Bounding box @ margin */ + /* outer margin */ + r = template->label_radius - template->label_margin; + points = gnome_canvas_points_new (360 / 2); + i_coords = 0; + for (i_theta = 0; i_theta < 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + /* inner margin */ + r = template->label_hole + template->label_margin; + points = gnome_canvas_points_new (360 / 2); + i_coords = 0; + for (i_theta = 0; i_theta < 360; i_theta += 2) { + points->coords[i_coords++] = + r1 - r * sin (i_theta * M_PI / 180.0); + points->coords[i_coords++] = + r1 - r * cos (i_theta * M_PI / 180.0); + } + item = gnome_canvas_item_new (group, + gnome_canvas_polygon_get_type (), + "points", points, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + gnome_canvas_points_free (points); + view->n_bg_items++; + view->bg_item_list = g_list_append (view->bg_item_list, item); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set arrow mode. */ +/*****************************************************************************/ +void +gl_view_arrow_mode (glView * view) +{ + static GdkCursor *cursor = NULL; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (!cursor) { + cursor = gdk_cursor_new (GDK_LEFT_PTR); + } + + gdk_window_set_cursor (view->canvas->window, cursor); + + view->state = GL_VIEW_STATE_ARROW; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set create text object mode. */ +/*****************************************************************************/ +void +gl_view_object_create_mode (glView * view, + glLabelObjectType type) +{ + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + switch (type) { + case GL_LABEL_OBJECT_BOX: + cursor = gl_view_box_get_create_cursor (); + break; + case GL_LABEL_OBJECT_ELLIPSE: + cursor = gl_view_ellipse_get_create_cursor (); + break; + case GL_LABEL_OBJECT_LINE: + cursor = gl_view_line_get_create_cursor (); + break; + case GL_LABEL_OBJECT_IMAGE: + cursor = gl_view_image_get_create_cursor (); + break; + case GL_LABEL_OBJECT_TEXT: + cursor = gl_view_text_get_create_cursor (); + break; + case GL_LABEL_OBJECT_BARCODE: + cursor = gl_view_barcode_get_create_cursor (); + break; + default: + g_warning ("Invalid label object type.");/*Should not happen!*/ + break; + } + + gdk_window_set_cursor (view->canvas->window, cursor); + + view->state = GL_VIEW_STATE_OBJECT_CREATE; + view->create_type = type; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Select given object. */ +/*****************************************************************************/ +void +gl_view_select_object (glView *view, glViewObject *view_object) +{ + gl_debug (DEBUG_VIEW, "START"); + + select_object (view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Select all items. */ +/*****************************************************************************/ +void +gl_view_select_all (glView * view) +{ + GList *p; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + gl_view_unselect_all (view); + + for (p = view->object_list; p != NULL; p = p->next) { + select_object (GL_VIEW_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Remove all selections */ +/*****************************************************************************/ +void +gl_view_unselect_all (glView * view) +{ + GList *p, *p_next; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p_next) { + p_next = p->next; + unselect_object (GL_VIEW_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* "Cut" selected items and place in clipboard selections. */ +/*****************************************************************************/ +void +gl_view_cut (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + gl_view_copy (view); + gl_view_delete_selection (view); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* "Copy" selected items to clipboard selections. */ +/*****************************************************************************/ +void +gl_view_copy (glView * view) +{ + GList *p; + glViewObject *view_object; + glLabelObject *object; + glTemplate *template; + gboolean rotate_flag; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (view->selected_object_list) { + + if ( view->selection_data ) { + g_object_unref (view->selection_data); + } + template = gl_label_get_template (view->label); + rotate_flag = gl_label_get_rotate_flag (view->label); + view->selection_data = GL_LABEL(gl_label_new ()); + gl_label_set_template (view->selection_data, template); + gl_label_set_rotate_flag (view->selection_data, rotate_flag); + gl_template_free (&template); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + + view_object = GL_VIEW_OBJECT (p->data); + object = gl_view_object_get_object (view_object); + + gl_debug (DEBUG_VIEW, "Object copied"); + + if (GL_IS_LABEL_BOX (object)) { + gl_label_box_dup (GL_LABEL_BOX(object), + view->selection_data); + } else if (GL_IS_LABEL_ELLIPSE (object)) { + gl_label_ellipse_dup (GL_LABEL_ELLIPSE(object), + view->selection_data); + } else if (GL_IS_LABEL_LINE (object)) { + gl_label_line_dup (GL_LABEL_LINE(object), + view->selection_data); + } else if (GL_IS_LABEL_IMAGE (object)) { + gl_label_image_dup (GL_LABEL_IMAGE(object), + view->selection_data); + } else if (GL_IS_LABEL_TEXT (object)) { + gl_label_text_dup (GL_LABEL_TEXT(object), + view->selection_data); + } else if (GL_IS_LABEL_BARCODE (object)) { + gl_label_barcode_dup (GL_LABEL_BARCODE(object), + view->selection_data); + } else { + /* Should not happen! */ + g_warning ("Invalid label object type."); + } + + + } + + gtk_selection_owner_set (view->invisible, + clipboard_atom, GDK_CURRENT_TIME); + view->have_selection = TRUE; + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* "Paste" from private clipboard selection. */ +/*****************************************************************************/ +void +gl_view_paste (glView * view) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + gtk_selection_convert (GTK_WIDGET (view->invisible), + clipboard_atom, GDK_SELECTION_TYPE_STRING, + GDK_CURRENT_TIME); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler. */ +/*---------------------------------------------------------------------------*/ +static int +canvas_event (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + gl_debug (DEBUG_VIEW, ""); + + switch (view->state) { + + case GL_VIEW_STATE_ARROW: + return canvas_event_arrow_mode (canvas, event, view); + + case GL_VIEW_STATE_OBJECT_CREATE: + switch (view->create_type) { + case GL_LABEL_OBJECT_BOX: + return gl_view_box_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_ELLIPSE: + return gl_view_ellipse_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_LINE: + return gl_view_line_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_IMAGE: + return gl_view_image_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_TEXT: + return gl_view_text_create_event_handler (canvas, + event, + view); + break; + case GL_LABEL_OBJECT_BARCODE: + return gl_view_barcode_create_event_handler (canvas, + event, + view); + break; + default: + /*Should not happen!*/ + g_warning ("Invalid label object type."); + return FALSE; + } + + default: + g_warning ("Invalid view state."); /*Should not happen!*/ + return FALSE; + + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler (arrow mode) */ +/*---------------------------------------------------------------------------*/ +static int +canvas_event_arrow_mode (GnomeCanvas *canvas, + GdkEvent *event, + glView *view) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + gdouble x, y, x1, y1, x2, y2; + GnomeCanvasGroup *group; + GdkCursor *cursor; + + gl_debug (DEBUG_VIEW, ""); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + switch (event->button.button) { + case 1: + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + + if (!object_at (view, x, y)) { + if (!(event->button.state & GDK_CONTROL_MASK)) { + gl_view_unselect_all (view); + } + + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (view->canvas)-> + window, FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, NULL, + NULL, event->button.time); + group = + gnome_canvas_root (GNOME_CANVAS + (view->canvas)); + item = + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", x, "y1", y, + "x2", x, "y2", y, + "width_pixels", 2, + "outline_color_rgba", + SEL_LINE_COLOR, + "fill_color_rgba", + SEL_FILL_COLOR, + NULL); + x0 = x; + y0 = y; + + } + return FALSE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + if (dragging) { + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, + &x, &y); + x1 = MIN (x, x0); + y1 = MIN (y, y0); + x2 = MAX (x, x0); + y2 = MAX (y, y0); + select_region (view, x1, y1, x2, y2); + gtk_object_destroy (GTK_OBJECT (item)); + return TRUE; + } + return FALSE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + + gnome_canvas_item_set (item, + "x1", MIN (x, x0), + "y1", MIN (y, y0), + "x2", MAX (x, x0), + "y2", MAX (y, y0), NULL); + return TRUE; + } else { + return FALSE; + } + + case GDK_KEY_PRESS: + gl_debug (DEBUG_VIEW, "KEY_PRESS"); + if (!dragging) { + switch (event->key.keyval) { + case GDK_Left: + case GDK_KP_Left: + move_selected_items (view, + -1.0 / (view->scale), + 0.0); + break; + case GDK_Up: + case GDK_KP_Up: + move_selected_items (view, 0.0, + -1.0 / (view->scale)); + break; + case GDK_Right: + case GDK_KP_Right: + move_selected_items (view, + 1.0 / (view->scale), + 0.0); + break; + case GDK_Down: + case GDK_KP_Down: + move_selected_items (view, 0.0, + 1.0 / (view->scale)); + break; + case GDK_Delete: + case GDK_KP_Delete: + gl_view_delete_selection (view); + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, + cursor); + gdk_cursor_unref (cursor); + break; + default: + return FALSE; + } + } + return TRUE; /* We handled this or we were dragging. */ + + default: + gl_debug (DEBUG_VIEW, "default"); + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Select all objects within given rectangular region. */ +/*---------------------------------------------------------------------------*/ +static void +select_region (glView * view, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) +{ + GList *p; + glViewObject *view_object; + glLabelObject *object; + gdouble i_x1, i_y1, i_x2, i_y2, w, h; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail ((x1 <= x2) && (y1 <= y2)); + + for (p = view->object_list; p != NULL; p = p->next) { + view_object = GL_VIEW_OBJECT(p->data); + if (!object_selected (view_object)) { + + object = gl_view_object_get_object (view_object); + + gl_label_object_get_position (object, &i_x1, &i_y1); + gl_label_object_get_size (object, &w, &h); + i_x2 = i_x1 + w; + i_y2 = i_y1 + h; + if ((i_x1 >= x1) && (i_x2 <= x2) && (i_y1 >= y1) + && (i_y2 <= y2)) { + select_object (view_object); + } + + } + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Select an object. */ +/*---------------------------------------------------------------------------*/ +static void +select_object (glViewObject *view_object) +{ + glView * view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + view = gl_view_object_get_view (view_object); + + if (!object_selected (view_object)) { + view->selected_object_list = + g_list_prepend (view->selected_object_list, view_object); + } + gl_view_object_show_highlight (view_object); + gtk_widget_grab_focus (GTK_WIDGET (view->canvas)); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Un-select object. */ +/*---------------------------------------------------------------------------*/ +static void +unselect_object (glViewObject *view_object) +{ + glView * view; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + view = gl_view_object_get_view (view_object); + + gl_view_object_hide_highlight (view_object); + + view->selected_object_list = + g_list_remove (view->selected_object_list, view_object); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Return object at (x,y). */ +/*---------------------------------------------------------------------------*/ +static gboolean +object_at (glView * view, + gdouble x, + gdouble y) +{ + GnomeCanvasItem *item, *p_item; + GList *p; + + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW (view), FALSE); + + item = gnome_canvas_get_item_at (GNOME_CANVAS (view->canvas), x, y); + + /* No item is at x, y */ + if (item == NULL) + return FALSE; + + /* ignore our background items */ + if (g_list_find (view->bg_item_list, item) != NULL) + return FALSE; + + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Is the object in our current selection? */ +/*---------------------------------------------------------------------------*/ +static gboolean +object_selected (glViewObject *view_object) +{ + glView *view; + + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW_OBJECT (view_object), FALSE); + + view = gl_view_object_get_view (view_object); + if (g_list_find (view->selected_object_list, view_object) == NULL) { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Are there multiple objects in our current selection? */ +/*---------------------------------------------------------------------------*/ +static gboolean +multiple_items_selected (glView * view) +{ + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW (view), FALSE); + + if (view->selected_object_list == NULL) + return FALSE; + if (view->selected_object_list->next == NULL) + return FALSE; + return TRUE; +} + +/*****************************************************************************/ +/* Item event handler. */ +/*****************************************************************************/ +gint +gl_view_item_event_handler (GnomeCanvasItem *item, + GdkEvent *event, + glViewObject *view_object) +{ + glView *view; + + gl_debug (DEBUG_VIEW, ""); + + view = gl_view_object_get_view(view_object); + switch (view->state) { + + case GL_VIEW_STATE_ARROW: + return item_event_arrow_mode (item, event, view_object); + + default: + return FALSE; + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Item event handler (arrow mode) */ +/*---------------------------------------------------------------------------*/ +static int +item_event_arrow_mode (GnomeCanvasItem *item, + GdkEvent *event, + glViewObject *view_object) +{ + static gdouble x, y; + static gboolean dragging = FALSE; + glView *view; + GdkCursor *cursor; + gdouble item_x, item_y; + gdouble new_x, new_y; + gboolean control_key_pressed; + + gl_debug (DEBUG_VIEW, ""); + + item_x = event->button.x; + item_y = event->button.y; + gnome_canvas_item_w2i (item->parent, &item_x, &item_y); + + view = gl_view_object_get_view(view_object); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "BUTTON_PRESS"); + control_key_pressed = event->button.state & GDK_CONTROL_MASK; + switch (event->button.button) { + case 1: + if (control_key_pressed) { + if (object_selected (view_object)) { + /* Un-selecting a selected item */ + unselect_object (view_object); + return TRUE; + } else { + /* Add to current selection */ + select_object (view_object); + } + } else { + if (!object_selected (view_object)) { + /* No control, key so remove any selections before adding */ + gl_view_unselect_all (view); + /* Add to current selection */ + select_object (view_object); + } + } + /* Go into dragging mode while button remains pressed. */ + x = item_x; + y = item_y; + cursor = gdk_cursor_new (GDK_FLEUR); + gnome_canvas_item_grab (item, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, + cursor, event->button.time); + gdk_cursor_unref (cursor); + dragging = TRUE; + return TRUE; + + case 3: + if (!object_selected (view_object)) { + if (!control_key_pressed) { + /* No control, key so remove any selections before adding */ + gl_view_unselect_all (view); + } + } + /* Add to current selection */ + select_object (view_object); + /* bring up apropriate menu for selection. */ + popup_selection_menu (view, view_object, event); + return TRUE; + + default: + return FALSE; + } + + case GDK_BUTTON_RELEASE: + gl_debug (DEBUG_VIEW, "BUTTON_RELEASE"); + switch (event->button.button) { + case 1: + /* Exit dragging mode */ + gnome_canvas_item_ungrab (item, event->button.time); + dragging = FALSE; + return TRUE; + + default: + return FALSE; + } + + case GDK_MOTION_NOTIFY: + gl_debug (DEBUG_VIEW, "MOTION_NOTIFY"); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + /* Dragging mode, move selection */ + new_x = item_x; + new_y = item_y; + move_selected_items (view, (new_x - x), (new_y - y)); + x = new_x; + y = new_y; + return TRUE; + } else { + return FALSE; + } + + case GDK_2BUTTON_PRESS: + gl_debug (DEBUG_VIEW, "2BUTTON_PRESS"); + switch (event->button.button) { + case 1: + /* Also exit dragging mode w/ double-click, run dlg */ + gnome_canvas_item_ungrab (item, event->button.time); + dragging = FALSE; + select_object (view_object); + gl_view_object_show_dialog (view_object); + return TRUE; + + default: + return FALSE; + } + + case GDK_ENTER_NOTIFY: + gl_debug (DEBUG_VIEW, "ENTER_NOTIFY"); + cursor = gdk_cursor_new (GDK_FLEUR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + gl_debug (DEBUG_VIEW, "LEAVE_NOTIFY"); + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (view->canvas->window, cursor); + gdk_cursor_unref (cursor); + return TRUE; + + default: + gl_debug (DEBUG_VIEW, "default"); + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. create menu for multiple selections. */ +/*---------------------------------------------------------------------------*/ +GtkWidget * +new_selection_menu (glView * view) +{ + GtkWidget *menu, *menuitem; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_val_if_fail (GL_IS_VIEW (view), NULL); + + menu = gtk_menu_new (); + + menuitem = gtk_menu_item_new_with_label (_("Delete")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect_swapped (G_OBJECT (menuitem), "activate", + G_CALLBACK (gl_view_delete_selection), view); + + menuitem = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Bring to front")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect (G_OBJECT (menuitem), "activate", + G_CALLBACK (raise_selection_cb), view); + + menuitem = gtk_menu_item_new_with_label (_("Send to back")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + g_signal_connect (G_OBJECT (menuitem), "activate", + G_CALLBACK (lower_selection_cb), view); + + gl_debug (DEBUG_VIEW, "END"); + + return menu; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. popup menu for given item. */ +/*---------------------------------------------------------------------------*/ +static void +popup_selection_menu (glView *view, + glViewObject *view_object, + GdkEvent *event) +{ + GtkMenu *menu; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (GL_IS_VIEW_OBJECT (view_object)); + + if (multiple_items_selected (view)) { + if (view->menu != NULL) { + gtk_menu_popup (GTK_MENU (view->menu), + NULL, NULL, NULL, NULL, + event->button.button, + event->button.time); + } + } else { + + menu = gl_view_object_get_menu (view_object); + if (menu != NULL) { + gtk_menu_popup (GTK_MENU (menu), + NULL, NULL, NULL, NULL, + event->button.button, + event->button.time); + } + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* Delete selected objects. */ +/*---------------------------------------------------------------------------*/ +void +gl_view_delete_selection (glView * view) +{ + GList *p, *p_next; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p_next) { + p_next = p->next; + g_object_unref (G_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. raise item to front callback. */ +/*---------------------------------------------------------------------------*/ +static void +raise_selection_cb (GtkWidget * widget, + glView * view) +{ + GList *p; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + gl_label_object_raise_to_top (GL_LABEL_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. lower item to back callback. */ +/*---------------------------------------------------------------------------*/ +static void +lower_selection_cb (GtkWidget * widget, + glView * view) +{ + GList *p; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + gl_label_object_lower_to_bottom (GL_LABEL_OBJECT (p->data)); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. move selected items */ +/*---------------------------------------------------------------------------*/ +static void +move_selected_items (glView * view, + gdouble dx, + gdouble dy) +{ + GList *p; + glLabelObject *object; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + for (p = view->selected_object_list; p != NULL; p = p->next) { + + object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data)); + gl_label_object_set_position_relative (object, dx, dy); + + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-clear" signal. */ +/*---------------------------------------------------------------------------*/ +static void +selection_clear_cb (GtkWidget * widget, + GdkEventSelection * event, + gpointer data) +{ + glView *view = GL_VIEW (data); + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + view->have_selection = FALSE; + g_object_unref (view->selection_data); + view->selection_data = NULL; + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-get" signal. */ +/*---------------------------------------------------------------------------*/ +static void +selection_get_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint info, + guint time, + gpointer data) +{ + glView *view = GL_VIEW (data); + gchar *buffer; + glXMLLabelStatus status; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (view->have_selection) { + + buffer = gl_xml_label_save_buffer (view->selection_data, + &status); + gtk_selection_data_set (selection_data, + GDK_SELECTION_TYPE_STRING, 8, buffer, + strlen (buffer)); + g_free (buffer); + } + + gl_debug (DEBUG_VIEW, "END"); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-received" signal. (Result of Paste) */ +/*---------------------------------------------------------------------------*/ +static void +selection_received_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint time, + gpointer data) +{ + glView *view = GL_VIEW (data); + glLabel *label = NULL; + glXMLLabelStatus status; + GList *p, *p_next; + glLabelObject *object, *newobject; + glViewObject *view_object; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + if (selection_data->length < 0) { + return; + } + if (selection_data->type != GDK_SELECTION_TYPE_STRING) { + return; + } + + gl_view_unselect_all (view); + + label = gl_xml_label_open_buffer (selection_data->data, &status); + for (p = label->objects; p != NULL; p = p_next) { + p_next = p->next; + + object = (glLabelObject *) p->data; + gl_label_object_set_parent (object, view->label); + + gl_debug (DEBUG_VIEW, "object pasted"); + + if (GL_IS_LABEL_BOX (object)) { + view_object = gl_view_box_new (GL_LABEL_BOX(object), + view); + } else if (GL_IS_LABEL_ELLIPSE (object)) { + view_object = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object), + view); + } else if (GL_IS_LABEL_LINE (object)) { + view_object = gl_view_line_new (GL_LABEL_LINE(object), + view); + } else if (GL_IS_LABEL_IMAGE (object)) { + view_object = gl_view_image_new (GL_LABEL_IMAGE(object), + view); + } else if (GL_IS_LABEL_TEXT (object)) { + view_object = gl_view_text_new (GL_LABEL_TEXT(object), + view); + } else if (GL_IS_LABEL_BARCODE (object)) { + view_object = gl_view_barcode_new (GL_LABEL_BARCODE(object), + view); + } else { + /* Should not happen! */ + view_object = NULL; + g_warning ("Invalid label object type."); + } + select_object (view_object); + } + g_object_unref (label); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Zoom in one "notch" */ +/*****************************************************************************/ +void +gl_view_zoom_in (glView * view) +{ + gint i, i_min; + gdouble dist, dist_min; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + /* Find index of current scale (or best match) */ + i_min = 1; /* start with 2nd largest scale */ + dist_min = fabs (scales[1] - view->scale); + for (i = 2; scales[i] != 0.0; i++) { + dist = fabs (scales[i] - view->scale); + if (dist < dist_min) { + i_min = i; + dist_min = dist; + } + } + + /* zoom in one "notch" */ + i = MAX (0, i_min - 1); + gl_view_set_zoom (view, scales[i] / HOME_SCALE); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Zoom out one "notch" */ +/*****************************************************************************/ +void +gl_view_zoom_out (glView * view) +{ + gint i, i_min; + gdouble dist, dist_min; + + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + + /* Find index of current scale (or best match) */ + i_min = 0; /* start with largest scale */ + dist_min = fabs (scales[0] - view->scale); + for (i = 1; scales[i] != 0.0; i++) { + dist = fabs (scales[i] - view->scale); + if (dist < dist_min) { + i_min = i; + dist_min = dist; + } + } + + /* zoom out one "notch" */ + if (scales[i_min] == 0.0) + return; + i = i_min + 1; + if (scales[i] == 0.0) + return; + gl_view_set_zoom (view, scales[i] / HOME_SCALE); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Set current zoom factor to explicit value. */ +/*****************************************************************************/ +void +gl_view_set_zoom (glView * view, + gdouble scale) +{ + gl_debug (DEBUG_VIEW, "START"); + + g_return_if_fail (GL_IS_VIEW (view)); + g_return_if_fail (scale > 0.0); + + view->scale = scale * HOME_SCALE; + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas), + scale * HOME_SCALE); + + gl_debug (DEBUG_VIEW, "END"); +} + +/*****************************************************************************/ +/* Get current zoom factor. */ +/*****************************************************************************/ +gdouble +gl_view_get_zoom (glView * view) +{ + gl_debug (DEBUG_VIEW, ""); + + g_return_val_if_fail (GL_IS_VIEW (view), 1.0); + + return view->scale / HOME_SCALE; +} diff --git a/glabels2/src/view.h b/glabels2/src/view.h new file mode 100644 index 0000000..813c084 --- /dev/null +++ b/glabels2/src/view.h @@ -0,0 +1,101 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * view.h: GLabels View module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __VIEW_H__ +#define __VIEW_H__ + +#include <gtk/gtk.h> +#include <libgnomecanvas/libgnomecanvas.h> + +#include "label-object.h" + +typedef enum { + GL_VIEW_STATE_ARROW, + GL_VIEW_STATE_OBJECT_CREATE +} glViewState; + +#define GL_TYPE_VIEW (gl_view_get_type ()) +#define GL_VIEW(obj) (GTK_CHECK_CAST((obj), GL_TYPE_VIEW, glView )) +#define GL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW, glViewClass)) +#define GL_IS_VIEW(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_VIEW)) +#define GL_IS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW)) + +typedef struct _glView glView; +typedef struct _glViewClass glViewClass; + +#include "view-object.h" + +struct _glView { + GtkVBox parent_widget; + + glLabel *label; + + GtkWidget *canvas; + gdouble scale; + gint n_bg_items; + GList *bg_item_list; + + glViewState state; + glLabelObjectType create_type; + + GList *object_list; + GList *selected_object_list; + + gint have_selection; + glLabel *selection_data; + GtkWidget *invisible; + + GtkWidget *menu; +}; + +struct _glViewClass { + GtkVBoxClass parent_class; +}; + +extern guint gl_view_get_type (void); + +extern GtkWidget *gl_view_new (glLabel * label); + +extern void gl_view_arrow_mode (glView * view); +extern void gl_view_object_create_mode (glView * view, + glLabelObjectType type); + +extern void gl_view_select_object (glView *view, glViewObject *view_object); +extern void gl_view_select_all (glView *view); +extern void gl_view_unselect_all (glView *view); +extern void gl_view_delete_selection (glView *view); + + +extern int gl_view_item_event_handler (GnomeCanvasItem * item, + GdkEvent * event, + glViewObject *view_object); + +extern void gl_view_cut (glView * view); +extern void gl_view_copy (glView * view); +extern void gl_view_paste (glView * view); + +extern void gl_view_zoom_in (glView * view); +extern void gl_view_zoom_out (glView * view); +extern void gl_view_set_zoom (glView * view, gdouble scale); +extern gdouble gl_view_get_zoom (glView * view); + +#endif diff --git a/glabels2/src/wdgt-bc-data.c b/glabels2/src/wdgt-bc-data.c new file mode 100644 index 0000000..7093cc4 --- /dev/null +++ b/glabels2/src/wdgt-bc-data.c @@ -0,0 +1,338 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_data.c: barcode data widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-bc-data.h" +#include "merge.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtBCDataSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_bc_data_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_bc_data_class_init (glWdgtBCDataClass * class); +static void gl_wdgt_bc_data_instance_init (glWdgtBCData * bc_data); +static void gl_wdgt_bc_data_finalize (GObject * object); +static void gl_wdgt_bc_data_construct (glWdgtBCData * bc_data, + gchar * label, GList * field_defs); + +static void changed_cb (glWdgtBCData * bc_data); +static void radio_toggled_cb (GtkToggleButton * togglebutton, + glWdgtBCData * bc_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_bc_data_get_type (void) +{ + static guint wdgt_bc_data_type = 0; + + if (!wdgt_bc_data_type) { + GTypeInfo wdgt_bc_data_info = { + sizeof (glWdgtBCDataClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_bc_data_class_init, + NULL, + NULL, + sizeof (glWdgtBCData), + 0, + (GInstanceInitFunc) gl_wdgt_bc_data_instance_init, + }; + + wdgt_bc_data_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtBCData", + &wdgt_bc_data_info, 0); + } + + return wdgt_bc_data_type; +} + +static void +gl_wdgt_bc_data_class_init (glWdgtBCDataClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_bc_data_finalize; + + wdgt_bc_data_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtBCDataClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_bc_data_instance_init (glWdgtBCData * bc_data) +{ + bc_data->literal_radio = NULL; + bc_data->literal_entry = NULL; + + bc_data->key_radio = NULL; + bc_data->key_entry = NULL; +} + +static void +gl_wdgt_bc_data_finalize (GObject * object) +{ + glWdgtBCData *bc_data; + glWdgtBCDataClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_BC_DATA (object)); + + bc_data = GL_WDGT_BC_DATA (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_bc_data_new (gchar * label, + GList * field_defs) +{ + glWdgtBCData *bc_data; + + bc_data = g_object_new (gl_wdgt_bc_data_get_type (), NULL); + + gl_wdgt_bc_data_construct (bc_data, label, field_defs); + + return GTK_WIDGET (bc_data); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_bc_data_construct (glWdgtBCData * bc_data, + gchar * label, + GList * field_defs) +{ + GtkWidget *wvbox, *wframe, *wtable, *wcombo; + GSList *radio_group = NULL; + GList *keys; + + wvbox = GTK_WIDGET (bc_data); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Literal radio */ + bc_data->literal_radio = gtk_radio_button_new_with_label (radio_group, + _ + ("Literal:")); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (bc_data->literal_radio)); + g_signal_connect (G_OBJECT (bc_data->literal_radio), "toggled", + G_CALLBACK (radio_toggled_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), bc_data->literal_radio, + 0, 1, 0, 1); + + /* Literal entry widget */ + bc_data->literal_entry = gtk_entry_new (); + gtk_widget_set_size_request (bc_data->literal_entry, 200, -1); + g_signal_connect_swapped (G_OBJECT (bc_data->literal_entry), + "changed", G_CALLBACK (changed_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), bc_data->literal_entry, + 1, 2, 0, 1); + + /* Key radio */ + bc_data->key_radio = gtk_radio_button_new_with_label (radio_group, + _("Key:")); + g_signal_connect (G_OBJECT (bc_data->key_radio), "toggled", + G_CALLBACK (radio_toggled_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), bc_data->key_radio, + 0, 1, 1, 2); + + /* Key entry widget */ + wcombo = gtk_combo_new (); + keys = gl_merge_get_key_list (field_defs); + if (keys != NULL) + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), keys); + gl_merge_free_key_list (&keys); + bc_data->key_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (bc_data->key_entry), FALSE); + gtk_widget_set_size_request (wcombo, 200, -1); + g_signal_connect_swapped (G_OBJECT (bc_data->key_entry), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (bc_data)); + gtk_table_attach_defaults (GTK_TABLE (wtable), wcombo, 1, 2, 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtBCData * bc_data) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback to handle toggling of radio buttons */ +/*--------------------------------------------------------------------------*/ +static void +radio_toggled_cb (GtkToggleButton * togglebutton, + glWdgtBCData * bc_data) +{ + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) { + gtk_widget_set_sensitive (bc_data->literal_entry, TRUE); + gtk_widget_set_sensitive (bc_data->key_entry, FALSE); + } else { + gtk_widget_set_sensitive (bc_data->literal_entry, FALSE); + gtk_widget_set_sensitive (bc_data->key_entry, TRUE); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0); +} + +/*--------------------------------------------------------------------------*/ +/* Get widget data. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_wdgt_bc_data_get_data (glWdgtBCData * bc_data) +{ + glTextNode *text_node; + + text_node = g_new0(glTextNode,1); + + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) { + text_node->field_flag = FALSE; + text_node->data = + gtk_editable_get_chars (GTK_EDITABLE + (bc_data->literal_entry), 0, -1); + } else { + text_node->field_flag = TRUE; + text_node->data = + gtk_editable_get_chars (GTK_EDITABLE (bc_data->key_entry), + 0, -1); + } +} + +/*--------------------------------------------------------------------------*/ +/* Set widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_wdgt_bc_data_set_data (glWdgtBCData * bc_data, + gboolean merge_flag, + glTextNode *text_node) +{ + gint pos; + + gtk_widget_set_sensitive (bc_data->key_radio, merge_flag); + + if (!text_node->field_flag) { + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (bc_data->literal_radio), TRUE); + + gtk_widget_set_sensitive (bc_data->literal_entry, TRUE); + gtk_widget_set_sensitive (bc_data->key_entry, FALSE); + + g_signal_handlers_block_by_func (G_OBJECT + (bc_data->literal_entry), + G_CALLBACK (changed_cb), + bc_data); + gtk_editable_delete_text (GTK_EDITABLE (bc_data->literal_entry), + 0, -1); + g_signal_handlers_unblock_by_func (G_OBJECT + (bc_data->literal_entry), + G_CALLBACK + (changed_cb), bc_data); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (bc_data->literal_entry), + text_node->data, + strlen (text_node->data), + &pos); + } else { + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (bc_data->key_radio), TRUE); + + gtk_widget_set_sensitive (bc_data->literal_entry, FALSE); + gtk_widget_set_sensitive (bc_data->key_entry, TRUE); + + g_signal_handlers_block_by_func (G_OBJECT + (bc_data->key_entry), + G_CALLBACK (changed_cb), + bc_data); + gtk_editable_delete_text (GTK_EDITABLE (bc_data->key_entry), 0, + -1); + g_signal_handlers_unblock_by_func (G_OBJECT + (bc_data->key_entry), + G_CALLBACK + (changed_cb), bc_data); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (bc_data->key_entry), + text_node->data, + strlen (text_node->data), + &pos); + } + +} diff --git a/glabels2/src/wdgt-bc-data.h b/glabels2/src/wdgt-bc-data.h new file mode 100644 index 0000000..e7771b2 --- /dev/null +++ b/glabels2/src/wdgt-bc-data.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_data.h: barcode data widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_BC_DATA_H__ +#define __WDGT_BC_DATA_H__ + +#include <gnome.h> +#include "text-node.h" + +#define GL_TYPE_WDGT_BC_DATA (gl_wdgt_bc_data_get_type ()) +#define GL_WDGT_BC_DATA(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_DATA, glWdgtBCData )) +#define GL_WDGT_BC_DATA_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_DATA, glWdgtBCDataClass)) +#define GL_IS_WDGT_BC_DATA(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_DATA)) +#define GL_IS_WDGT_BC_DATA_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_DATA)) + +typedef struct _glWdgtBCData glWdgtBCData; +typedef struct _glWdgtBCDataClass glWdgtBCDataClass; + +struct _glWdgtBCData { + GtkVBox parent_widget; + + GtkWidget *literal_radio; + GtkWidget *literal_entry; + + GtkWidget *key_radio; + GtkWidget *key_entry; +}; + +struct _glWdgtBCDataClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtBCData * bc_data, gpointer user_data); +}; + +extern guint gl_wdgt_bc_data_get_type (void); + +extern GtkWidget *gl_wdgt_bc_data_new (gchar * label, GList * field_defs); + +extern glTextNode *gl_wdgt_bc_data_get_data (glWdgtBCData * bc_data); + +extern void gl_wdgt_bc_data_set_data (glWdgtBCData * bc_data, + gboolean merge_flag, + glTextNode *text_node); + +#endif diff --git a/glabels2/src/wdgt-bc-props.c b/glabels2/src/wdgt-bc-props.c new file mode 100644 index 0000000..ed4ddbc --- /dev/null +++ b/glabels2/src/wdgt-bc-props.c @@ -0,0 +1,250 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_props.c: barcode properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-bc-props.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtBCPropsSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_bc_props_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_bc_props_class_init (glWdgtBCPropsClass * class); +static void gl_wdgt_bc_props_instance_init (glWdgtBCProps * prop); +static void gl_wdgt_bc_props_finalize (GObject * object); +static void gl_wdgt_bc_props_construct (glWdgtBCProps * prop, gchar * label); +static void changed_cb (glWdgtBCProps * prop); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_bc_props_get_type (void) +{ + static guint wdgt_bc_props_type = 0; + + if (!wdgt_bc_props_type) { + GTypeInfo wdgt_bc_props_info = { + sizeof (glWdgtBCPropsClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_bc_props_class_init, + NULL, + NULL, + sizeof (glWdgtBCProps), + 0, + (GInstanceInitFunc) gl_wdgt_bc_props_instance_init, + }; + + wdgt_bc_props_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtBCProps", &wdgt_bc_props_info, 0); + } + + return wdgt_bc_props_type; +} + +static void +gl_wdgt_bc_props_class_init (glWdgtBCPropsClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_bc_props_finalize; + + wdgt_bc_props_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtBCPropsClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_bc_props_instance_init (glWdgtBCProps * prop) +{ + prop->scale_spin = NULL; + prop->color_picker = NULL; +} + +static void +gl_wdgt_bc_props_finalize (GObject * object) +{ + glWdgtBCProps *prop; + glWdgtBCPropsClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_BC_PROPS (object)); + + prop = GL_WDGT_BC_PROPS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_bc_props_new (gchar * label) +{ + glWdgtBCProps *prop; + + prop = g_object_new (gl_wdgt_bc_props_get_type (), NULL); + + gl_wdgt_bc_props_construct (prop, label); + + return GTK_WIDGET (prop); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_bc_props_construct (glWdgtBCProps * prop, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *adjust; + + wvbox = GTK_WIDGET (prop); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Scale Label */ + wlabel = gtk_label_new (_("Scale:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* Scale widget */ + adjust = gtk_adjustment_new (100.0, 50.0, 200.0, 10.0, 10.0, 10.0); + prop->scale_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 10.0, 0); + g_signal_connect_swapped (G_OBJECT (prop->scale_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + gtk_table_attach_defaults (GTK_TABLE (wtable), prop->scale_spin, 1, 2, + 0, 1); + /* % Label */ + wlabel = gtk_label_new (_("%")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 2, 3, 0, 1); + + /* Line Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Line Color picker widget */ + prop->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (prop->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + gtk_table_attach_defaults (GTK_TABLE (wtable), prop->color_picker, 1, 3, + 1, 2); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtBCProps * prop) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (prop), wdgt_bc_props_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_props_get_params (glWdgtBCProps * prop, + gdouble * scale, + guint * color) +{ + guint8 r, g, b, a; + + /* ------- Get updated scale ------ */ + *scale = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(prop->scale_spin)); + *scale /= 100.0; + + /* ------- Get updated line color ------ */ + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (prop->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); + +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_props_set_params (glWdgtBCProps * prop, + gdouble scale, + guint color) +{ + scale *= 100.0; + gtk_spin_button_set_value (GTK_SPIN_BUTTON (prop->scale_spin), scale); + + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (prop->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); + +} diff --git a/glabels2/src/wdgt-bc-props.h b/glabels2/src/wdgt-bc-props.h new file mode 100644 index 0000000..1f67cd8 --- /dev/null +++ b/glabels2/src/wdgt-bc-props.h @@ -0,0 +1,67 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_props.h: barcode properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_BC_PROPS_H__ +#define __WDGT_BC_PROPS_H__ + +#include <gnome.h> +#include "bc.h" + +#define GL_TYPE_WDGT_BC_PROPS (gl_wdgt_bc_props_get_type ()) +#define GL_WDGT_BC_PROPS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_PROPS, glWdgtBCProps )) +#define GL_WDGT_BC_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_PROPS, glWdgtBCPropsClass)) +#define GL_IS_WDGT_BC_PROPS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_PROPS)) +#define GL_IS_WDGT_BC_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_PROPS)) + +typedef struct _glWdgtBCProps glWdgtBCProps; +typedef struct _glWdgtBCPropsClass glWdgtBCPropsClass; + +struct _glWdgtBCProps { + GtkVBox parent_widget; + + GtkWidget *scale_spin; + GtkWidget *color_picker; +}; + +struct _glWdgtBCPropsClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtBCProps * prop, gpointer user_data); +}; + +extern guint gl_wdgt_bc_props_get_type (void); + +extern GtkWidget *gl_wdgt_bc_props_new (gchar * label); + +extern void gl_wdgt_bc_props_get_params (glWdgtBCProps * prop, + gdouble * scale, + guint * color); + +extern void gl_wdgt_bc_props_set_params (glWdgtBCProps * prop, + gdouble scale, + guint color); + +#endif diff --git a/glabels2/src/wdgt-bc-style.c b/glabels2/src/wdgt-bc-style.c new file mode 100644 index 0000000..07049a3 --- /dev/null +++ b/glabels2/src/wdgt-bc-style.c @@ -0,0 +1,463 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_style.c: barcode style selection widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-bc-style.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtBCStyleSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_bc_style_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_bc_style_class_init (glWdgtBCStyleClass * class); +static void gl_wdgt_bc_style_instance_init (glWdgtBCStyle * prop_style); +static void gl_wdgt_bc_style_finalize (GObject * object); +static void gl_wdgt_bc_style_construct (glWdgtBCStyle * prop_style, + gchar * label); +static void changed_cb (glWdgtBCStyle * prop_style); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_bc_style_get_type (void) +{ + static guint wdgt_bc_style_type = 0; + + if (!wdgt_bc_style_type) { + GTypeInfo wdgt_bc_style_info = { + sizeof (glWdgtBCStyleClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_bc_style_class_init, + NULL, + NULL, + sizeof (glWdgtBCStyle), + 0, + (GInstanceInitFunc) gl_wdgt_bc_style_instance_init, + }; + + wdgt_bc_style_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtBCStyle", + &wdgt_bc_style_info, 0); + } + + return wdgt_bc_style_type; +} + +static void +gl_wdgt_bc_style_class_init (glWdgtBCStyleClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_bc_style_finalize; + + wdgt_bc_style_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtBCStyleClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_bc_style_instance_init (glWdgtBCStyle * prop_style) +{ + prop_style->postnet_radio = NULL; + prop_style->ean_radio = NULL; + prop_style->upc_radio = NULL; + prop_style->isbn_radio = NULL; + prop_style->code39_radio = NULL; + prop_style->code128_radio = NULL; + prop_style->code128c_radio = NULL; + prop_style->code128b_radio = NULL; + prop_style->i25_radio = NULL; + prop_style->cbr_radio = NULL; + prop_style->msi_radio = NULL; + prop_style->pls_radio = NULL; +} + +static void +gl_wdgt_bc_style_finalize (GObject * object) +{ + glWdgtBCStyle *prop_style; + glWdgtBCStyleClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_BC_STYLE (object)); + + prop_style = GL_WDGT_BC_STYLE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_bc_style_new (gchar * label) +{ + glWdgtBCStyle *prop_style; + + prop_style = g_object_new (gl_wdgt_bc_style_get_type (), NULL); + + gl_wdgt_bc_style_construct (prop_style, label); + + return GTK_WIDGET (prop_style); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_bc_style_construct (glWdgtBCStyle * prop, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wvbox1, *whbox2, *wvbox2; + GSList *radio_group = NULL; + + wvbox = GTK_WIDGET (prop); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox1), 10); + gtk_container_add (GTK_CONTAINER (wframe), wvbox1); + + whbox2 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_container_add (GTK_CONTAINER (wvbox1), whbox2); + + /* ... Start column ... */ + wvbox2 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox2), 10); + gtk_box_pack_start (GTK_BOX (whbox2), wvbox2, FALSE, FALSE, 0); + + /* POSTNET button */ + prop->postnet_radio = + gtk_radio_button_new_with_label (radio_group, "POSTNET"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->postnet_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->postnet_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->postnet_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* EAN button */ + prop->ean_radio = gtk_radio_button_new_with_label (radio_group, "EAN"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->ean_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->ean_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->ean_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* UPC button */ + prop->upc_radio = gtk_radio_button_new_with_label (radio_group, "UPC"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->upc_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->upc_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->upc_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* ISBN button */ + prop->isbn_radio = + gtk_radio_button_new_with_label (radio_group, "ISBN"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->isbn_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->isbn_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->isbn_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CODE39 button */ + prop->code39_radio = + gtk_radio_button_new_with_label (radio_group, "Code 39"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code39_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code39_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code39_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CODE128 button */ + prop->code128_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code128_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code128_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* ... Start column ... */ + wvbox2 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox2), 10); + gtk_box_pack_start (GTK_BOX (whbox2), wvbox2, FALSE, FALSE, 0); + + /* CODE128B button */ + prop->code128b_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128-B"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code128b_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128b_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code128b_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CODE128C button */ + prop->code128c_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128-C"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->code128c_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128c_radio, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->code128c_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* I25 button */ + prop->i25_radio = + gtk_radio_button_new_with_label (radio_group, "Interleaved 2 of 5"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->i25_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->i25_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->i25_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* CBR button */ + prop->cbr_radio = + gtk_radio_button_new_with_label (radio_group, "Codabar"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->cbr_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->cbr_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->cbr_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* MSI button */ + prop->msi_radio = gtk_radio_button_new_with_label (radio_group, "MSI"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->msi_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->msi_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->msi_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* PLS button */ + prop->pls_radio = + gtk_radio_button_new_with_label (radio_group, "Plessey"); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (prop->pls_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->pls_radio, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->pls_radio), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + + /* ... Separator ... */ + gtk_box_pack_start (GTK_BOX (wvbox1), gtk_hseparator_new (), FALSE, + FALSE, 0); + + /* Text checkbox widget */ + prop->text_check = + gtk_check_button_new_with_label (_("Show text with barcode")); + gtk_box_pack_start (GTK_BOX (wvbox1), prop->text_check, + FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (prop->text_check), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (prop)); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtBCStyle * prop_style) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (prop_style), + wdgt_bc_style_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_style_get_params (glWdgtBCStyle * prop, + glBarcodeStyle * style, + gboolean * text_flag) +{ + *text_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop->text_check)); + + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->postnet_radio))) { + *style = GL_BARCODE_STYLE_POSTNET; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->ean_radio))) { + *style = GL_BARCODE_STYLE_EAN; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->upc_radio))) { + *style = GL_BARCODE_STYLE_UPC; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->isbn_radio))) { + *style = GL_BARCODE_STYLE_ISBN; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code39_radio))) { + *style = GL_BARCODE_STYLE_39; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code128_radio))) { + *style = GL_BARCODE_STYLE_128; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code128c_radio))) { + *style = GL_BARCODE_STYLE_128C; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->code128b_radio))) { + *style = GL_BARCODE_STYLE_128B; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->i25_radio))) { + *style = GL_BARCODE_STYLE_I25; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->cbr_radio))) { + *style = GL_BARCODE_STYLE_CBR; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->msi_radio))) { + *style = GL_BARCODE_STYLE_MSI; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (prop->pls_radio))) { + *style = GL_BARCODE_STYLE_PLS; + } + +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_bc_style_set_params (glWdgtBCStyle * prop, + glBarcodeStyle style, + gboolean text_flag) +{ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prop->text_check), + text_flag); + + switch (style) { + case GL_BARCODE_STYLE_POSTNET: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->postnet_radio), TRUE); + break; + case GL_BARCODE_STYLE_EAN: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->ean_radio), TRUE); + break; + case GL_BARCODE_STYLE_UPC: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->upc_radio), TRUE); + break; + case GL_BARCODE_STYLE_ISBN: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->isbn_radio), TRUE); + break; + case GL_BARCODE_STYLE_39: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code39_radio), TRUE); + break; + case GL_BARCODE_STYLE_128: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code128_radio), TRUE); + break; + case GL_BARCODE_STYLE_128C: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code128c_radio), TRUE); + break; + case GL_BARCODE_STYLE_128B: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->code128b_radio), TRUE); + break; + case GL_BARCODE_STYLE_I25: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->i25_radio), TRUE); + break; + case GL_BARCODE_STYLE_CBR: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->cbr_radio), TRUE); + break; + case GL_BARCODE_STYLE_MSI: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->msi_radio), TRUE); + break; + case GL_BARCODE_STYLE_PLS: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->pls_radio), TRUE); + break; + default: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (prop->postnet_radio), TRUE); + break; + } +} diff --git a/glabels2/src/wdgt-bc-style.h b/glabels2/src/wdgt-bc-style.h new file mode 100644 index 0000000..78c9863 --- /dev/null +++ b/glabels2/src/wdgt-bc-style.h @@ -0,0 +1,79 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_bc_style.h: barcode style selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_BC_STYLE_H__ +#define __WDGT_BC_STYLE_H__ + +#include <gnome.h> +#include "bc.h" + +#define GL_TYPE_WDGT_BC_STYLE (gl_wdgt_bc_style_get_type ()) +#define GL_WDGT_BC_STYLE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_STYLE, glWdgtBCStyle )) +#define GL_WDGT_BC_STYLE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_STYLE, glWdgtBCStyleClass)) +#define GL_IS_WDGT_BC_STYLE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_STYLE)) +#define GL_IS_WDGT_BC_STYLE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_STYLE)) + +typedef struct _glWdgtBCStyle glWdgtBCStyle; +typedef struct _glWdgtBCStyleClass glWdgtBCStyleClass; + +struct _glWdgtBCStyle { + GtkVBox parent_widget; + + GtkWidget *postnet_radio; + GtkWidget *ean_radio; + GtkWidget *upc_radio; + GtkWidget *isbn_radio; + GtkWidget *code39_radio; + GtkWidget *code128_radio; + GtkWidget *code128c_radio; + GtkWidget *code128b_radio; + GtkWidget *i25_radio; + GtkWidget *cbr_radio; + GtkWidget *msi_radio; + GtkWidget *pls_radio; + + GtkWidget *text_check; +}; + +struct _glWdgtBCStyleClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtBCStyle * prop, gpointer user_data); +}; + +extern guint gl_wdgt_bc_style_get_type (void); + +extern GtkWidget *gl_wdgt_bc_style_new (gchar * label); + +extern void gl_wdgt_bc_style_get_params (glWdgtBCStyle * prop_style, + glBarcodeStyle * style, + gboolean * text_flag); + +extern void gl_wdgt_bc_style_set_params (glWdgtBCStyle * prop_style, + glBarcodeStyle style, + gboolean text_flag); + +#endif diff --git a/glabels2/src/wdgt-fill.c b/glabels2/src/wdgt-fill.c new file mode 100644 index 0000000..3a49ca9 --- /dev/null +++ b/glabels2/src/wdgt-fill.c @@ -0,0 +1,218 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_fill.c: fill properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-fill.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtFillSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_fill_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_fill_class_init (glWdgtFillClass * class); +static void gl_wdgt_fill_instance_init (glWdgtFill * fill); +static void gl_wdgt_fill_finalize (GObject * object); +static void gl_wdgt_fill_construct (glWdgtFill * fill, gchar * label); +static void changed_cb (glWdgtFill * fill); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_fill_get_type (void) +{ + static guint wdgt_fill_type = 0; + + if (!wdgt_fill_type) { + GTypeInfo wdgt_fill_info = { + sizeof (glWdgtFillClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_fill_class_init, + NULL, + NULL, + sizeof (glWdgtFill), + 0, + (GInstanceInitFunc) gl_wdgt_fill_instance_init, + }; + + wdgt_fill_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtFill", + &wdgt_fill_info, 0); + } + + return wdgt_fill_type; +} + +static void +gl_wdgt_fill_class_init (glWdgtFillClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_fill_finalize; + + wdgt_fill_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtFillClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_fill_instance_init (glWdgtFill * fill) +{ + fill->color_picker = NULL; +} + +static void +gl_wdgt_fill_finalize (GObject * object) +{ + glWdgtFill *fill; + glWdgtFillClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_FILL (object)); + + fill = GL_WDGT_FILL (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_fill_new (gchar * label) +{ + glWdgtFill *fill; + + fill = g_object_new (gl_wdgt_fill_get_type (), NULL); + + gl_wdgt_fill_construct (fill, label); + + return GTK_WIDGET (fill); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_fill_construct (glWdgtFill * fill, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + + wvbox = GTK_WIDGET (fill); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (1, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Fill Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + /* Fill Color picker widget */ + fill->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (fill->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (fill)); + gtk_table_attach_defaults (GTK_TABLE (wtable), fill->color_picker, 1, 3, + 0, 1); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtFill * fill) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (fill), wdgt_fill_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_fill_get_params (glWdgtFill * fill, + guint * color) +{ + guint8 r, g, b, a; + + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (fill->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_fill_set_params (glWdgtFill * fill, + guint color) +{ + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (fill->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); +} diff --git a/glabels2/src/wdgt-fill.h b/glabels2/src/wdgt-fill.h new file mode 100644 index 0000000..db1d8da --- /dev/null +++ b/glabels2/src/wdgt-fill.h @@ -0,0 +1,62 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_fill.h: fill properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_FILL_H__ +#define __WDGT_FILL_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_FILL (gl_wdgt_fill_get_type ()) +#define GL_WDGT_FILL(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_FILL, glWdgtFill )) +#define GL_WDGT_FILL_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_FILL, glWdgtFillClass)) +#define GL_IS_WDGT_FILL(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_FILL)) +#define GL_IS_WDGT_FILL_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_FILL)) + +typedef struct _glWdgtFill glWdgtFill; +typedef struct _glWdgtFillClass glWdgtFillClass; + +struct _glWdgtFill { + GtkVBox parent_widget; + + GtkWidget *color_picker; +}; + +struct _glWdgtFillClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtFill * fill, gpointer user_data); +}; + +extern guint gl_wdgt_fill_get_type (void); + +extern GtkWidget *gl_wdgt_fill_new (gchar * label); + +extern void gl_wdgt_fill_get_params (glWdgtFill * fill, guint * color); + +extern void gl_wdgt_fill_set_params (glWdgtFill * fill, guint color); + +#endif diff --git a/glabels2/src/wdgt-line.c b/glabels2/src/wdgt-line.c new file mode 100644 index 0000000..71e369a --- /dev/null +++ b/glabels2/src/wdgt-line.c @@ -0,0 +1,247 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_line.c: line properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-line.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtLineSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_line_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_line_class_init (glWdgtLineClass * class); +static void gl_wdgt_line_instance_init (glWdgtLine * line); +static void gl_wdgt_line_finalize (GObject * object); +static void gl_wdgt_line_construct (glWdgtLine * line, gchar * label); +static void changed_cb (glWdgtLine * line); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_line_get_type (void) +{ + static guint wdgt_line_type = 0; + + if (!wdgt_line_type) { + GTypeInfo wdgt_line_info = { + sizeof (glWdgtLineClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_line_class_init, + NULL, + NULL, + sizeof (glWdgtLine), + 0, + (GInstanceInitFunc) gl_wdgt_line_instance_init, + }; + + wdgt_line_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtLine", + &wdgt_line_info, 0); + } + + return wdgt_line_type; +} + +static void +gl_wdgt_line_class_init (glWdgtLineClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_line_finalize; + + wdgt_line_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtLineClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_line_instance_init (glWdgtLine * line) +{ + line->width_spin = NULL; + line->color_picker = NULL; + line->units_label = NULL; +} + +static void +gl_wdgt_line_finalize (GObject * object) +{ + glWdgtLine *line; + glWdgtLineClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_LINE (object)); + + line = GL_WDGT_LINE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_line_new (gchar * label) +{ + glWdgtLine *line; + + line = g_object_new (gl_wdgt_line_get_type (), NULL); + + gl_wdgt_line_construct (line, label); + + return GTK_WIDGET (line); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_line_construct (glWdgtLine * line, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *adjust; + + wvbox = GTK_WIDGET (line); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Line Width Label */ + wlabel = gtk_label_new (_("Width:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* Line Width widget */ + adjust = gtk_adjustment_new (1.0, 0.25, 4.0, 0.25, 1.0, 1.0); + line->width_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 0.25, 2); + g_signal_connect_swapped (G_OBJECT (line->width_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (line)); + gtk_table_attach_defaults (GTK_TABLE (wtable), line->width_spin, 1, 2, + 0, 1); + /* Line Width units */ + line->units_label = gtk_label_new (_("points")); + gtk_misc_set_alignment (GTK_MISC (line->units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), line->units_label, + 2, 3, 0, 1); + + /* Line Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Line Color picker widget */ + line->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (line->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (line)); + gtk_table_attach_defaults (GTK_TABLE (wtable), line->color_picker, 1, 3, + 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtLine * line) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (line), wdgt_line_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_line_get_params (glWdgtLine * line, + gdouble * width, + guint * color) +{ + guint8 r, g, b, a; + + *width = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (line->width_spin)); + + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (line->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_line_set_params (glWdgtLine * line, + gdouble width, + guint color) +{ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (line->width_spin), width); + + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (line->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); +} diff --git a/glabels2/src/wdgt-line.h b/glabels2/src/wdgt-line.h new file mode 100644 index 0000000..eec143f --- /dev/null +++ b/glabels2/src/wdgt-line.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_line.h: line properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_LINE_H__ +#define __WDGT_LINE_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_LINE (gl_wdgt_line_get_type ()) +#define GL_WDGT_LINE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_LINE, glWdgtLine )) +#define GL_WDGT_LINE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_LINE, glWdgtLineClass)) +#define GL_IS_WDGT_LINE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_LINE)) +#define GL_IS_WDGT_LINE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_LINE)) + +typedef struct _glWdgtLine glWdgtLine; +typedef struct _glWdgtLineClass glWdgtLineClass; + +struct _glWdgtLine { + GtkVBox parent_widget; + + GtkWidget *width_spin; + GtkWidget *color_picker; + GtkWidget *units_label; +}; + +struct _glWdgtLineClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtLine * line, gpointer user_data); +}; + +extern guint gl_wdgt_line_get_type (void); + +extern GtkWidget *gl_wdgt_line_new (gchar * label); + +extern void gl_wdgt_line_get_params (glWdgtLine * line, + gdouble * width, + guint * color); + +extern void gl_wdgt_line_set_params (glWdgtLine * line, + gdouble width, + guint color); + +#endif diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c new file mode 100644 index 0000000..d8dcca7 --- /dev/null +++ b/glabels2/src/wdgt-media-select.c @@ -0,0 +1,517 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_media_select.c: media selection widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-media-select.h" +#include "template.h" +#include "wdgt-mini-preview.h" +#include "prefs.h" +#include "util.h" +#include "marshal.h" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_WIDTH 160 +#define WDGT_MINI_PREVIEW_HEIGHT 200 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtMediaSelectSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_media_select_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_media_select_class_init (glWdgtMediaSelectClass * class); +static void gl_wdgt_media_select_instance_init (glWdgtMediaSelect * media_select); +static void gl_wdgt_media_select_finalize (GObject * object); + +static void gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select); + +static void page_size_entry_changed_cb (GtkEntry * entry, + gpointer user_data); +static void template_entry_changed_cb (GtkEntry * entry, + gpointer user_data); + +static void details_update (glWdgtMediaSelect * media_select, + gchar * name); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_media_select_get_type (void) +{ + static guint wdgt_media_select_type = 0; + + if (!wdgt_media_select_type) { + GTypeInfo wdgt_media_select_info = { + sizeof (glWdgtMediaSelectClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_media_select_class_init, + NULL, + NULL, + sizeof (glWdgtMediaSelect), + 0, + (GInstanceInitFunc) gl_wdgt_media_select_instance_init, + }; + + wdgt_media_select_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtMediaSelect", + &wdgt_media_select_info, 0); + } + + return wdgt_media_select_type; +} + +static void +gl_wdgt_media_select_class_init (glWdgtMediaSelectClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_media_select_finalize; + + wdgt_media_select_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtMediaSelectClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +static void +gl_wdgt_media_select_instance_init (glWdgtMediaSelect * media_select) +{ + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + media_select->page_size_entry = NULL; + media_select->template_entry = NULL; + + media_select->mini_preview = NULL; + + media_select->desc_label = NULL; + media_select->sheet_size_label = NULL; + media_select->number_label = NULL; + media_select->label_size_label = NULL; + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +static void +gl_wdgt_media_select_finalize (GObject * object) +{ + glWdgtMediaSelect *media_select; + glWdgtMediaSelectClass *class; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object)); + + media_select = GL_WDGT_MEDIA_SELECT (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +GtkWidget * +gl_wdgt_media_select_new (void) +{ + glWdgtMediaSelect *media_select; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + media_select = g_object_new (gl_wdgt_media_select_get_type (), NULL); + + gl_wdgt_media_select_construct (media_select); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); + + return GTK_WIDGET (media_select); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select) +{ + GtkWidget *whbox, *wvbox, *wcombo, *wvbox1, *whbox1; + gchar *name; + GList *template_names, *page_sizes = NULL; + const gchar *page_size; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + page_size = gl_prefs_get_page_size (); + + wvbox = GTK_WIDGET (media_select); + + whbox = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, GNOME_PAD); + + /* Page size selection control */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating page size combo..."); + wcombo = gtk_combo_new (); + page_sizes = gl_template_get_page_size_list (); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), page_sizes); + gl_template_free_page_size_list (&page_sizes); + media_select->page_size_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (media_select->page_size_entry), + FALSE); + gtk_combo_set_value_in_list (GTK_COMBO(wcombo), TRUE, FALSE); + gtk_widget_set_size_request (media_select->page_size_entry, 100, -1); + gtk_entry_set_text (GTK_ENTRY (media_select->page_size_entry), + page_size); + gtk_box_pack_start (GTK_BOX (whbox), wcombo, FALSE, FALSE, GNOME_PAD); + + /* Actual selection control */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating template combo..."); + gl_debug (DEBUG_MEDIA_SELECT, "page_size = %s", page_size); + template_names = gl_template_get_name_list (page_size); + media_select->template_combo = gtk_combo_new (); + gtk_combo_set_popdown_strings (GTK_COMBO (media_select->template_combo), + template_names); + gl_template_free_name_list (&template_names); + media_select->template_entry = + GTK_COMBO (media_select->template_combo)->entry; + gtk_entry_set_editable (GTK_ENTRY (media_select->template_entry), + FALSE); + gtk_combo_set_value_in_list (GTK_COMBO(media_select->template_combo), + TRUE, FALSE); + gtk_widget_set_size_request (media_select->template_entry, 400, -1); + gtk_box_pack_start (GTK_BOX (whbox), media_select->template_combo, + FALSE, FALSE, GNOME_PAD); + + whbox = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, GNOME_PAD); + + /* mini_preview canvas */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating mini preview..."); + media_select->mini_preview = gl_wdgt_mini_preview_new ( WDGT_MINI_PREVIEW_HEIGHT, + WDGT_MINI_PREVIEW_WIDTH); + gtk_box_pack_start (GTK_BOX (whbox), media_select->mini_preview, + FALSE, FALSE, GNOME_PAD); + + /* Label column */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating label column..."); + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox1, FALSE, FALSE, 0); + + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Description:")), + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Page size:")), + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Label size:")), + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Layout:")), + FALSE, FALSE, GNOME_PAD); + + /* detail widgets column */ + gl_debug (DEBUG_MEDIA_SELECT, "Creating details column..."); + wvbox1 = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox1, FALSE, FALSE, 0); + + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->desc_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->desc_label, + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->sheet_size_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->sheet_size_label, + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->label_size_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->label_size_label, + FALSE, FALSE, GNOME_PAD); + whbox1 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + media_select->number_label = gtk_label_new (""); + gtk_box_pack_start (GTK_BOX (whbox1), media_select->number_label, + FALSE, FALSE, GNOME_PAD); + + /* Update mini_preview and details from default template */ + + gl_debug (DEBUG_MEDIA_SELECT, "template_entry = %p", + media_select->template_entry); + name = + gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), + 0, -1); + gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name); + gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW (media_select->mini_preview), + name); + details_update (media_select, name); + g_free (name); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (media_select->page_size_entry), "changed", + G_CALLBACK (page_size_entry_changed_cb), + media_select); + g_signal_connect (G_OBJECT (media_select->template_entry), "changed", + G_CALLBACK (template_entry_changed_cb), + media_select); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change in selection */ +/*--------------------------------------------------------------------------*/ +static void +page_size_entry_changed_cb (GtkEntry * entry, + gpointer user_data) +{ + glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data); + gchar *page_size; + GList *template_names; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + + /* Update template selections for new page size */ + page_size = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + if ( strlen(page_size) ) { + gl_debug (DEBUG_MEDIA_SELECT, "page_size = \"%s\"", page_size); + template_names = gl_template_get_name_list (page_size); + gtk_combo_set_popdown_strings (GTK_COMBO (media_select->template_combo), + template_names); + gl_template_free_name_list (&template_names); + } + g_free (page_size); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change in selection */ +/*--------------------------------------------------------------------------*/ +static void +template_entry_changed_cb (GtkEntry * entry, + gpointer user_data) +{ + glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data); + gchar *name; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + /* Update mini_preview canvas & details with template */ + gl_debug (DEBUG_MEDIA_SELECT, "template_entry = %p", entry); + name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + if ( strlen(name) ) { + gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name); + gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW (media_select->mini_preview), + name); + gl_debug (DEBUG_MEDIA_SELECT, "m1"); + details_update (media_select, name); + gl_debug (DEBUG_MEDIA_SELECT, "m2"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (user_data), + wdgt_media_select_signals[CHANGED], 0); + } + g_free (name); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. update "details" widgets from new template. */ +/*--------------------------------------------------------------------------*/ +static void +details_update (glWdgtMediaSelect * media_select, + gchar * name) +{ + glTemplate *template; + gchar *text; + glPrefsUnits units; + const gchar *units_string; + gdouble units_per_point; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + units = gl_prefs_get_units (); + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + + /* Fetch template */ + template = gl_template_from_name (name); + + gtk_label_set_text (GTK_LABEL (media_select->desc_label), + template->description); + + gtk_label_set_text (GTK_LABEL (media_select->sheet_size_label), + template->page_size); + + text = g_strdup_printf (_("%d x %d (%d per sheet)"), + template->nx, template->ny, + template->nx * template->ny); + + gtk_label_set_text (GTK_LABEL (media_select->number_label), text); + g_free (text); + + if ( units == GL_PREFS_UNITS_INCHES ) { + gchar *xstr, *ystr; + + xstr = gl_util_fraction (template->label_height + * units_per_point); + ystr = gl_util_fraction (template->label_width + * units_per_point); + text = g_strdup_printf (_("%s x %s %s"), + xstr, ystr, units_string); + g_free (xstr); + g_free (ystr); + } else { + text = g_strdup_printf (_("%.5g x %.5g %s"), + template->label_height*units_per_point, + template->label_width*units_per_point, + units_string); + } + gtk_label_set_text (GTK_LABEL (media_select->label_size_label), text); + g_free (text); + + gl_template_free( &template ); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/****************************************************************************/ +/* query selected label template name. */ +/****************************************************************************/ +gchar * +gl_wdgt_media_select_get_name (glWdgtMediaSelect * media_select) +{ + gl_debug (DEBUG_MEDIA_SELECT, ""); + return + gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), + 0, -1); +} + +/****************************************************************************/ +/* set selected label template name. */ +/****************************************************************************/ +void +gl_wdgt_media_select_set_name (glWdgtMediaSelect * media_select, + gchar * name) +{ + gint pos; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + g_signal_handlers_block_by_func (G_OBJECT(media_select->template_entry), + G_CALLBACK(template_entry_changed_cb), + media_select); + gtk_editable_delete_text (GTK_EDITABLE (media_select->template_entry), + 0, -1); + g_signal_handlers_unblock_by_func (G_OBJECT(media_select->template_entry), + G_CALLBACK(template_entry_changed_cb), + media_select); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (media_select->template_entry), + name, strlen (name), &pos); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} + +/****************************************************************************/ +/* query selected label template page size. */ +/****************************************************************************/ +gchar * +gl_wdgt_media_select_get_page_size (glWdgtMediaSelect * media_select) +{ + gl_debug (DEBUG_MEDIA_SELECT, ""); + + return + gtk_editable_get_chars (GTK_EDITABLE + (media_select->page_size_entry), 0, -1); +} + +/****************************************************************************/ +/* set selected label template page size. */ +/****************************************************************************/ +void +gl_wdgt_media_select_set_page_size (glWdgtMediaSelect * media_select, + gchar * page_size) +{ + gint pos; + + gl_debug (DEBUG_MEDIA_SELECT, "START"); + + g_signal_handlers_block_by_func (G_OBJECT(media_select->page_size_entry), + G_CALLBACK(page_size_entry_changed_cb), + media_select); + gtk_editable_delete_text (GTK_EDITABLE (media_select->page_size_entry), + 0, -1); + g_signal_handlers_unblock_by_func (G_OBJECT(media_select->page_size_entry), + G_CALLBACK(page_size_entry_changed_cb), + media_select); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (media_select->page_size_entry), + page_size, strlen (page_size), &pos); + + gl_debug (DEBUG_MEDIA_SELECT, "END"); +} diff --git a/glabels2/src/wdgt-media-select.h b/glabels2/src/wdgt-media-select.h new file mode 100644 index 0000000..8d628f4 --- /dev/null +++ b/glabels2/src/wdgt-media-select.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_media_select.h: media selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_MEDIA_SELECT_H__ +#define __WDGT_MEDIA_SELECT_H__ + +#include <gnome.h> + +#define GL_TYPE_WDGT_MEDIA_SELECT (gl_wdgt_media_select_get_type ()) +#define GL_WDGT_MEDIA_SELECT(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_MEDIA_SELECT, glWdgtMediaSelect )) +#define GL_WDGT_MEDIA_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_MEDIA_SELECT, glWdgtMediaSelectClass)) +#define GL_IS_WDGT_MEDIA_SELECT(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_MEDIA_SELECT)) +#define GL_IS_WDGT_MEDIA_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_MEDIA_SELECT)) + +typedef struct _glWdgtMediaSelect glWdgtMediaSelect; +typedef struct _glWdgtMediaSelectClass glWdgtMediaSelectClass; + +struct _glWdgtMediaSelect { + GtkVBox parent_widget; + + GtkWidget *page_size_entry; + GtkWidget *template_combo; + GtkWidget *template_entry; + + GtkWidget *mini_preview; + + GtkWidget *desc_label; + GtkWidget *sheet_size_label; + GtkWidget *number_label; + GtkWidget *label_size_label; +}; + +struct _glWdgtMediaSelectClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtMediaSelect * media_select, gpointer user_data); +}; + +extern guint gl_wdgt_media_select_get_type (void); + +extern GtkWidget *gl_wdgt_media_select_new (void); + +extern gchar *gl_wdgt_media_select_get_name (glWdgtMediaSelect * media_select); + +extern void gl_wdgt_media_select_set_name (glWdgtMediaSelect * media_select, + gchar * name); + +extern gchar *gl_wdgt_media_select_get_page_size (glWdgtMediaSelect * media_select); + +extern void gl_wdgt_media_select_set_page_size (glWdgtMediaSelect * media_select, + gchar * page_size); + +#endif diff --git a/glabels2/src/wdgt-mini-preview.c b/glabels2/src/wdgt-mini-preview.c new file mode 100644 index 0000000..d2c0577 --- /dev/null +++ b/glabels2/src/wdgt-mini-preview.c @@ -0,0 +1,562 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_mini_preview.c: mini preview widget module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "libgnomeprint/gnome-print-paper.h" + +#include "wdgt-mini-preview.h" +#include "marshal.h" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_MAX_PIXELS 175 +#define SHADOW_X_OFFSET 3 +#define SHADOW_Y_OFFSET 3 +#define SHADOW_COLOR GNOME_CANVAS_COLOR_A (33, 33, 33, 192) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CLICKED, + PRESSED, + LAST_SIGNAL +}; + + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_mini_preview_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass * class); +static void gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview * preview); +static void gl_wdgt_mini_preview_finalize (GObject * object); + +static void gl_wdgt_mini_preview_construct (glWdgtMiniPreview * preview, + gint height, gint width); + +static GList *mini_outline_list_new (GnomeCanvas *canvas, + glTemplate *template); +static void mini_outline_list_free (GList ** list); + +static gint canvas_event_cb (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_mini_preview_get_type (void) +{ + static guint wdgt_mini_preview_type = 0; + + if (!wdgt_mini_preview_type) { + GTypeInfo wdgt_mini_preview_info = { + sizeof (glWdgtMiniPreviewClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_mini_preview_class_init, + NULL, + NULL, + sizeof (glWdgtMiniPreview), + 0, + (GInstanceInitFunc) gl_wdgt_mini_preview_instance_init, + }; + + wdgt_mini_preview_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtMiniPreview", + &wdgt_mini_preview_info, 0); + } + + return wdgt_mini_preview_type; +} + +static void +gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_mini_preview_finalize; + + wdgt_mini_preview_signals[CLICKED] = + g_signal_new ("clicked", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtMiniPreviewClass, clicked), + NULL, NULL, + gl_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); + + wdgt_mini_preview_signals[PRESSED] = + g_signal_new ("pressed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtMiniPreviewClass, pressed), + NULL, NULL, + gl_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +static void +gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview * preview) +{ + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + preview->canvas = NULL; + preview->label_items = NULL; + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +static void +gl_wdgt_mini_preview_finalize (GObject * object) +{ + glWdgtMiniPreview *preview; + glWdgtMiniPreviewClass *class; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_MINI_PREVIEW (object)); + + preview = GL_WDGT_MINI_PREVIEW (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +GtkWidget * +gl_wdgt_mini_preview_new (gint height, + gint width) +{ + glWdgtMiniPreview *preview; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + preview = g_object_new (gl_wdgt_mini_preview_get_type (), NULL); + + gl_wdgt_mini_preview_construct (preview, height, width); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); + + return GTK_WIDGET (preview); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_mini_preview_construct (glWdgtMiniPreview * preview, + gint height, + gint width) +{ + GtkWidget *whbox; + GnomeCanvasGroup *group; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + whbox = GTK_WIDGET (preview); + + preview->height = height; + preview->width = width; + + /* create canvas */ + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + preview->canvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + gtk_box_pack_start (GTK_BOX (whbox), preview->canvas, TRUE, TRUE, 0); + gtk_widget_set_size_request (preview->canvas, width, height); + gnome_canvas_set_scroll_region (GNOME_CANVAS (preview->canvas), + 0.0, 0.0, width, height); + + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (preview->canvas), 1.0); + group = gnome_canvas_root (GNOME_CANVAS (preview->canvas)); + + /* draw shadow */ + preview->shadow_item = + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", (gdouble)SHADOW_X_OFFSET, + "y1", (gdouble)SHADOW_Y_OFFSET, + "x2", (gdouble)(SHADOW_X_OFFSET + width), + "y2", (gdouble)(SHADOW_Y_OFFSET + height), + "fill_color_rgba", SHADOW_COLOR, + NULL); + + /* draw an initial paper outline */ + preview->paper_item = + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", (gdouble)width, + "y2", (gdouble)height, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + + /* create empty list of label canvas items */ + preview->label_items = NULL; + preview->labels_per_sheet = 0; + + /* Event handler */ + g_signal_connect (G_OBJECT (preview->canvas), "event", + G_CALLBACK (canvas_event_cb), preview); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +/****************************************************************************/ +/* Set label for mini-preview to determine geometry. */ +/****************************************************************************/ +void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview * preview, + gchar *name) +{ + glTemplate *template; + gchar *page_size; + const GnomePrintPaper *paper = NULL; + gdouble paper_width, paper_height; + gdouble canvas_scale; + gdouble w, h; + gdouble shadow_x, shadow_y; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + /* Fetch template */ + template = gl_template_from_name (name); + + /* get paper size and set scale */ + paper = gnome_print_paper_get_by_name (template->page_size); + paper_width = paper->width; + paper_height = paper->height; + w = preview->width - 4 - 2*SHADOW_X_OFFSET; + h = preview->height - 4 - 2*SHADOW_Y_OFFSET; + if ( (w/paper_width) > (h/paper_height) ) { + canvas_scale = h / paper_height; + } else { + canvas_scale = w / paper_width; + } + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (preview->canvas), + canvas_scale); + gnome_canvas_set_scroll_region (GNOME_CANVAS (preview->canvas), + 0.0, 0.0, paper_width, paper_height); + + /* update shadow */ + shadow_x = SHADOW_X_OFFSET/canvas_scale; + shadow_y = SHADOW_Y_OFFSET/canvas_scale; + gnome_canvas_item_set (preview->shadow_item, + "x1", shadow_x, + "y1", shadow_y, + "x2", shadow_x + paper_width, + "y2", shadow_y + paper_height, + NULL); + + /* update paper outline */ + gnome_canvas_item_set (preview->paper_item, + "x2", paper_width, + "y2", paper_height, + NULL); + + /* update label items */ + mini_outline_list_free (&preview->label_items); + preview->label_items = + mini_outline_list_new (GNOME_CANVAS(preview->canvas), + template); + + gl_template_free( &template ); + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw label outlines and return canvas item list. */ +/*--------------------------------------------------------------------------*/ +static GList * +mini_outline_list_new (GnomeCanvas * canvas, + glTemplate * template) +{ + GnomeCanvasGroup *group = NULL; + GnomeCanvasItem *item = NULL; + GList *list = NULL; + gint i, ix, iy; + gdouble x1, y1, x2, y2, y_temp; + const GnomePrintPaper *paper = NULL; + gdouble paper_height; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + /* get paper height */ + paper = gnome_print_paper_get_by_name (template->page_size); + paper_height = paper->height; + + group = gnome_canvas_root (canvas); + + /* draw mini label outlines */ + i = 1; + for (iy = (template->ny - 1); iy >= 0; iy--) { + for (ix = 0; ix < template->nx; ix++, i++) { + + x1 = ix * (template->dx) + template->x0; + y1 = iy * (template->dy) + template->y0; + x2 = x1 + template->label_width; + y2 = y1 + template->label_height; + + /* transform origin from lower left to upper left */ + /* and swap y's so that (y1 < y2) */ + y_temp = y2; + y2 = paper_height - y1; + y1 = paper_height - y_temp; + + switch (template->style) { + case GL_TEMPLATE_STYLE_RECT: + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type(), + "x1", x1, + "y1", y1, + "x2", x2, + "y2", y2, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + item = gnome_canvas_item_new (group, + gnome_canvas_ellipse_get_type(), + "x1", x1, + "y1", y1, + "x2", x2, + "y2", y2, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + default: + g_warning ("Unknown label style"); + return list; + break; + } + g_object_set_data (G_OBJECT (item), "i", + GINT_TO_POINTER (i)); + + list = g_list_append (list, item); + } + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); + return list; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw label outlines and return canvas item list. */ +/*--------------------------------------------------------------------------*/ +static void +mini_outline_list_free (GList ** list) +{ + GnomeCanvasItem *item; + GList *p; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + if ( *list != NULL ) { + + for (p = *list; p != NULL; p = p->next) { + item = GNOME_CANVAS_ITEM (p->data); + gtk_object_destroy (GTK_OBJECT (item)); + } + + g_list_free (*list); + *list = NULL; + + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static gint +canvas_event_cb (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + glWdgtMiniPreview *preview = GL_WDGT_MINI_PREVIEW (data); + GnomeCanvasItem *item; + static gboolean dragging = FALSE; + static gint prev_i = 0, first, last; + gint i; + gdouble x, y; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + gnome_canvas_window_to_world (canvas, + event->button.x, event->button.y, + &x, &y); + switch (event->button.button) { + case 1: + /* Get item at cursor and make sure + it's a label object ("i" is valid) */ + item = gnome_canvas_get_item_at (GNOME_CANVAS (canvas), + x, y); + if (item == NULL) + break; + i = GPOINTER_TO_INT (g_object_get_data + (G_OBJECT (item), "i")); + if (i == 0) + break; + /* Go into dragging mode while remains pressed. */ + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (canvas)->window, + FALSE, + GDK_POINTER_MOTION_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_BUTTON_PRESS_MASK, NULL, NULL, + event->button.time); + g_signal_emit (G_OBJECT(preview), + wdgt_mini_preview_signals[CLICKED], + 0, i); + first = i; + last = i; + g_signal_emit (G_OBJECT(preview), + wdgt_mini_preview_signals[PRESSED], + 0, first, last); + prev_i = i; + break; + + default: + break; + } + break; + + case GDK_BUTTON_RELEASE: + gnome_canvas_window_to_world (canvas, + event->button.x, event->button.y, + &x, &y); + switch (event->button.button) { + case 1: + /* Exit dragging mode */ + dragging = FALSE; + gdk_pointer_ungrab (event->button.time); + break; + + default: + break; + } + break; + + case GDK_MOTION_NOTIFY: + gnome_canvas_window_to_world (canvas, + event->motion.x, event->motion.y, + &x, &y); + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + /* Get item at cursor and + make sure it's a label object ("i" is valid) */ + item = gnome_canvas_get_item_at (GNOME_CANVAS (canvas), + x, y); + if (item == NULL) + break; + i = GPOINTER_TO_INT (g_object_get_data + (G_OBJECT (item), "i")); + if (i == 0) + break; + if (prev_i != i) { + /* Entered into a new item */ + last = i; + g_signal_emit (G_OBJECT(preview), + wdgt_mini_preview_signals[PRESSED], + 0, + MIN (first, last), + MAX (first, last)); + prev_i = i; + } + } + break; + + default: + break; + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); + + return FALSE; +} + +/****************************************************************************/ +/* Highlight given label outlines. */ +/****************************************************************************/ +void +gl_wdgt_mini_preview_highlight_range (glWdgtMiniPreview * preview, + gint first_label, + gint last_label) +{ + GnomeCanvasItem *item = NULL; + GList *p = NULL; + gint i; + + gl_debug (DEBUG_MINI_PREVIEW, "START"); + + for (p = preview->label_items, i = 1; p != NULL; i++, p = p->next) { + + item = GNOME_CANVAS_ITEM (p->data); + + if ((i >= first_label) && (i <= last_label)) { + gnome_canvas_item_set (item, + "fill_color", "light blue", + NULL); + } else { + gnome_canvas_item_set (item, + "fill_color", "white", NULL); + } + + } + + gl_debug (DEBUG_MINI_PREVIEW, "END"); +} + diff --git a/glabels2/src/wdgt-mini-preview.h b/glabels2/src/wdgt-mini-preview.h new file mode 100644 index 0000000..db40ba0 --- /dev/null +++ b/glabels2/src/wdgt-mini-preview.h @@ -0,0 +1,80 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_mini_preview.h: mini-preview widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_MINI_PREVIEW_H__ +#define __WDGT_MINI_PREVIEW_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_MINI_PREVIEW (gl_wdgt_mini_preview_get_type ()) +#define GL_WDGT_MINI_PREVIEW(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_MINI_PREVIEW, glWdgtMiniPreview )) +#define GL_WDGT_MINI_PREVIEW_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_MINI_PREVIEW, glWdgtMiniPreviewClass)) +#define GL_IS_WDGT_MINI_PREVIEW(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_MINI_PREVIEW)) +#define GL_IS_WDGT_MINI_PREVIEW_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_MINI_PREVIEW)) + +typedef struct _glWdgtMiniPreview glWdgtMiniPreview; +typedef struct _glWdgtMiniPreviewClass glWdgtMiniPreviewClass; + +struct _glWdgtMiniPreview { + GtkHBox parent_widget; + + gint height; + gint width; + + GtkWidget *canvas; + GnomeCanvasItem *paper_item; + GnomeCanvasItem *shadow_item; + + gint labels_per_sheet; + GList *label_items; +}; + +struct _glWdgtMiniPreviewClass { + GtkHBoxClass parent_class; + + void (*clicked) (glWdgtMiniPreview *preview, + gint index, + gpointer user_data); + + void (*pressed) (glWdgtMiniPreview *preview, + gint index1, + gint index2, + gpointer user_data); +}; + +extern guint gl_wdgt_mini_preview_get_type (void); + +extern GtkWidget *gl_wdgt_mini_preview_new (gint height, gint width); + +extern void gl_wdgt_mini_preview_set_label (glWdgtMiniPreview * preview, + gchar * name); + +extern void gl_wdgt_mini_preview_highlight_range (glWdgtMiniPreview * preview, + gint first_label, + gint last_label); + +#endif diff --git a/glabels2/src/wdgt-position.c b/glabels2/src/wdgt-position.c new file mode 100644 index 0000000..e90ba0b --- /dev/null +++ b/glabels2/src/wdgt-position.c @@ -0,0 +1,322 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_position.c: position properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-position.h" +#include "prefs.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtPositionSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_position_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_position_class_init (glWdgtPositionClass * class); +static void gl_wdgt_position_instance_init (glWdgtPosition * position); +static void gl_wdgt_position_finalize (GObject * object); +static void gl_wdgt_position_construct (glWdgtPosition * position, + gchar * label); +static void changed_cb (glWdgtPosition * position); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_position_get_type (void) +{ + static guint wdgt_position_type = 0; + + if (!wdgt_position_type) { + GTypeInfo wdgt_position_info = { + sizeof (glWdgtPositionClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_position_class_init, + NULL, + NULL, + sizeof (glWdgtPosition), + 0, + (GInstanceInitFunc) gl_wdgt_position_instance_init, + }; + + wdgt_position_type = g_type_register_static (gtk_vbox_get_type (), + "glWdgtPosition", + &wdgt_position_info, + 0); + } + + return wdgt_position_type; +} + +static void +gl_wdgt_position_class_init (glWdgtPositionClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_position_finalize; + + wdgt_position_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtPositionClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_position_instance_init (glWdgtPosition * position) +{ + position->x_spin = NULL; + position->y_spin = NULL; +} + +static void +gl_wdgt_position_finalize (GObject * object) +{ + glWdgtPosition *position; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_POSITION (object)); + + position = GL_WDGT_POSITION (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_position_new (gchar * label) +{ + glWdgtPosition *position; + + position = g_object_new (gl_wdgt_position_get_type (), NULL); + + gl_wdgt_position_construct (position, label); + + return GTK_WIDGET (position); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_position_construct (glWdgtPosition * position, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *x_adjust, *y_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + gl_debug (DEBUG_WDGT, "START"); + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + gl_debug (DEBUG_WDGT, "units = %s", units_string); + gl_debug (DEBUG_WDGT, "units/point = %f", units_per_point); + gl_debug (DEBUG_WDGT, "climb_rate = %f", climb_rate); + gl_debug (DEBUG_WDGT, "digits = %d", digits); + + wvbox = GTK_WIDGET (position); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* X label */ + wlabel = gtk_label_new (_("X:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* X spin */ + x_adjust = gtk_adjustment_new (0.0, 0.0, 100.0, climb_rate, 10.0, 10.0); + position->x_spin = gtk_spin_button_new (GTK_ADJUSTMENT (x_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (position->x_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (position->x_spin), TRUE); + g_signal_connect_swapped (G_OBJECT (position->x_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (position)); + gtk_table_attach_defaults (GTK_TABLE (wtable), position->x_spin, + 1, 2, 0, 1); + + /* Y label */ + wlabel = gtk_label_new (_("Y:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Y spin */ + y_adjust = gtk_adjustment_new (0.0, 0.0, 100.0, climb_rate, 10.0, 10.0); + position->y_spin = gtk_spin_button_new (GTK_ADJUSTMENT (y_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (position->y_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (position->y_spin), TRUE); + g_signal_connect_swapped (G_OBJECT (position->y_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (position)); + gtk_table_attach_defaults (GTK_TABLE (wtable), position->y_spin, + 1, 2, 1, 2); + + /* Units */ + position->units_label = gtk_label_new (units_string); + gtk_misc_set_alignment (GTK_MISC (position->units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), + position->units_label, 2, 3, 1, 2); + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtPosition * position) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (position), wdgt_position_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_position_get_position (glWdgtPosition * position, + gdouble * x, + gdouble * y) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + *x = gtk_spin_button_get_value (GTK_SPIN_BUTTON(position->x_spin)); + *y = gtk_spin_button_get_value (GTK_SPIN_BUTTON(position->y_spin)); + + /* convert everything back to our internal units (points) */ + *x /= units_per_point; + *y /= units_per_point; +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_position_set_params (glWdgtPosition * position, + gdouble x, + gdouble y, + gdouble x_max, + gdouble y_max) +{ + GtkObject *x_adjust, *y_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + /* Put everything into our display units */ + x *= units_per_point; + y *= units_per_point; + x_max *= units_per_point; + y_max *= units_per_point; + + /* update X/Y spin controls */ + x_adjust = gtk_adjustment_new (x, 0.0, x_max, climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (position->x_spin), + GTK_ADJUSTMENT (x_adjust), climb_rate, + digits); + y_adjust = gtk_adjustment_new (y, 0.0, y_max, climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (position->y_spin), + GTK_ADJUSTMENT (y_adjust), climb_rate, + digits); + + /* Units */ + gtk_label_set_text (GTK_LABEL (position->units_label), units_string); + +} + +/*====================================================================*/ +/* fill in position info only. */ +/*====================================================================*/ +void +gl_wdgt_position_set_position (glWdgtPosition * position, + gdouble x, + gdouble y) +{ + gdouble units_per_point; + + gl_debug (DEBUG_WDGT, "START"); + + units_per_point = gl_prefs_get_units_per_point (); + + gl_debug (DEBUG_WDGT, "units/point = %f", units_per_point); + + /* Put everything in our display units */ + x *= units_per_point; + y *= units_per_point; + + /* update X/Y spin controls */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (position->x_spin), x); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (position->y_spin), y); + + gl_debug (DEBUG_WDGT, "END"); +} diff --git a/glabels2/src/wdgt-position.h b/glabels2/src/wdgt-position.h new file mode 100644 index 0000000..41b1323 --- /dev/null +++ b/glabels2/src/wdgt-position.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_position.h: position properties widget module header file + * + * Copyright (C) 2000, 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_POSITION_H__ +#define __WDGT_POSITION_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_POSITION (gl_wdgt_position_get_type ()) +#define GL_WDGT_POSITION(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_POSITION, glWdgtPosition )) +#define GL_WDGT_POSITION_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_POSITION, glWdgtPositionClass)) +#define GL_IS_WDGT_POSITION(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_POSITION)) +#define GL_IS_WDGT_POSITION_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_POSITION)) + +typedef struct _glWdgtPosition glWdgtPosition; +typedef struct _glWdgtPositionClass glWdgtPositionClass; + +struct _glWdgtPosition { + GtkVBox parent_widget; + + GtkWidget *x_spin; + GtkWidget *y_spin; + GtkWidget *units_label; +}; + +struct _glWdgtPositionClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtPosition * prop, gpointer user_data); +}; + +extern guint gl_wdgt_position_get_type (void); + +extern GtkWidget *gl_wdgt_position_new (gchar * label); + +extern void gl_wdgt_position_get_position (glWdgtPosition * position, + gdouble * x, gdouble * y); + +extern void gl_wdgt_position_set_params (glWdgtPosition * position, + gdouble x, gdouble y, + gdouble x_max, gdouble y_max); + +extern void gl_wdgt_position_set_position (glWdgtPosition * position, + gdouble x, gdouble y); + +#endif diff --git a/glabels2/src/wdgt-print-copies.c b/glabels2/src/wdgt-print-copies.c new file mode 100644 index 0000000..75dc8cd --- /dev/null +++ b/glabels2/src/wdgt-print-copies.c @@ -0,0 +1,397 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_copies.c: custom print copies widget module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-print-copies.h" +#include "wdgt-mini-preview.h" +#include "marshal.h" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_HEIGHT 175 +#define WDGT_MINI_PREVIEW_WIDTH 150 + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class); +static void gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies); +static void gl_wdgt_print_copies_finalize (GObject * object); + +static void gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies, + glLabel * label); + +static void sheets_radio_cb (GtkToggleButton * togglebutton, + gpointer user_data); +static void first_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data); +static void last_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data); + +static void +preview_pressed (glWdgtMiniPreview *mini_preview, + gint first, gint last, gpointer user_data); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_print_copies_get_type (void) +{ + static guint wdgt_print_copies_type = 0; + + if (!wdgt_print_copies_type) { + GTypeInfo wdgt_print_copies_info = { + sizeof (glWdgtPrintCopiesClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_print_copies_class_init, + NULL, + NULL, + sizeof (glWdgtPrintCopies), + 0, + (GInstanceInitFunc) gl_wdgt_print_copies_instance_init, + }; + + wdgt_print_copies_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtPrintCopies", + &wdgt_print_copies_info, 0); + } + + return wdgt_print_copies_type; +} + +static void +gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_print_copies_finalize; +} + +static void +gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies) +{ + copies->labels_per_sheet = 0; + + copies->mini_preview = NULL; + + copies->sheets_radio = NULL; + copies->sheets_spin = NULL; + + copies->labels_radio = NULL; + copies->first_spin = NULL; + copies->last_spin = NULL; +} + +static void +gl_wdgt_print_copies_finalize (GObject * object) +{ + glWdgtPrintCopies *copies; + glWdgtPrintCopiesClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_PRINT_COPIES (object)); + + copies = GL_WDGT_PRINT_COPIES (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_print_copies_new (glLabel * label) +{ + glWdgtPrintCopies *copies; + + copies = g_object_new (gl_wdgt_print_copies_get_type (), NULL); + + gl_wdgt_print_copies_construct (copies, label); + + return GTK_WIDGET (copies); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies, + glLabel * label) +{ + GtkWidget *whbox, *wvbox, *whbox1; + GSList *radio_group = NULL; + GtkObject *adjust; + const glTemplate *template; + + whbox = GTK_WIDGET (copies); + + template = gl_label_get_template (label); + copies->labels_per_sheet = template->nx * template->ny; + + /* mini_preview canvas */ + copies->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT, + WDGT_MINI_PREVIEW_WIDTH); + gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + template->name->data); + gtk_box_pack_start (GTK_BOX (whbox), copies->mini_preview, + TRUE, TRUE, GNOME_PAD); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox, TRUE, TRUE, GNOME_PAD); + + /* Sheet controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + copies->sheets_radio = + gtk_radio_button_new_with_label (radio_group, _("Sheets:")); + gtk_box_pack_start (GTK_BOX (whbox1), copies->sheets_radio, + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0); + copies->sheets_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), copies->sheets_spin, + FALSE, FALSE, 0); + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + 1, copies->labels_per_sheet); + + /* Label controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + radio_group = + gtk_radio_button_get_group (GTK_RADIO_BUTTON (copies->sheets_radio)); + copies->labels_radio = + gtk_radio_button_new_with_label (radio_group, _("Labels")); + gtk_box_pack_start (GTK_BOX (whbox1), copies->labels_radio, + FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("from:")), + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (1, 1.0, copies->labels_per_sheet, + 1.0, 10.0, 10.0); + copies->first_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), copies->first_spin, + FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("to:")), + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (copies->labels_per_sheet, + 1.0, copies->labels_per_sheet, + 1.0, 10.0, 10.0); + copies->last_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), copies->last_spin, + FALSE, FALSE, 0); + gtk_widget_set_sensitive (copies->first_spin, FALSE); + gtk_widget_set_sensitive (copies->last_spin, FALSE); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (copies->mini_preview), "pressed", + G_CALLBACK (preview_pressed), copies); + g_signal_connect (G_OBJECT (copies->sheets_radio), "toggled", + G_CALLBACK (sheets_radio_cb), copies); + g_signal_connect (G_OBJECT (copies->first_spin), "changed", + G_CALLBACK (first_spin_cb), copies); + g_signal_connect (G_OBJECT (copies->last_spin), "changed", + G_CALLBACK (last_spin_cb), copies); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Enable/Disable appropriate controls due to radio button toggle.*/ +/*--------------------------------------------------------------------------*/ +static void +sheets_radio_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + gint first, last; + + if (gtk_toggle_button_get_active (togglebutton)) { + + gtk_widget_set_sensitive (copies->sheets_spin, TRUE); + gtk_widget_set_sensitive (copies->first_spin, FALSE); + gtk_widget_set_sensitive (copies->last_spin, FALSE); + + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + 1, copies->labels_per_sheet); + + } else { + + gtk_widget_set_sensitive (copies->sheets_spin, FALSE); + gtk_widget_set_sensitive (copies->first_spin, TRUE); + gtk_widget_set_sensitive (copies->last_spin, TRUE); + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + last = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + first, last); + + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of first spin button */ +/*--------------------------------------------------------------------------*/ +static void +first_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + gint first, last; + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + last = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (copies->last_spin))-> + lower = first; + + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + first, last); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of last spin button */ +/*--------------------------------------------------------------------------*/ +static void +last_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + gint first, last; + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + last = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (copies->first_spin))-> + upper = last; + + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), + first, last); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static void +preview_pressed (glWdgtMiniPreview *mini_preview, + gint first, + gint last, + gpointer user_data) +{ + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (user_data); + + gl_wdgt_print_copies_set_range (copies, 1, first, last); +} + +/****************************************************************************/ +/* query selected range of labels within sheet or number of sheets. */ +/****************************************************************************/ +void +gl_wdgt_print_copies_get_range (glWdgtPrintCopies * copies, + gint * n_sheets, + gint * first_label, + gint * last_label) +{ + gboolean sheets_active; + + sheets_active = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (copies->sheets_radio)); + + if (sheets_active) { + *n_sheets = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->sheets_spin)); + *first_label = 1; + *last_label = copies->labels_per_sheet; + } else { + *n_sheets = 1; + *first_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + *last_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->last_spin)); + } +} + +/****************************************************************************/ +/* set range of labels within sheet or number of sheets */ +/****************************************************************************/ +void +gl_wdgt_print_copies_set_range (glWdgtPrintCopies * copies, + gint n_sheets, + gint first_label, + gint last_label) +{ + gint old_first_label; + + old_first_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (copies->first_spin)); + + if (first_label > old_first_label) { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->last_spin), + last_label); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->first_spin), + first_label); + } else { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->first_spin), + first_label); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (copies->last_spin), + last_label); + } + if ((first_label == 1) && (last_label == copies->labels_per_sheet)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (copies->sheets_radio), TRUE); + gtk_spin_button_set_value (GTK_SPIN_BUTTON + (copies->sheets_spin), n_sheets); + } else { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (copies->labels_radio), TRUE); + gtk_spin_button_set_value (GTK_SPIN_BUTTON + (copies->sheets_spin), 1.0); + } +} diff --git a/glabels2/src/wdgt-print-copies.h b/glabels2/src/wdgt-print-copies.h new file mode 100644 index 0000000..09d0b67 --- /dev/null +++ b/glabels2/src/wdgt-print-copies.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_copies.h: custom print copies widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_PRINT_COPIES_H__ +#define __WDGT_PRINT_COPIES_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_PRINT_COPIES (gl_wdgt_print_copies_get_type ()) +#define GL_WDGT_PRINT_COPIES(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_PRINT_COPIES, glWdgtPrintCopies )) +#define GL_WDGT_PRINT_COPIES_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_PRINT_COPIES, glWdgtPrintCopiesClass)) +#define GL_IS_WDGT_PRINT_COPIES(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_PRINT_COPIES)) +#define GL_IS_WDGT_PRINT_COPIES_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_PRINT_COPIES)) + +typedef struct _glWdgtPrintCopies glWdgtPrintCopies; +typedef struct _glWdgtPrintCopiesClass glWdgtPrintCopiesClass; + +struct _glWdgtPrintCopies { + GtkHBox parent_widget; + + gint labels_per_sheet; + + GtkWidget *mini_preview; + + GtkWidget *sheets_radio; + GtkWidget *sheets_spin; + + GtkWidget *labels_radio; + GtkWidget *first_spin; + GtkWidget *last_spin; +}; + +struct _glWdgtPrintCopiesClass { + GtkHBoxClass parent_class; +}; + +extern guint gl_wdgt_print_copies_get_type (void); + +extern GtkWidget *gl_wdgt_print_copies_new (glLabel * label); + +extern void gl_wdgt_print_copies_get_range (glWdgtPrintCopies * copies, + gint * n_sheets, + gint * first_label, + gint * last_label); + +extern void gl_wdgt_print_copies_set_range (glWdgtPrintCopies * copies, + gint n_sheets, + gint first_label, + gint last_label); + +#endif diff --git a/glabels2/src/wdgt-print-merge.c b/glabels2/src/wdgt-print-merge.c new file mode 100644 index 0000000..f11a0e4 --- /dev/null +++ b/glabels2/src/wdgt-print-merge.c @@ -0,0 +1,337 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_merge.c: print merge widget module + * + * Copyright (C) 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-print-merge.h" +#include "wdgt-mini-preview.h" +#include "marshal.h" + +#include "pixmaps/collate.xpm" +#include "pixmaps/nocollate.xpm" + +#include "debug.h" + +#define WDGT_MINI_PREVIEW_HEIGHT 175 +#define WDGT_MINI_PREVIEW_WIDTH 150 + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * class); +static void gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge); +static void gl_wdgt_print_merge_finalize (GObject * object); + +static void gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, + glLabel * label); + +static void preview_clicked (glWdgtMiniPreview *mini_preview, + gint i_label, + gpointer user_data); + +static void collate_check_cb (GtkToggleButton * togglebutton, + gpointer user_data); +static void spin_cb (GtkSpinButton * spinbutton, + gpointer user_data); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_print_merge_get_type (void) +{ + static guint wdgt_print_merge_type = 0; + + if (!wdgt_print_merge_type) { + GTypeInfo wdgt_print_merge_info = { + sizeof (glWdgtPrintMergeClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_print_merge_class_init, + NULL, + NULL, + sizeof (glWdgtPrintMerge), + 0, + (GInstanceInitFunc) gl_wdgt_print_merge_instance_init, + }; + + wdgt_print_merge_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtPrintMerge", + &wdgt_print_merge_info, 0); + } + + return wdgt_print_merge_type; +} + +static void +gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_print_merge_finalize; +} + +static void +gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge) +{ + merge->mini_preview = NULL; + + merge->copies_spin = NULL; + merge->first_spin = NULL; + merge->collate_image = NULL; + merge->collate_check = NULL; +} + +static void +gl_wdgt_print_merge_finalize (GObject * object) +{ + glWdgtPrintMerge *merge; + glWdgtPrintMergeClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_PRINT_MERGE (object)); + + merge = GL_WDGT_PRINT_MERGE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_print_merge_new (glLabel * label) +{ + glWdgtPrintMerge *merge; + + merge = g_object_new (gl_wdgt_print_merge_get_type (), NULL); + + gl_wdgt_print_merge_construct (merge, label); + + return GTK_WIDGET (merge); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, + glLabel * label) +{ + GtkWidget *whbox, *wvbox, *whbox1; + GtkObject *adjust; + GdkPixbuf *pixbuf; + const glTemplate *template; + + whbox = GTK_WIDGET (merge); + + template = gl_label_get_template (label); + merge->labels_per_sheet = template->nx * template->ny; + + /* mini_preview canvas */ + merge->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT, + WDGT_MINI_PREVIEW_WIDTH); + gl_wdgt_mini_preview_set_label( GL_WDGT_MINI_PREVIEW (merge->mini_preview), + template->name->data ); + gtk_box_pack_start (GTK_BOX (whbox), merge->mini_preview, + TRUE, TRUE, GNOME_PAD); + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview), + 1, 1); + + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox), wvbox, TRUE, TRUE, GNOME_PAD); + + /* First Label controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox1), + gtk_label_new (_("Start on label")), FALSE, FALSE, + 0); + adjust = + gtk_adjustment_new (1, 1.0, merge->labels_per_sheet, 1.0, 10.0, + 10.0); + merge->first_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), merge->first_spin, FALSE, FALSE, + 0); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("on 1st sheet")), + FALSE, FALSE, 0); + + /* Collate controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_end (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + pixbuf = gdk_pixbuf_new_from_xpm_data ( (const char **)nocollate_xpm); + merge->collate_image = gtk_image_new_from_pixbuf(pixbuf); + + gtk_box_pack_start (GTK_BOX (whbox1), merge->collate_image, + FALSE, FALSE, 0); + merge->collate_check = gtk_check_button_new_with_label (_("Collate")); + gtk_box_pack_start (GTK_BOX (whbox1), merge->collate_check, + FALSE, FALSE, 0); + + /* Copy controls */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_box_pack_end (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("Copies:")), + FALSE, FALSE, 0); + adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0); + merge->copies_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), merge->copies_spin, + FALSE, FALSE, 0); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (merge->mini_preview), "clicked", + G_CALLBACK (preview_clicked), merge); + g_signal_connect (G_OBJECT (merge->collate_check), "toggled", + G_CALLBACK (collate_check_cb), merge); + g_signal_connect (G_OBJECT (merge->copies_spin), "changed", + G_CALLBACK (spin_cb), merge); + g_signal_connect (G_OBJECT (merge->first_spin), "changed", + G_CALLBACK (spin_cb), merge); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Enable/Disable appropriate controls due to radio button toggle.*/ +/*--------------------------------------------------------------------------*/ +static void +collate_check_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (user_data); + GdkPixbuf *pixbuf; + + if (gtk_toggle_button_get_active (togglebutton)) { + + pixbuf = + gdk_pixbuf_new_from_xpm_data ( (const char **)collate_xpm); + + } else { + + pixbuf = + gdk_pixbuf_new_from_xpm_data ( (const char **)nocollate_xpm); + + } + gtk_image_set_from_pixbuf (GTK_IMAGE (merge->collate_image), + pixbuf); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of first spin button */ +/*--------------------------------------------------------------------------*/ +static void +spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (user_data); + gint first, last, n_copies; + + first = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->first_spin)); + + n_copies = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->copies_spin)); + last = first + (n_copies * merge->n_records) - 1; + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview), + first, last ); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static void +preview_clicked (glWdgtMiniPreview *mini_preview, + gint first, + gpointer user_data) +{ + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (user_data); + gint n_copies, last; + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (merge->first_spin), + first); + + n_copies = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->copies_spin)); + last = first + (n_copies * merge->n_records) - 1; + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW (merge->mini_preview), + first, last); + +} + +/****************************************************************************/ +/* query selected range of labels within sheet or number of sheets. */ +/****************************************************************************/ +void +gl_wdgt_print_merge_get_copies (glWdgtPrintMerge * merge, + gint * n_copies, + gint * first_label, + gboolean * collate_flag) +{ + *n_copies = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->copies_spin)); + *first_label = + gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON + (merge->first_spin)); + *collate_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (merge->collate_check)); +} + +/****************************************************************************/ +/* set range of labels within sheet or number of sheets */ +/****************************************************************************/ +void +gl_wdgt_print_merge_set_copies (glWdgtPrintMerge * merge, + gint n_copies, + gint first_label, + gint n_records, + gboolean collate_flag) +{ + gint last_label; + + merge->n_records = n_records; + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (merge->copies_spin), + n_copies); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (merge->first_spin), + first_label); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (merge->collate_check), + collate_flag); + + last_label = first_label + (n_copies * n_records) - 1; + gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW (merge->mini_preview), + first_label, last_label ); +} diff --git a/glabels2/src/wdgt-print-merge.h b/glabels2/src/wdgt-print-merge.h new file mode 100644 index 0000000..186a339 --- /dev/null +++ b/glabels2/src/wdgt-print-merge.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_print_merge.h: print merge widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_PRINT_MERGE_H__ +#define __WDGT_PRINT_MERGE_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_PRINT_MERGE (gl_wdgt_print_merge_get_type ()) +#define GL_WDGT_PRINT_MERGE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_PRINT_MERGE, glWdgtPrintMerge )) +#define GL_WDGT_PRINT_MERGE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_PRINT_MERGE, glWdgtPrintMergeClass)) +#define GL_IS_WDGT_PRINT_MERGE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_PRINT_MERGE)) +#define GL_IS_WDGT_PRINT_MERGE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_PRINT_MERGE)) + +typedef struct _glWdgtPrintMerge glWdgtPrintMerge; +typedef struct _glWdgtPrintMergeClass glWdgtPrintMergeClass; + +struct _glWdgtPrintMerge { + GtkHBox parent_widget; + + gint labels_per_sheet; + GtkWidget *mini_preview; + + gint n_records; + + GtkWidget *copies_spin; + GtkWidget *first_spin; + GtkWidget *collate_image; + GtkWidget *collate_check; +}; + +struct _glWdgtPrintMergeClass { + GtkHBoxClass parent_class; +}; + +extern guint gl_wdgt_print_merge_get_type (void); + +extern GtkWidget *gl_wdgt_print_merge_new (glLabel * label); + +extern void gl_wdgt_print_merge_get_copies (glWdgtPrintMerge * merge, + gint * n_copies, + gint * first_label, + gboolean * collate_flag); + +extern void gl_wdgt_print_merge_set_copies (glWdgtPrintMerge * merge, + gint n_copies, + gint first_label, + gint n_records, + gboolean collate_flag); + +#endif diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c new file mode 100644 index 0000000..23ba0b0 --- /dev/null +++ b/glabels2/src/wdgt-rotate-label.c @@ -0,0 +1,359 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_rotate_label.c: label rotate selection widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-rotate-label.h" +#include "template.h" +#include "marshal.h" + +#include "debug.h" + +#define MINI_PREVIEW_MAX_PIXELS 48 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtRotateLabelSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_rotate_label_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass * class); +static void gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel * rotate_select); +static void gl_wdgt_rotate_label_finalize (GObject * object); + +static void gl_wdgt_rotate_label_construct (glWdgtRotateLabel * rotate_select); + +static void entry_changed_cb (GtkToggleButton * toggle, + gpointer user_data); + +static GtkWidget *mini_preview_canvas_new (void); + +static void mini_preview_canvas_update (GnomeCanvas * canvas, + glTemplate * template, + gboolean rotate_flag); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_wdgt_rotate_label_get_type (void) +{ + static guint wdgt_rotate_label_type = 0; + + if (!wdgt_rotate_label_type) { + GTypeInfo wdgt_rotate_label_info = { + sizeof (glWdgtRotateLabelClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_rotate_label_class_init, + NULL, + NULL, + sizeof (glWdgtRotateLabel), + 0, + (GInstanceInitFunc) gl_wdgt_rotate_label_instance_init, + + }; + + wdgt_rotate_label_type = + g_type_register_static (gtk_hbox_get_type (), + "glWdgtRotateLabel", + &wdgt_rotate_label_info, 0); + } + + return wdgt_rotate_label_type; +} + +static void +gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->finalize = gl_wdgt_rotate_label_finalize; + + wdgt_rotate_label_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtRotateLabelClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel * rotate_select) +{ + rotate_select->rotate_check = NULL; + + rotate_select->canvas = NULL; + + rotate_select->template = NULL; +} + +static void +gl_wdgt_rotate_label_finalize (GObject * object) +{ + glWdgtRotateLabel *rotate_select; + glWdgtRotateLabelClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (object)); + + rotate_select = GL_WDGT_ROTATE_LABEL (object); + +#if 0 + gl_template_free (&rotate_select->template); +#endif + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_rotate_label_new (void) +{ + glWdgtRotateLabel *rotate_select; + + rotate_select = g_object_new (gl_wdgt_rotate_label_get_type (), NULL); + + gl_wdgt_rotate_label_construct (rotate_select); + + return GTK_WIDGET (rotate_select); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_wdgt_rotate_label_construct (glWdgtRotateLabel * rotate_select) +{ + GtkWidget *whbox; + + whbox = GTK_WIDGET (rotate_select); + + /* Actual selection control */ + rotate_select->rotate_check = + gtk_check_button_new_with_label (_("Rotate")); + gtk_box_pack_start (GTK_BOX (whbox), rotate_select->rotate_check, TRUE, + TRUE, GNOME_PAD); + + /* mini_preview canvas */ + rotate_select->canvas = mini_preview_canvas_new (); + gtk_box_pack_start (GTK_BOX (whbox), rotate_select->canvas, + TRUE, TRUE, GNOME_PAD); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (rotate_select->rotate_check), "toggled", + G_CALLBACK (entry_changed_cb), rotate_select); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of check button */ +/*--------------------------------------------------------------------------*/ +static void +entry_changed_cb (GtkToggleButton * toggle, + gpointer user_data) +{ + glWdgtRotateLabel *rotate_select = GL_WDGT_ROTATE_LABEL (user_data); + + if (rotate_select->template != NULL) { + /* Update mini_preview canvas & details with template */ + mini_preview_canvas_update (GNOME_CANVAS + (rotate_select->canvas), + rotate_select->template, + gtk_toggle_button_get_active + (toggle)); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (user_data), + wdgt_rotate_label_signals[CHANGED], 0); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw a mini-preview canvas. */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +mini_preview_canvas_new (void) +{ + GtkWidget *wcanvas = NULL; + + /* Create a canvas */ + gtk_widget_push_colormap (gdk_rgb_get_colormap ()); + wcanvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + + gtk_widget_set_size_request (GTK_WIDGET (wcanvas), + MINI_PREVIEW_MAX_PIXELS + 8, + MINI_PREVIEW_MAX_PIXELS + 8); + + gtk_object_set_data (GTK_OBJECT (wcanvas), "label_item", NULL); + + return wcanvas; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update mini-preview canvas from new template. */ +/*--------------------------------------------------------------------------*/ +static void +mini_preview_canvas_update (GnomeCanvas * canvas, + glTemplate * template, + gboolean rotate_flag) +{ + gdouble canvas_scale; + GnomeCanvasGroup *group = NULL; + GnomeCanvasItem *label_item = NULL; + gdouble m, w, h; + + /* Fetch our data from canvas */ + label_item = g_object_get_data (G_OBJECT (canvas), "label_item"); + + m = MAX (template->label_width, template->label_height); + canvas_scale = (MINI_PREVIEW_MAX_PIXELS) / m; + + /* FIXME: Stupid hack to eliminate canvas artifacts. */ + if (rotate_flag) { + canvas_scale *= 1.02; + } + + /* scale and size canvas */ + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (canvas), canvas_scale); + group = gnome_canvas_root (GNOME_CANVAS (canvas)); + gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), + -m / 2.0, -m / 2.0, + +m / 2.0, +m / 2.0); + + /* remove old label outline */ + if (label_item != NULL) { + gtk_object_destroy (GTK_OBJECT (label_item)); + } + + /* draw mini label outline */ + if (!rotate_flag) { + w = template->label_width; + h = template->label_height; + } else { + w = template->label_height; + h = template->label_width; + } + switch (template->style) { + case GL_TEMPLATE_STYLE_RECT: + label_item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type(), + "x1", -w / 2.0, + "y1", -h / 2.0, + "x2", +w / 2.0, + "y2", +h / 2.0, + "width_pixels", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + label_item = gnome_canvas_item_new (group, + gnome_canvas_ellipse_get_type(), + "x1", -w / 2.0, + "y1", -h / 2.0, + "x2", +w / 2.0, + "y2", +h / 2.0, + "width_pixels", 2, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + default: + g_warning ("Unknown label style"); + break; + } + + gtk_object_set_data (GTK_OBJECT (canvas), "label_item", label_item); + +} + +/****************************************************************************/ +/* query state of widget. */ +/****************************************************************************/ +gboolean +gl_wdgt_rotate_label_get_state (glWdgtRotateLabel * rotate_select) +{ + return + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check)); +} + +/****************************************************************************/ +/* set state of widget. */ +/****************************************************************************/ +void +gl_wdgt_rotate_label_set_state (glWdgtRotateLabel * rotate_select, + gboolean state) +{ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check), state); +} + +/****************************************************************************/ +/* set template for widget. */ +/****************************************************************************/ +void +gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel * rotate_select, + gchar * name) +{ + glTemplate *template; + + template = gl_template_from_name (name); + rotate_select->template = template; + + if (template->label_width != template->label_height) { + gtk_widget_set_sensitive (rotate_select->rotate_check, TRUE); + } else { + gtk_widget_set_sensitive (rotate_select->rotate_check, FALSE); + } + + mini_preview_canvas_update (GNOME_CANVAS (rotate_select->canvas), + template, FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check), FALSE); +} diff --git a/glabels2/src/wdgt-rotate-label.h b/glabels2/src/wdgt-rotate-label.h new file mode 100644 index 0000000..e971276 --- /dev/null +++ b/glabels2/src/wdgt-rotate-label.h @@ -0,0 +1,71 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_rotate_label.h: label rotate selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_ROTATE_LABEL_H__ +#define __WDGT_ROTATE_LABEL_H__ + +#include <gnome.h> +#include "template.h" + +#define GL_TYPE_WDGT_ROTATE_LABEL (gl_wdgt_rotate_label_get_type ()) +#define GL_WDGT_ROTATE_LABEL(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_ROTATE_LABEL, glWdgtRotateLabel )) +#define GL_WDGT_ROTATE_LABEL_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_ROTATE_LABEL, glWdgtRotateLabelClass)) +#define GL_IS_WDGT_ROTATE_LABEL(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_ROTATE_LABEL)) +#define GL_IS_WDGT_ROTATE_LABEL_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_ROTATE_LABEL)) + +typedef struct _glWdgtRotateLabel glWdgtRotateLabel; +typedef struct _glWdgtRotateLabelClass glWdgtRotateLabelClass; + +struct _glWdgtRotateLabel { + GtkHBox parent_widget; + + GtkWidget *rotate_check; + + GtkWidget *canvas; + + glTemplate *template; +}; + +struct _glWdgtRotateLabelClass { + GtkHBoxClass parent_class; + + void (*changed) (glWdgtRotateLabel * wdgt_rotate_label, + gpointer user_data); +}; + +extern guint gl_wdgt_rotate_label_get_type (void); + +extern GtkWidget *gl_wdgt_rotate_label_new (void); + +extern gboolean gl_wdgt_rotate_label_get_state (glWdgtRotateLabel * wdgt_rotate_label); + +extern void gl_wdgt_rotate_label_set_state (glWdgtRotateLabel * wdgt_rotate_label, + gboolean state); + +extern void gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel * wdgt_rotate_label, + gchar * name); + +#endif diff --git a/glabels2/src/wdgt-size.c b/glabels2/src/wdgt-size.c new file mode 100644 index 0000000..50352e0 --- /dev/null +++ b/glabels2/src/wdgt-size.c @@ -0,0 +1,493 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_size.c: size properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-size.h" +#include "prefs.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtSizeSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_size_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_size_class_init (glWdgtSizeClass * class); +static void gl_wdgt_size_instance_init (glWdgtSize * size); +static void gl_wdgt_size_finalize (GObject * object); +static void gl_wdgt_size_construct (glWdgtSize * size, gchar * label); + +static void aspect_toggle_cb (GtkToggleButton * togglebutton, + gpointer user_data); +static void w_spin_cb (GtkSpinButton * spinbutton, gpointer user_data); +static void h_spin_cb (GtkSpinButton * spinbutton, gpointer user_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_size_get_type (void) +{ + static guint wdgt_size_type = 0; + + if (!wdgt_size_type) { + GTypeInfo wdgt_size_info = { + sizeof (glWdgtSizeClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_size_class_init, + NULL, + NULL, + sizeof (glWdgtSize), + 0, + (GInstanceInitFunc) gl_wdgt_size_instance_init, + }; + + wdgt_size_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtSize", &wdgt_size_info, 0); + } + + return wdgt_size_type; +} + +static void +gl_wdgt_size_class_init (glWdgtSizeClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_size_finalize; + + wdgt_size_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtSizeClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_size_instance_init (glWdgtSize * size) +{ + size->aspect_ratio = 1.0; + + size->w_spin = NULL; + size->h_spin = NULL; + + size->units_label = NULL; + + size->aspect_checkbox = NULL; +} + +static void +gl_wdgt_size_finalize (GObject * object) +{ + glWdgtSize *size; + glWdgtSizeClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_SIZE (object)); + + size = GL_WDGT_SIZE (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_size_new (gchar * label) +{ + glWdgtSize *size; + + size = g_object_new (gl_wdgt_size_get_type (), NULL); + + gl_wdgt_size_construct (size, label); + + return GTK_WIDGET (size); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_size_construct (glWdgtSize * size, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *w_adjust, *h_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + wvbox = GTK_WIDGET (size); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (3, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* W Label */ + wlabel = gtk_label_new (_("Width:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* W spin */ + w_adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, + climb_rate, 10.0, 10.0); + size->w_spin = gtk_spin_button_new (GTK_ADJUSTMENT (w_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->w_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->w_spin), TRUE); + gtk_table_attach_defaults (GTK_TABLE (wtable), size->w_spin, + 1, 2, 0, 1); + + /* H label */ + wlabel = gtk_label_new (_("Height:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* H spin */ + h_adjust = gtk_adjustment_new (climb_rate, climb_rate, + 100.0, climb_rate, 10.0, 10.0); + size->h_spin = gtk_spin_button_new (GTK_ADJUSTMENT (h_adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->h_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->h_spin), TRUE); + gtk_table_attach_defaults (GTK_TABLE (wtable), size->h_spin, + 1, 2, 1, 2); + + /* Units */ + size->units_label = gtk_label_new (units_string); + gtk_misc_set_alignment (GTK_MISC (size->units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), + size->units_label, 2, 3, 1, 2); + + /* Maintain aspect ratio checkbox */ + size->aspect_checkbox = + gtk_check_button_new_with_label (_ + ("Maintain current aspect ratio")); + gtk_table_attach_defaults (GTK_TABLE (wtable), size->aspect_checkbox, 0, + 3, 2, 3); + + /* Connect signals to controls */ + g_signal_connect (G_OBJECT (size->aspect_checkbox), "toggled", + G_CALLBACK (aspect_toggle_cb), size); + g_signal_connect (G_OBJECT (size->w_spin), "changed", + G_CALLBACK (w_spin_cb), size); + g_signal_connect (G_OBJECT (size->h_spin), "changed", + G_CALLBACK (h_spin_cb), size); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Maintain aspect ratio checkbox callback. */ +/*--------------------------------------------------------------------------*/ +static void +aspect_toggle_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtSize *size = GL_WDGT_SIZE (user_data); + GtkAdjustment *w_adjust, *h_adjust; + + if (gtk_toggle_button_get_active (togglebutton)) { + + size->w = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->w_spin)); + size->h = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->h_spin)); + + size->aspect_ratio = size->h / size->w; + + /* We have a new aspect ratio, adjust one of the maxes accordingly */ + if ((size->h_max_orig / size->w_max_orig) < size->aspect_ratio) { + size->w_max = size->h_max_orig / size->aspect_ratio; + size->h_max = size->h_max_orig; + } else { + size->w_max = size->w_max_orig; + size->h_max = size->w_max_orig * size->aspect_ratio; + } + + } else { + + /* Reset maximums */ + size->w_max = size->w_max_orig; + size->h_max = size->h_max_orig; + + } + + g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + w_adjust = + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (size->w_spin)); + w_adjust->upper = size->w_max; + gtk_spin_button_update (GTK_SPIN_BUTTON (size->w_spin)); + h_adjust = + gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (size->h_spin)); + h_adjust->upper = size->h_max; + gtk_spin_button_update (GTK_SPIN_BUTTON (size->h_spin)); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. W spin button changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +w_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtSize *size = GL_WDGT_SIZE (user_data); + GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); + + size->w = + gtk_spin_button_get_value (GTK_SPIN_BUTTON (size->w_spin)); + + if (gtk_toggle_button_get_active (toggle)) { + + size->h = size->w * size->aspect_ratio; + + /* Update our sibling control, blocking recursion. */ + g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin), + size->h); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + user_data); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. H spin button changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +h_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glWdgtSize *size = GL_WDGT_SIZE (user_data); + GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); + + size->h = + gtk_spin_button_get_value (GTK_SPIN_BUTTON (size->h_spin)); + + if (gtk_toggle_button_get_active (toggle)) { + + size->w = size->h / size->aspect_ratio; + + /* Update our sibling control, blocking recursion. */ + g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin), + size->w); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + user_data); + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); + +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_size_get_size (glWdgtSize * size, + gdouble * w, + gdouble * h, + gboolean * keep_aspect_ratio_flag) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + *w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->w_spin)); + *h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->h_spin)); + + *keep_aspect_ratio_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (size->aspect_checkbox)); + + /* convert everything back to our internal units (points) */ + *w /= units_per_point; + *h /= units_per_point; +} + +/*====================================================================*/ +/* set values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_size_set_params (glWdgtSize * size, + gdouble w, + gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, + gdouble h_max) +{ + GtkObject *w_adjust, *h_adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + /* Put everything into our display units */ + size->w = w * units_per_point; + size->h = h * units_per_point; + size->w_max = w_max * units_per_point; + size->h_max = h_max * units_per_point; + + /* Squirrel away copies of our original maximums */ + size->w_max_orig = size->w_max; + size->h_max_orig = size->h_max; + + size->aspect_ratio = size->h / size->w; + if (keep_aspect_ratio_flag) { + + /* When tracking aspect ratio, adjust one of the maxes */ + if ((size->h_max / size->w_max) < size->aspect_ratio) { + size->w_max = size->h_max / size->aspect_ratio; + } else { + size->h_max = size->w_max * size->aspect_ratio; + } + + /* before adjusting w & h, limit to max values */ + if (size->w > size->w_max) + size->w = size->w_max; + if (size->h > size->h_max) + size->h = size->h_max; + + } + + /* update W/H spin controls */ + w_adjust = gtk_adjustment_new (size->w, climb_rate, size->w_max, + climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (size->w_spin), + GTK_ADJUSTMENT (w_adjust), climb_rate, + digits); + h_adjust = + gtk_adjustment_new (size->h, climb_rate, size->h_max, climb_rate, + 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (size->h_spin), + GTK_ADJUSTMENT (h_adjust), climb_rate, + digits); + + gtk_label_set_text (GTK_LABEL (size->units_label), units_string); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (size->aspect_checkbox), + keep_aspect_ratio_flag); + +} + +/*====================================================================*/ +/* set size only. */ +/*====================================================================*/ +void +gl_wdgt_size_set_size (glWdgtSize * size, + gdouble w, + gdouble h) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + /* Put everything into our display units */ + size->w = w * units_per_point; + size->h = h * units_per_point; + + /* update aspect ratio */ + size->aspect_ratio = size->h / size->w; + + /* update W/H spin controls */ + g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + size); + g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + size); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin), size->w); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin), size->h); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin), + G_CALLBACK (w_spin_cb), + size); + g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin), + G_CALLBACK (h_spin_cb), + size); +} diff --git a/glabels2/src/wdgt-size.h b/glabels2/src/wdgt-size.h new file mode 100644 index 0000000..3e53e55 --- /dev/null +++ b/glabels2/src/wdgt-size.h @@ -0,0 +1,78 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_size.h: size properties widget module header file + * + * Copyright (C) 2000, 2001 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_SIZE_H__ +#define __WDGT_SIZE_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_SIZE (gl_wdgt_size_get_type ()) +#define GL_WDGT_SIZE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_SIZE, glWdgtSize )) +#define GL_WDGT_SIZE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_SIZE, glWdgtSizeClass)) +#define GL_IS_WDGT_SIZE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_SIZE)) +#define GL_IS_WDGT_SIZE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_SIZE)) + +typedef struct _glWdgtSize glWdgtSize; +typedef struct _glWdgtSizeClass glWdgtSizeClass; + +struct _glWdgtSize { + GtkVBox parent_widget; + + gdouble w, h; + gdouble aspect_ratio; + gdouble w_max, h_max; + gdouble w_max_orig, h_max_orig; + + GtkWidget *w_spin; + GtkWidget *h_spin; + GtkWidget *units_label; + GtkWidget *aspect_checkbox; +}; + +struct _glWdgtSizeClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtSize * size, gpointer user_data); +}; + +extern guint gl_wdgt_size_get_type (void); + +extern GtkWidget *gl_wdgt_size_new (gchar * label); + +extern void gl_wdgt_size_get_size (glWdgtSize * size, + gdouble * w, gdouble * h, + gboolean * keep_aspect_ratio_flag); + +extern void gl_wdgt_size_set_params (glWdgtSize * size, + gdouble w, gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, gdouble h_max); + +extern void gl_wdgt_size_set_size (glWdgtSize * size, + gdouble w, gdouble h); + +#endif diff --git a/glabels2/src/wdgt-text-entry.c b/glabels2/src/wdgt-text-entry.c new file mode 100644 index 0000000..912a905 --- /dev/null +++ b/glabels2/src/wdgt-text-entry.c @@ -0,0 +1,321 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_entry.c: text entry widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-text-entry.h" +#include "merge.h" +#include "text-node.h" +#include "marshal.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtTextEntrySignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_text_entry_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_text_entry_class_init (glWdgtTextEntryClass * class); +static void gl_wdgt_text_entry_instance_init (glWdgtTextEntry * text_entry); +static void gl_wdgt_text_entry_finalize (GObject * object); +static void gl_wdgt_text_entry_construct (glWdgtTextEntry * text_entry, + gchar * label, GList * field_defs); + +static void changed_cb (glWdgtTextEntry * text_entry); +static void insert_cb (glWdgtTextEntry * text_entry); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_text_entry_get_type (void) +{ + static guint wdgt_text_entry_type = 0; + + if (!wdgt_text_entry_type) { + GTypeInfo wdgt_text_entry_info = { + sizeof (glWdgtTextEntryClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_text_entry_class_init, + NULL, + NULL, + sizeof (glWdgtTextEntry), + 0, + (GInstanceInitFunc) gl_wdgt_text_entry_instance_init, + }; + + wdgt_text_entry_type = g_type_register_static (gtk_vbox_get_type (), + "glWdgtTextEntry", + &wdgt_text_entry_info, + 0); + } + + return wdgt_text_entry_type; +} + +static void +gl_wdgt_text_entry_class_init (glWdgtTextEntryClass * class) +{ + GObjectClass *object_class; + + gl_debug (DEBUG_WDGT, "START"); + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_text_entry_finalize; + + wdgt_text_entry_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtTextEntryClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, G_TYPE_NONE, 0); + + gl_debug (DEBUG_WDGT, "END"); +} + +static void +gl_wdgt_text_entry_instance_init (glWdgtTextEntry * text_entry) +{ + gl_debug (DEBUG_WDGT, "START"); + + text_entry->text_entry = NULL; + text_entry->key_entry = NULL; + text_entry->insert_button = NULL; + + gl_debug (DEBUG_WDGT, "END"); +} + +static void +gl_wdgt_text_entry_finalize (GObject * object) +{ + glWdgtTextEntry *text_entry; + glWdgtTextEntryClass *class; + + gl_debug (DEBUG_WDGT, "START"); + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_TEXT_ENTRY (object)); + + text_entry = GL_WDGT_TEXT_ENTRY (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); + + gl_debug (DEBUG_WDGT, "END"); +} + +GtkWidget * +gl_wdgt_text_entry_new (gchar * label, + GList * field_defs) +{ + glWdgtTextEntry *text_entry; + + gl_debug (DEBUG_WDGT, "START"); + + text_entry = g_object_new (gl_wdgt_text_entry_get_type (), NULL); + + gl_wdgt_text_entry_construct (text_entry, label, field_defs); + + gl_debug (DEBUG_WDGT, "END"); + + return GTK_WIDGET (text_entry); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_text_entry_construct (glWdgtTextEntry * text_entry, + gchar * label, + GList * field_defs) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel, *wcombo; + GList *keys; + + gl_debug (DEBUG_WDGT, "START"); + + wvbox = GTK_WIDGET (text_entry); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Actual text entry widget */ + text_entry->text_entry = gtk_text_view_new (); + text_entry->text_buffer = + gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); + g_signal_connect_swapped (G_OBJECT (text_entry->text_buffer), + "changed", G_CALLBACK (changed_cb), + G_OBJECT (text_entry)); + gtk_widget_set_size_request (text_entry->text_entry, -1, 70); + gtk_table_attach_defaults (GTK_TABLE (wtable), text_entry->text_entry, + 0, 3, 0, 1); + + /* Insert merge field label */ + wlabel = gtk_label_new (_("Key:")); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + + /* Key entry widget */ + wcombo = gtk_combo_new (); + keys = gl_merge_get_key_list (field_defs); + if (keys != NULL) + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), keys); + gl_merge_free_key_list (&keys); + text_entry->key_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (text_entry->key_entry), FALSE); + gtk_widget_set_size_request (wcombo, 200, -1); + gtk_table_attach_defaults (GTK_TABLE (wtable), wcombo, 1, 2, 1, 2); + + /* Insert button */ + text_entry->insert_button = + gtk_button_new_with_label (_("Insert merge field")); + g_signal_connect_swapped (G_OBJECT (text_entry->insert_button), + "clicked", G_CALLBACK (insert_cb), + G_OBJECT (text_entry)); + gtk_table_attach_defaults (GTK_TABLE (wtable), + text_entry->insert_button, 2, 3, 1, 2); + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when text has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtTextEntry * text_entry) +{ + gl_debug (DEBUG_WDGT, "START"); + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (text_entry), + wdgt_text_entry_signals[CHANGED], 0); + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback to insert field into text buffer. */ +/*--------------------------------------------------------------------------*/ +static void +insert_cb (glWdgtTextEntry * text_entry) +{ + GtkTextBuffer *buffer; + gchar *key, *field; + + gl_debug (DEBUG_WDGT, "START"); + + key = + gtk_editable_get_chars (GTK_EDITABLE (text_entry->key_entry), 0, + -1); + field = g_strdup_printf ("FIELD{%s}", key); + + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); + gtk_text_buffer_insert_at_cursor (buffer, field, -1); + + g_free (field); + g_free (key); + + + gl_debug (DEBUG_WDGT, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* Get widget data. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_wdgt_text_entry_get_text (glWdgtTextEntry * text_entry) +{ + GtkTextBuffer *buffer; + gchar *text; + GList *lines; + GtkTextIter start, end; + + gl_debug (DEBUG_WDGT, "START"); + + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); + + gtk_text_buffer_get_bounds (buffer, &start, &end); + + text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); + + lines = gl_text_node_lines_new_from_text (text); + + g_free (text); + + gl_debug (DEBUG_WDGT, "END"); + + return lines; +} + +/*--------------------------------------------------------------------------*/ +/* Set widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_wdgt_text_entry_set_text (glWdgtTextEntry * text_entry, + gboolean merge_flag, + GList * lines) +{ + GtkTextBuffer *buffer; + gchar *text; + + gl_debug (DEBUG_WDGT, "START"); + + gtk_widget_set_sensitive (text_entry->key_entry, merge_flag); + gtk_widget_set_sensitive (text_entry->insert_button, merge_flag); + + text = gl_text_node_lines_expand (lines, NULL); + + g_signal_handlers_block_by_func (G_OBJECT(text_entry->text_buffer), + changed_cb, text_entry); + gtk_text_buffer_set_text (text_entry->text_buffer, text, -1); + g_signal_handlers_unblock_by_func (G_OBJECT(text_entry->text_buffer), + changed_cb, text_entry); + + gl_debug (DEBUG_WDGT, "END"); +} diff --git a/glabels2/src/wdgt-text-entry.h b/glabels2/src/wdgt-text-entry.h new file mode 100644 index 0000000..e5fa697 --- /dev/null +++ b/glabels2/src/wdgt-text-entry.h @@ -0,0 +1,69 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_entry.h: text entry widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_TEXT_ENTRY_H__ +#define __WDGT_TEXT_ENTRY_H__ + +#include <gnome.h> + +#include "merge.h" + +#define GL_TYPE_WDGT_TEXT_ENTRY (gl_wdgt_text_entry_get_type ()) +#define GL_WDGT_TEXT_ENTRY(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_TEXT_ENTRY, glWdgtTextEntry )) +#define GL_WDGT_TEXT_ENTRY_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_TEXT_ENTRY, glWdgtTextEntryClass)) +#define GL_IS_WDGT_TEXT_ENTRY(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_TEXT_ENTRY)) +#define GL_IS_WDGT_TEXT_ENTRY_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_TEXT_ENTRY)) + +typedef struct _glWdgtTextEntry glWdgtTextEntry; +typedef struct _glWdgtTextEntryClass glWdgtTextEntryClass; + +struct _glWdgtTextEntry { + GtkVBox parent_widget; + + GtkWidget *text_entry; + GtkWidget *key_entry; + GtkWidget *insert_button; + + GtkTextBuffer *text_buffer; +}; + +struct _glWdgtTextEntryClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtTextEntry * text_entry, gpointer user_data); +}; + +extern guint gl_wdgt_text_entry_get_type (void); + +extern GtkWidget *gl_wdgt_text_entry_new (gchar * label, GList * field_defs); + +extern GList *gl_wdgt_text_entry_get_text (glWdgtTextEntry * text_entry); + +extern void gl_wdgt_text_entry_set_text (glWdgtTextEntry * text_entry, + gboolean merge_flag, + GList * lines); + +#endif diff --git a/glabels2/src/wdgt-text-props.c b/glabels2/src/wdgt-text-props.c new file mode 100644 index 0000000..7dbbc65 --- /dev/null +++ b/glabels2/src/wdgt-text-props.c @@ -0,0 +1,428 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_props.c: text properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> + +#include "wdgt-text-props.h" +#include "marshal.h" + +#include "debug.h" + +#define RED(x) ( ((x)>>24) & 0xff ) +#define GREEN(x) ( ((x)>>16) & 0xff ) +#define BLUE(x) ( ((x)>>8) & 0xff ) +#define ALPHA(x) ( (x) & 0xff ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtTextPropsSignal) (GObject * object, + gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GObjectClass *parent_class; + +static gint wdgt_text_props_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_text_props_class_init (glWdgtTextPropsClass * class); +static void gl_wdgt_text_props_instance_init (glWdgtTextProps * text); +static void gl_wdgt_text_props_finalize (GObject * object); +static void gl_wdgt_text_props_construct (glWdgtTextProps * text, gchar * label); + +static void changed_cb (glWdgtTextProps * text); +static void just_toggled_cb (GtkToggleButton * togglebutton, + gpointer user_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_text_props_get_type (void) +{ + static guint wdgt_text_props_type = 0; + + if (!wdgt_text_props_type) { + GTypeInfo wdgt_text_props_info = { + sizeof (glWdgtTextPropsClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_text_props_class_init, + NULL, + NULL, + sizeof (glWdgtTextProps), + 0, + (GInstanceInitFunc) gl_wdgt_text_props_instance_init, + }; + + wdgt_text_props_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtTextProps", &wdgt_text_props_info, 0); + } + + return wdgt_text_props_type; +} + +static void +gl_wdgt_text_props_class_init (glWdgtTextPropsClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_text_props_finalize; + + wdgt_text_props_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtTextPropsClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_text_props_instance_init (glWdgtTextProps * text) +{ + text->font_family_entry = NULL; + text->font_size_spin = NULL; + text->font_b_button = NULL; + text->font_i_button = NULL; + + text->color_picker = NULL; + + text->left_button = NULL; + text->right_button = NULL; + text->center_button = NULL; +} + +static void +gl_wdgt_text_props_finalize (GObject * object) +{ + glWdgtTextProps *text; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_TEXT_PROPS (object)); + + text = GL_WDGT_TEXT_PROPS (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_text_props_new (gchar * label) +{ + glWdgtTextProps *text; + + text = g_object_new (gl_wdgt_text_props_get_type (), NULL); + + gl_wdgt_text_props_construct (text, label); + + return GTK_WIDGET (text); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_text_props_construct (glWdgtTextProps * text, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel, *whbox1, *wcombo; + GList *family_names = NULL; + GtkObject *adjust; + + wvbox = GTK_WIDGET (text); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (3, 3, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Font label */ + wlabel = gtk_label_new (_("Font:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + + /* Pack these widgets into an inner hbox */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_table_attach_defaults (GTK_TABLE (wtable), whbox1, 1, 3, 0, 1); + + /* Font family entry widget */ + wcombo = gtk_combo_new (); + family_names = gnome_font_family_list (); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), family_names); + gnome_font_family_list_free (family_names); + text->font_family_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (text->font_family_entry), FALSE); + gtk_widget_set_size_request (wcombo, 200, -1); + gtk_box_pack_start (GTK_BOX (whbox1), wcombo, FALSE, FALSE, 0); + g_signal_connect_swapped (G_OBJECT (text->font_family_entry), + "changed", G_CALLBACK (changed_cb), + G_OBJECT (text)); + + /* Font size entry widget */ + adjust = gtk_adjustment_new (1.0, 1.0, 250.0, 1.0, 10.0, 10.0); + text->font_size_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_size_spin, FALSE, + FALSE, 0); + g_signal_connect_swapped (G_OBJECT (text->font_size_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + + /* Font weight/italic button widgets */ + text->font_b_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->font_b_button), + gtk_image_new_from_stock (GTK_STOCK_BOLD, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_b_button, FALSE, FALSE, + 0); + g_signal_connect_swapped (G_OBJECT (text->font_b_button), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + text->font_i_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->font_i_button), + gtk_image_new_from_stock (GTK_STOCK_ITALIC, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_i_button, FALSE, FALSE, + 0); + g_signal_connect_swapped (G_OBJECT (text->font_i_button), "toggled", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + + /* Text Color Label */ + wlabel = gtk_label_new (_("Color:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + + /* Text Color picker widget */ + text->color_picker = gnome_color_picker_new (); + g_signal_connect_swapped (G_OBJECT (text->color_picker), "color_set", + G_CALLBACK (changed_cb), + G_OBJECT (text)); + gtk_table_attach_defaults (GTK_TABLE (wtable), text->color_picker, 1, 2, + 1, 2); + + /* Alignment label */ + wlabel = gtk_label_new (_("Alignment:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 2, 3); + + /* Pack these widgets into an inner hbox */ + whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); + gtk_table_attach_defaults (GTK_TABLE (wtable), whbox1, 1, 2, 2, 3); + + /* Justification entry widget */ + text->left_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->left_button), + gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_LEFT, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->left_button, FALSE, FALSE, + 0); + text->center_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->center_button), + gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_CENTER, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->center_button, FALSE, FALSE, + 0); + text->right_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->right_button), + gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT, + GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (whbox1), text->right_button, FALSE, FALSE, + 0); + + /* Now connect a callback that makes these toggles mutually exclusive */ + g_signal_connect (G_OBJECT (text->left_button), "toggled", + G_CALLBACK (just_toggled_cb), text); + g_signal_connect (G_OBJECT (text->center_button), "toggled", + G_CALLBACK (just_toggled_cb), text); + g_signal_connect (G_OBJECT (text->right_button), "toggled", + G_CALLBACK (just_toggled_cb), text); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtTextProps * text) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (text), wdgt_text_props_signals[CHANGED], 0); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Justify toggle button callback. */ +/*--------------------------------------------------------------------------*/ +static void +just_toggled_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glWdgtTextProps *text = GL_WDGT_TEXT_PROPS (user_data); + + if (gtk_toggle_button_get_active (togglebutton)) { + + if (GTK_WIDGET (togglebutton) == GTK_WIDGET (text->left_button)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->center_button), + FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->right_button), + FALSE); + } else if (GTK_WIDGET (togglebutton) == + GTK_WIDGET (text->center_button)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->left_button), + FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->right_button), + FALSE); + } else if (GTK_WIDGET (togglebutton) == + GTK_WIDGET (text->right_button)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->left_button), + FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (text->center_button), + FALSE); + } + + } + + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (text), wdgt_text_props_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_text_props_get_params (glWdgtTextProps * text, + gchar ** font_family, + gdouble * font_size, + GnomeFontWeight * font_weight, + gboolean * font_italic_flag, + guint * color, + GtkJustification * just) +{ + guint8 r, g, b, a; + + /* ------ Get updated font information ------ */ + *font_family = + gtk_editable_get_chars (GTK_EDITABLE (text->font_family_entry), 0, + -1); + *font_size = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(text->font_size_spin)); + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->font_b_button))) { + *font_weight = GNOME_FONT_BOLD; + } else { + *font_weight = GNOME_FONT_BOOK; + } + *font_italic_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (text->font_i_button)); + + /* ------ Get updated color ------ */ + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (text->color_picker), + &r, &g, &b, &a); + *color = GNOME_CANVAS_COLOR_A (r, g, b, a); + + /* ------- Get updated justification ------ */ + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->left_button))) { + *just = GTK_JUSTIFY_LEFT; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->right_button))) { + *just = GTK_JUSTIFY_RIGHT; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (text->center_button))) { + *just = GTK_JUSTIFY_CENTER; + } else { + *just = GTK_JUSTIFY_LEFT; /* Should not happen. */ + } + +} + +/*====================================================================*/ +/* fill in values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_text_props_set_params (glWdgtTextProps * text, + gchar * font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just) +{ + gtk_entry_set_text (GTK_ENTRY (text->font_family_entry), font_family); + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (text->font_size_spin), + font_size); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_b_button), + (font_weight == GNOME_FONT_BOLD)); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_i_button), + font_italic_flag); + + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (text->color_picker), + RED (color), GREEN (color), BLUE (color), + ALPHA (color)); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->left_button), + (just == GTK_JUSTIFY_LEFT)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->center_button), + (just == GTK_JUSTIFY_CENTER)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->right_button), + (just == GTK_JUSTIFY_RIGHT)); +} diff --git a/glabels2/src/wdgt-text-props.h b/glabels2/src/wdgt-text-props.h new file mode 100644 index 0000000..219e8e9 --- /dev/null +++ b/glabels2/src/wdgt-text-props.h @@ -0,0 +1,82 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_text_props.h: text properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_TEXT_PROPS_H__ +#define __WDGT_TEXT_PROPS_H__ + +#include <gtk/gtk.h> +#include <libgnomeprint/gnome-font.h> +#include "label.h" + +#define GL_TYPE_WDGT_TEXT_PROPS (gl_wdgt_text_props_get_type ()) +#define GL_WDGT_TEXT_PROPS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_TEXT_PROPS, glWdgtTextProps )) +#define GL_WDGT_TEXT_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_TEXT_PROPS, glWdgtTextPropsClass)) +#define GL_IS_WDGT_TEXT_PROPS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_TEXT_PROPS)) +#define GL_IS_WDGT_TEXT_PROPS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_TEXT_PROPS)) + +typedef struct _glWdgtTextProps glWdgtTextProps; +typedef struct _glWdgtTextPropsClass glWdgtTextPropsClass; + +struct _glWdgtTextProps { + GtkVBox parent_widget; + + GtkWidget *font_family_entry; + GtkWidget *font_size_spin; + GtkWidget *font_b_button; + GtkWidget *font_i_button; + + GtkWidget *color_picker; + + GtkWidget *left_button, *right_button, *center_button; +}; + +struct _glWdgtTextPropsClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtTextProps * text, gpointer user_data); +}; + +extern guint gl_wdgt_text_props_get_type (void); + +extern GtkWidget *gl_wdgt_text_props_new (gchar * label); + +extern void gl_wdgt_text_props_get_params (glWdgtTextProps * text, + gchar ** font_family, + gdouble * font_size, + GnomeFontWeight * font_weight, + gboolean * font_italic_flag, + guint * color, + GtkJustification * just); + +extern void gl_wdgt_text_props_set_params (glWdgtTextProps * text, + gchar * font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just); + +#endif diff --git a/glabels2/src/wdgt-vector.c b/glabels2/src/wdgt-vector.c new file mode 100644 index 0000000..c8f81c1 --- /dev/null +++ b/glabels2/src/wdgt-vector.c @@ -0,0 +1,306 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_vector.c: vector properties widget module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include "wdgt-vector.h" +#include "prefs.h" +#include "marshal.h" + +#include "debug.h" + +#include <math.h> + +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif + +#define LENGTH(x,y) sqrt( (x)*(x) + (y)*(y) ) +#define ANGLE(x,y) ( (180.0/M_PI)*atan2( -(y), (x) ) ) +#define COMP_X(l,a) ( (l) * cos( (M_PI/180.0)*(a) ) ) +#define COMP_Y(l,a) ( -(l) * sin( (M_PI/180.0)*(a) ) ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glWdgtVectorSignal) (GObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint wdgt_vector_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_wdgt_vector_class_init (glWdgtVectorClass * class); +static void gl_wdgt_vector_instance_init (glWdgtVector * vector); +static void gl_wdgt_vector_finalize (GObject * object); +static void gl_wdgt_vector_construct (glWdgtVector * vector, gchar * label); +static void changed_cb (glWdgtVector * vector); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_wdgt_vector_get_type (void) +{ + static guint wdgt_vector_type = 0; + + if (!wdgt_vector_type) { + GTypeInfo wdgt_vector_info = { + sizeof (glWdgtVectorClass), + NULL, + NULL, + (GClassInitFunc) gl_wdgt_vector_class_init, + NULL, + NULL, + sizeof (glWdgtVector), + 0, + (GInstanceInitFunc) gl_wdgt_vector_instance_init, + }; + + wdgt_vector_type = + g_type_register_static (gtk_vbox_get_type (), + "glWdgtVector", + &wdgt_vector_info, 0); + } + + return wdgt_vector_type; +} + +static void +gl_wdgt_vector_class_init (glWdgtVectorClass * class) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = gl_wdgt_vector_finalize; + + wdgt_vector_signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glWdgtVectorClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +gl_wdgt_vector_instance_init (glWdgtVector * vector) +{ + vector->len_spin = NULL; + vector->angle_spin = NULL; +} + +static void +gl_wdgt_vector_finalize (GObject * object) +{ + glWdgtVector *vector; + glWdgtVectorClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_WDGT_VECTOR (object)); + + vector = GL_WDGT_VECTOR (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +GtkWidget * +gl_wdgt_vector_new (gchar * label) +{ + glWdgtVector *vector; + + vector = g_object_new (gl_wdgt_vector_get_type (), NULL); + + gl_wdgt_vector_construct (vector, label); + + return GTK_WIDGET (vector); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_wdgt_vector_construct (glWdgtVector * vector, + gchar * label) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkObject *adjust; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + wvbox = GTK_WIDGET (vector); + + wframe = gtk_frame_new (label); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); + + wtable = gtk_table_new (2, 3, TRUE); + gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); + gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); + gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); + gtk_container_add (GTK_CONTAINER (wframe), wtable); + + /* Length label */ + wlabel = gtk_label_new (_("Length:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + /* Length spin */ + adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, climb_rate, + 10.0, 10.0); + vector->len_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), + climb_rate, digits); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (vector->len_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (vector->len_spin), TRUE); + g_signal_connect_swapped (G_OBJECT (vector->len_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (vector)); + gtk_table_attach_defaults (GTK_TABLE (wtable), vector->len_spin, 1, 2, + 0, 1); + /* Length units label */ + vector->len_units_label = gtk_label_new (units_string); + gtk_misc_set_alignment (GTK_MISC (vector->len_units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), vector->len_units_label, + 2, 3, 0, 1); + + /* Angle label */ + wlabel = gtk_label_new (_("Angle:")); + gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + /* Angle spin */ + adjust = gtk_adjustment_new (0.0, -180.0, +180.0, 1.0, 10.0, 10.0); + vector->angle_spin = + gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); + gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (vector->angle_spin), + TRUE); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (vector->angle_spin), + TRUE); + g_signal_connect_swapped (G_OBJECT (vector->angle_spin), "changed", + G_CALLBACK (changed_cb), + G_OBJECT (vector)); + gtk_table_attach_defaults (GTK_TABLE (wtable), vector->angle_spin, 1, 2, + 1, 2); + /* Angle units label */ + vector->angle_units_label = gtk_label_new (_("degrees")); + gtk_misc_set_alignment (GTK_MISC (vector->angle_units_label), 0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (wtable), + vector->angle_units_label, 2, 3, 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glWdgtVector * vector) +{ + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (vector), wdgt_vector_signals[CHANGED], 0); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_wdgt_vector_get_params (glWdgtVector * vector, + gdouble * dx, + gdouble * dy) +{ + gdouble length, angle; + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + length = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(vector->len_spin)); + angle = + gtk_spin_button_get_value (GTK_SPIN_BUTTON(vector->angle_spin)); + + length /= units_per_point; + + *dx = COMP_X (length, angle); + *dy = COMP_Y (length, angle); +} + +/*====================================================================*/ +/* set values and ranges for controls. */ +/*====================================================================*/ +void +gl_wdgt_vector_set_params (glWdgtVector * vector, + gdouble dx, + gdouble dy, + gdouble x_max, + gdouble y_max) +{ + GtkObject *length_adjust; + gdouble length, angle; + const gchar *units_string; + gdouble units_per_point, climb_rate; + gint digits; + + units_string = gl_prefs_get_units_string (); + units_per_point = gl_prefs_get_units_per_point (); + climb_rate = gl_prefs_get_units_step_size (); + digits = gl_prefs_get_units_precision (); + + /* Put everything into our display units */ + dx *= units_per_point; + dy *= units_per_point; + x_max *= units_per_point; + y_max *= units_per_point; + + length = LENGTH (dx, dy); + angle = ANGLE (dx, dy); + + length_adjust = gtk_adjustment_new (length, 0.0, LENGTH (x_max, y_max), + climb_rate, 10.0, 10.0); + gtk_spin_button_configure (GTK_SPIN_BUTTON (vector->len_spin), + GTK_ADJUSTMENT (length_adjust), + climb_rate, digits); + gtk_spin_button_update (GTK_SPIN_BUTTON (vector->len_spin)); + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (vector->angle_spin), angle); +} diff --git a/glabels2/src/wdgt-vector.h b/glabels2/src/wdgt-vector.h new file mode 100644 index 0000000..b3d57ad --- /dev/null +++ b/glabels2/src/wdgt-vector.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * wdgt_vector.h: vector properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WDGT_VECTOR_H__ +#define __WDGT_VECTOR_H__ + +#include <gnome.h> +#include "label.h" + +#define GL_TYPE_WDGT_VECTOR (gl_wdgt_vector_get_type ()) +#define GL_WDGT_VECTOR(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_VECTOR, glWdgtVector )) +#define GL_WDGT_VECTOR_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_VECTOR, glWdgtVectorClass)) +#define GL_IS_WDGT_VECTOR(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_VECTOR)) +#define GL_IS_WDGT_VECTOR_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_VECTOR)) + +typedef struct _glWdgtVector glWdgtVector; +typedef struct _glWdgtVectorClass glWdgtVectorClass; + +struct _glWdgtVector { + GtkVBox parent_widget; + + GtkWidget *len_spin; + GtkWidget *len_units_label; + GtkWidget *angle_spin; + GtkWidget *angle_units_label; +}; + +struct _glWdgtVectorClass { + GtkVBoxClass parent_class; + + void (*changed) (glWdgtVector * vector, gpointer user_data); +}; + +extern guint gl_wdgt_vector_get_type (void); + +extern GtkWidget *gl_wdgt_vector_new (gchar * label); + +extern void gl_wdgt_vector_get_params (glWdgtVector * vector, + gdouble * dx, gdouble * dy); + +extern void gl_wdgt_vector_set_params (glWdgtVector * vector, + gdouble dx, gdouble dy, + gdouble x_max, gdouble y_max); + +#endif diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c new file mode 100644 index 0000000..ecbb6cb --- /dev/null +++ b/glabels2/src/xml-label.c @@ -0,0 +1,1116 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.c: GLabels xml label module + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> + +#include <gnome.h> + +#include <libxml/tree.h> +#include <libxml/parser.h> + +#include "label.h" +#include "label-object.h" +#include "label-text.h" +#include "label-box.h" +#include "label-line.h" +#include "label-ellipse.h" +#include "label-image.h" +#include "label-barcode.h" +#include "template.h" +#include "xml-label.h" +#include "util.h" + +#include "debug.h" + +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ +#define NAME_SPACE "http://snaught.com/glabels/1.90/" +#define COMPAT01_NAME_SPACE "http://snaught.com/glabels/0.1/" +#define COMPAT04_NAME_SPACE "http://snaught.com/glabels/0.4/" + +/*========================================================*/ +/* Private types. */ +/*========================================================*/ + +/*========================================================*/ +/* Private globals. */ +/*========================================================*/ + +/*========================================================*/ +/* Private function prototypes. */ +/*========================================================*/ + +static glLabel *xml_doc_to_label (xmlDocPtr doc, glXMLLabelStatus *status); +static glLabel *xml_parse_label (xmlNodePtr root, glXMLLabelStatus *status); +static void xml_parse_objects (xmlNodePtr node, glLabel * label); +static void xml_parse_object(xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_text_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_box_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_line_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_ellipse_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_image_props (xmlNodePtr node, glLabel *label); +static glLabelObject *xml_parse_barcode_props (xmlNodePtr node, glLabel *label); +static void xml_parse_merge_fields (xmlNodePtr node, glLabel *label); + +static xmlDocPtr xml_label_to_doc (glLabel * label, glXMLLabelStatus *status); +static void xml_create_objects (xmlNodePtr root, xmlNsPtr ns, glLabel * label); +static void xml_create_object (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_text_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_box_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_line_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_ellipse_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_image_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_barcode_props (xmlNodePtr root, xmlNsPtr ns, + glLabelObject * object); +static void xml_create_merge_fields (xmlNodePtr root, xmlNsPtr ns, + glLabel * label); + +/****************************************************************************/ +/* Open and read label from xml file. */ +/****************************************************************************/ +glLabel * +gl_xml_label_open (const gchar * filename, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + glLabel *label; + + gl_debug (DEBUG_XML, "START"); + + doc = xmlParseFile (filename); + if (!doc) { + g_warning (_("xmlParseFile error")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + label = xml_doc_to_label (doc, status); + + xmlFreeDoc (doc); + + gl_label_set_filename (label, filename); + gl_label_clear_modified (label); + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/****************************************************************************/ +/* Read label from xml buffer. */ +/****************************************************************************/ +glLabel * +gl_xml_label_open_buffer (const gchar * buffer, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + glLabel *label; + + gl_debug (DEBUG_XML, "START"); + + doc = xmlParseDoc ((xmlChar *) buffer); + if (!doc) { + g_warning (_("xmlParseFile error")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + label = xml_doc_to_label (doc, status); + + gl_label_clear_modified (label); + + xmlFreeDoc (doc); + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse xml doc structure and create label. */ +/*--------------------------------------------------------------------------*/ +static glLabel * +xml_doc_to_label (xmlDocPtr doc, + glXMLLabelStatus *status) +{ + xmlNodePtr root, node; + xmlNsPtr ns; + glLabel *label; + + gl_debug (DEBUG_XML, "START"); + + LIBXML_TEST_VERSION; + + *status = XML_LABEL_OK; + + root = xmlDocGetRootElement (doc); + if (!root || !root->name) { + g_warning (_("No document root")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + ns = xmlSearchNsByHref (doc, root, NAME_SPACE); + if (ns != NULL) { + label = xml_parse_label (root, status); + } else { + /* Try compatability mode 0.1 */ + ns = xmlSearchNsByHref (doc, root, COMPAT01_NAME_SPACE); + if (ns != NULL) { + g_warning (_("Importing from glabels 0.1 format")); + g_warning ("TODO"); + label = NULL; /* TODO */ + } else { + /* Try compatability mode 0.4 */ + ns = xmlSearchNsByHref (doc, root, + COMPAT04_NAME_SPACE); + if (ns != NULL) { + g_warning (_("Importing from glabels 0.4 format")); + g_warning ("TODO"); + label = NULL; /* TODO */ + } else { + g_warning (_("bad document, unknown glabels Namespace")); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + } + } + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse xml root node and create label. */ +/*--------------------------------------------------------------------------*/ +static glLabel * +xml_parse_label (xmlNodePtr root, + glXMLLabelStatus *status) +{ + xmlNodePtr node; + glLabel *label; + glTemplate *template; + + gl_debug (DEBUG_XML, "START"); + + *status = XML_LABEL_OK; + + if (g_strcasecmp (root->name, "Document") != 0) { + g_warning (_("Bad root node = \"%s\""), root->name); + *status = XML_LABEL_ERROR_OPEN_PARSE; + return NULL; + } + + label = GL_LABEL(gl_label_new ()); + + for (node = root->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Sheet") == 0) { + template = gl_template_xml_parse_sheet (node); + if (!template) { + *status = XML_LABEL_UNKNOWN_MEDIA; + return NULL; + } + gl_label_set_template (label, template); + gl_template_free (&template); + } else if (g_strcasecmp (node->name, "Objects") == 0) { + xml_parse_objects (node, label); + } else if (g_strcasecmp (node->name, "Merge_Fields") == 0) { + xml_parse_merge_fields (node, label); + } else { + if (!xmlNodeIsText (node)) { + g_warning (_("bad node = \"%s\""), node->name); + } + } + } + + gl_debug (DEBUG_XML, "END"); + + return label; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse Objects node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_objects (xmlNodePtr objects_node, + glLabel * label) +{ + gboolean rotate_flag; + xmlNodePtr node; + + gl_debug (DEBUG_XML, "START"); + + rotate_flag = + !(g_strcasecmp (xmlGetProp (objects_node, "rotate"), "false") == 0); + gl_label_set_rotate_flag (label, rotate_flag); + + for (node = objects_node->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Object") == 0) { + xml_parse_object (node, label); + } else { + if (!xmlNodeIsText (node)) { + g_warning (_("bad node = \"%s\""), node->name); + } + } + } + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Object Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_object (xmlNodePtr object_node, + glLabel * label) +{ + glLabelObject *object; + gdouble x, y; + gchar *type_string; + + gl_debug (DEBUG_XML, "START"); + + type_string = xmlGetProp (object_node, "type"); + + if ( g_strcasecmp (type_string, "text") == 0 ) { + object = xml_parse_text_props (object_node, label); + } else if ( g_strcasecmp (type_string, "box") == 0 ) { + object = xml_parse_box_props (object_node, label); + } else if ( g_strcasecmp (type_string, "line") == 0 ) { + object = xml_parse_line_props (object_node, label); + } else if ( g_strcasecmp (type_string, "ellipse") == 0 ) { + object = xml_parse_ellipse_props (object_node, label); + } else if ( g_strcasecmp (type_string, "image") == 0 ) { + object = xml_parse_image_props (object_node, label); + } else if ( g_strcasecmp (type_string, "barcode") == 0 ) { + object = xml_parse_barcode_props (object_node, label); + } else { + g_warning ("Unknown label object type \"%s\"", type_string); + return; + } + + x = g_strtod (xmlGetProp (object_node, "x"), NULL); + y = g_strtod (xmlGetProp (object_node, "y"), NULL); + + gl_label_object_set_position (object, x, y); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Text Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_text_props (xmlNodePtr object_node, + glLabel * label) +{ + GObject *object; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + xmlNodePtr line_node, text_node; + glTextNode *node_text; + GList *nodes; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_text_new (label); + + font_family = xmlGetProp (object_node, "font_family"); + font_size = g_strtod (xmlGetProp (object_node, "font_size"), NULL); + font_weight = gl_util_string_to_weight (xmlGetProp (object_node, + "font_weight")); + font_italic_flag = + !(g_strcasecmp (xmlGetProp (object_node, "font_italic"), "false") == + 0); + + just = gl_util_string_to_just (xmlGetProp (object_node, "justify")); + + sscanf (xmlGetProp (object_node, "color"), "%x", &color); + + lines = NULL; + for (line_node = object_node->xmlChildrenNode; + line_node != NULL; + line_node = line_node->next) { + + if (g_strcasecmp (line_node->name, "Line") == 0) { + + nodes = NULL; + for (text_node = line_node->xmlChildrenNode; + text_node != NULL; text_node = text_node->next) { + + if (g_strcasecmp (text_node->name, "Field") == + 0) { + node_text = g_new0 (glTextNode, 1); + node_text->field_flag = TRUE; + node_text->data = + xmlGetProp (text_node, "name"); + nodes = + g_list_append (nodes, node_text); + } else if (xmlNodeIsText (text_node)) { + node_text = g_new0 (glTextNode, 1); + node_text->field_flag = FALSE; + node_text->data = + xmlNodeGetContent (text_node); + nodes = + g_list_append (nodes, node_text); + } else { + g_warning ("Unexpected Text Line child: \"%s\"", + text_node->name); + } + + } + lines = g_list_append (lines, nodes); + + } else if (!xmlNodeIsText (line_node)) { + g_warning ("Unexpected Text child: \"%s\"", + line_node->name); + } + + } + + gl_label_text_set_lines (GL_LABEL_TEXT(object), lines); + gl_label_text_set_props (GL_LABEL_TEXT(object), + font_family, font_size, font_weight, + font_italic_flag, + color, just); + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Box Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_box_props (xmlNodePtr node, + glLabel * label) +{ + GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_box_new (label); + + w = g_strtod (xmlGetProp (node, "w"), NULL); + h = g_strtod (xmlGetProp (node, "h"), NULL); + + line_width = g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", &line_color); + sscanf (xmlGetProp (node, "fill_color"), "%x", &fill_color); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_box_set_line_width (GL_LABEL_BOX(object), line_width); + gl_label_box_set_line_color (GL_LABEL_BOX(object), line_color); + gl_label_box_set_fill_color (GL_LABEL_BOX(object), fill_color); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Line Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_line_props (xmlNodePtr node, + glLabel * label) +{ + GObject *object; + gdouble line_width; + guint line_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_line_new (label); + + w = g_strtod (xmlGetProp (node, "dx"), NULL); + h = g_strtod (xmlGetProp (node, "dy"), NULL); + + line_width = g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", &line_color); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_line_set_line_width (GL_LABEL_LINE(object), line_width); + gl_label_line_set_line_color (GL_LABEL_LINE(object), line_color); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Ellipse Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_ellipse_props (xmlNodePtr node, + glLabel * label) +{ + GObject *object; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_ellipse_new (label); + + w = g_strtod (xmlGetProp (node, "w"), NULL); + h = g_strtod (xmlGetProp (node, "h"), NULL); + + line_width = g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", &line_color); + sscanf (xmlGetProp (node, "fill_color"), "%x", &fill_color); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), line_width); + gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), line_color); + gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), fill_color); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Image Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_image_props (xmlNodePtr node, + glLabel *label) +{ + GObject *object; + gdouble w, h; + gchar *filename; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_image_new (label); + + w = g_strtod (xmlGetProp (node, "w"), NULL); + h = g_strtod (xmlGetProp (node, "h"), NULL); + + filename = xmlNodeGetContent (node); + + gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); + gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename); + + g_free (filename); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Barcode Node Properties */ +/*--------------------------------------------------------------------------*/ +static glLabelObject * +xml_parse_barcode_props (xmlNodePtr node, + glLabel *label) +{ + GObject *object; + xmlNodePtr child; + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + + gl_debug (DEBUG_XML, "START"); + + object = gl_label_barcode_new (label); + + sscanf (xmlGetProp (node, "color"), "%x", &color); + + style = gl_barcode_text_to_style (xmlGetProp (node, "style")); + text_flag = !(g_strcasecmp (xmlGetProp (node, "text"), "false") == 0); + scale = g_strtod (xmlGetProp (node, "scale"), NULL); + + child = node->xmlChildrenNode; + text_node = g_new0 (glTextNode, 1); + if (g_strcasecmp (child->name, "Field") == 0) { + text_node->field_flag = TRUE; + text_node->data = xmlGetProp (child, "name"); + } else if (xmlNodeIsText (child)) { + text_node->field_flag = FALSE; + text_node->data = xmlNodeGetContent (child); + } else { + g_warning ("Unexpected Barcode child: \"%s\"", child->name); + } + + gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node); + gl_label_barcode_set_props (GL_LABEL_BARCODE(object), + style, text_flag, color, scale); + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_XML, "END"); + + return GL_LABEL_OBJECT(object); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML merge fields tag. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_merge_fields (xmlNodePtr node, + glLabel * label) +{ + xmlNodePtr child; + glMerge *merge; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_XML, "START"); + + merge = gl_merge_new (); + + merge->type = gl_merge_text_to_type (xmlGetProp (node, "type")); + merge->src = xmlGetProp (node, "src"); + + for (child = node->xmlChildrenNode; child != NULL; child = child->next) { + + if (g_strcasecmp (child->name, "Field") == 0) { + field_def = g_new0 (glMergeFieldDefinition, 1); + field_def->key = xmlGetProp (child, "key"); + field_def->loc = xmlGetProp (child, "loc"); + merge->field_defs = + g_list_append (merge->field_defs, + field_def); + } else if (!xmlNodeIsText (child)) { + g_warning ("Unexpected Merge_Fields child: \"%s\"", + child->name); + } + + } + + gl_label_set_merge (label, merge); + + gl_merge_free (&merge); + + gl_debug (DEBUG_XML, "END"); +} + +/****************************************************************************/ +/* Save label to xml label file. */ +/****************************************************************************/ +void +gl_xml_label_save (glLabel *label, + const gchar *filename, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + gint xml_ret; + + gl_debug (DEBUG_XML, "START"); + + doc = xml_label_to_doc (label, status); + + xml_ret = xmlSaveFormatFile (filename, doc, TRUE); + xmlFreeDoc (doc); + if (xml_ret == -1) { + g_warning (_("Problem saving xml file.")); + *status = XML_LABEL_ERROR_SAVE_FILE; + } + + gl_label_set_filename (label, filename); + gl_label_clear_modified (label); + + gl_debug (DEBUG_XML, "END"); +} + +/****************************************************************************/ +/* Save label to xml buffer. */ +/****************************************************************************/ +gchar * +gl_xml_label_save_buffer (glLabel *label, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + gint size; + gchar *buffer; + + gl_debug (DEBUG_XML, "START"); + + doc = xml_label_to_doc (label, status); + + xmlDocDumpMemory (doc, (xmlChar **)&buffer, &size); + xmlFreeDoc (doc); + + gl_label_clear_modified (label); + + gl_debug (DEBUG_XML, "END"); + + return buffer; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Convert label to xml doc structure. */ +/*--------------------------------------------------------------------------*/ +static xmlDocPtr +xml_label_to_doc (glLabel * label, + glXMLLabelStatus *status) +{ + xmlDocPtr doc; + xmlNsPtr ns; + glTemplate *template; + glMerge *merge; + + gl_debug (DEBUG_XML, "START"); + + LIBXML_TEST_VERSION; + + doc = xmlNewDoc ("1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Document", NULL); + + ns = xmlNewNs (doc->xmlRootNode, NAME_SPACE, "glabels"); + xmlSetNs (doc->xmlRootNode, ns); + + template = gl_label_get_template (label); + gl_template_xml_add_sheet (template, doc->xmlRootNode, ns); + + xml_create_objects (doc->xmlRootNode, ns, label); + + merge = gl_label_get_merge (label); + gl_debug (DEBUG_XML, "merge=%p", merge); + if (merge->type != GL_MERGE_NONE) { + xml_create_merge_fields (doc->xmlRootNode, ns, label); + } + gl_merge_free (&merge); + + gl_debug (DEBUG_XML, "END"); + + *status = XML_LABEL_OK; + return doc; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Objects Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_objects (xmlNodePtr root, + xmlNsPtr ns, + glLabel * label) +{ + xmlNodePtr node; + gboolean rotate_flag; + GList *p; + + gl_debug (DEBUG_XML, "START"); + + rotate_flag = gl_label_get_rotate_flag (label); + + node = xmlNewChild (root, ns, "Objects", NULL); + xmlSetProp (node, "id", "0"); + xmlSetProp (node, "rotate", rotate_flag ? "True" : "False"); + + for (p = label->objects; p != NULL; p = p->next) { + xml_create_object (node, ns, GL_LABEL_OBJECT(p->data)); + } + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML label object Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_object (xmlNodePtr root, + xmlNsPtr ns, + glLabelObject * object) +{ + xmlNodePtr object_node; + gdouble x, y; + gchar *string; + + gl_debug (DEBUG_XML, "START"); + + object_node = xmlNewChild (root, ns, "Object", NULL); + + gl_label_object_get_position (object, &x, &y); + string = g_strdup_printf ("%g", x); + xmlSetProp (object_node, "x", string); + g_free (string); + string = g_strdup_printf ("%g", y); + xmlSetProp (object_node, "y", string); + g_free (string); + + if ( GL_IS_LABEL_TEXT(object) ) { + xml_create_text_props (object_node, ns, object); + } else if ( GL_IS_LABEL_BOX(object) ) { + xml_create_box_props (object_node, ns, object); + } else if ( GL_IS_LABEL_LINE(object) ) { + xml_create_line_props (object_node, ns, object); + } else if ( GL_IS_LABEL_ELLIPSE(object) ) { + xml_create_ellipse_props (object_node, ns, object); + } else if ( GL_IS_LABEL_IMAGE(object) ) { + xml_create_image_props (object_node, ns, object); + } else if ( GL_IS_LABEL_BARCODE(object) ) { + xml_create_barcode_props (object_node, ns, object); + } else { + g_warning ("Unknown label object"); + } + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Text Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_text_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + xmlNodePtr line_node, field_node; + GList *lines; + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + guint color; + GtkJustification just; + gchar *string; + GList *p_line, *p_node; + glTextNode *node_text; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Text"); + + lines = gl_label_text_get_lines (GL_LABEL_TEXT(object)); + gl_label_text_get_props (GL_LABEL_TEXT(object), + &font_family, &font_size, &font_weight, + &font_italic_flag, + &color, &just); + + xmlSetProp (object_node, "font_family", font_family); + string = g_strdup_printf ("%g", font_size); + xmlSetProp (object_node, "font_size", string); + g_free (string); + xmlSetProp (object_node, "font_weight", + gl_util_weight_to_string (font_weight)); + xmlSetProp (object_node, "font_italic", + font_italic_flag?"True":"False"); + + xmlSetProp (object_node, "justify", gl_util_just_to_string (just)); + + string = g_strdup_printf ("0x%08x", color); + xmlSetProp (object_node, "color", string); + g_free (string); + + for (p_line = lines; p_line != NULL; p_line = p_line->next) { + line_node = xmlNewChild (object_node, ns, "Line", NULL); + + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + node_text = (glTextNode *) p_node->data; + + if (node_text->field_flag) { + field_node = + xmlNewChild (line_node, ns, "Field", NULL); + xmlSetProp (field_node, "name", + node_text->data); + } else { + xmlNodeAddContent (line_node, node_text->data); + } + + } + + } + + gl_text_node_lines_free (&lines); + g_free (font_family); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Box Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_box_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Box"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_box_get_line_width (GL_LABEL_BOX(object)); + line_color = gl_label_box_get_line_color (GL_LABEL_BOX(object)); + fill_color = gl_label_box_get_fill_color (GL_LABEL_BOX(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "w", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "h", string); + g_free (string); + + string = g_strdup_printf ("%g", line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", fill_color); + xmlSetProp (object_node, "fill_color", string); + g_free (string); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Line Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_line_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble line_width; + guint line_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Line"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_line_get_line_width (GL_LABEL_LINE(object)); + line_color = gl_label_line_get_line_color (GL_LABEL_LINE(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "dx", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "dy", string); + g_free (string); + + string = g_strdup_printf ("%g", line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Ellipse Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_ellipse_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble line_width; + guint line_color, fill_color; + gdouble w, h; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Ellipse"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + line_width = gl_label_ellipse_get_line_width (GL_LABEL_ELLIPSE(object)); + line_color = gl_label_ellipse_get_line_color (GL_LABEL_ELLIPSE(object)); + fill_color = gl_label_ellipse_get_fill_color (GL_LABEL_ELLIPSE(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "w", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "h", string); + g_free (string); + + string = g_strdup_printf ("%g", line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", fill_color); + xmlSetProp (object_node, "fill_color", string); + g_free (string); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Image Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_image_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + gdouble w, h; + gchar *filename; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Image"); + + gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); + filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); + + string = g_strdup_printf ("%g", w); + xmlSetProp (object_node, "w", string); + g_free (string); + string = g_strdup_printf ("%g", h); + xmlSetProp (object_node, "h", string); + g_free (string); + + xmlNodeSetContent (object_node, filename); + + g_free (filename); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Barcode Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_barcode_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + glTextNode *text_node; + glBarcodeStyle style; + gboolean text_flag; + guint color; + gdouble scale; + xmlNodePtr child; + gchar *string; + + gl_debug (DEBUG_XML, "START"); + + xmlSetProp (object_node, "type", "Barcode"); + + text_node = gl_label_barcode_get_data (GL_LABEL_BARCODE(object)); + gl_label_barcode_get_props (GL_LABEL_BARCODE(object), + &style, &text_flag, &color, &scale); + + string = g_strdup_printf ("0x%08x", color); + xmlSetProp (object_node, "color", string); + g_free (string); + + xmlSetProp (object_node, "style", gl_barcode_style_to_text (style)); + xmlSetProp (object_node, "text", text_flag?"True":"False"); + string = g_strdup_printf ("%g", scale); + xmlSetProp (object_node, "scale", string); + g_free (string); + + if (text_node->field_flag) { + child = xmlNewChild (object_node, ns, "Field", NULL); + xmlSetProp (child, "name", text_node->data); + } else { + xmlNodeSetContent (object_node, text_node->data); + } + + gl_text_node_free (&text_node); + + gl_debug (DEBUG_XML, "END"); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label Merge Fields Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_merge_fields (xmlNodePtr root, + xmlNsPtr ns, + glLabel * label) +{ + xmlNodePtr node, child; + gchar *string; + GList *p; + glMerge *merge; + glMergeFieldDefinition *field_def; + + gl_debug (DEBUG_XML, "START"); + + merge = gl_label_get_merge (label); + + node = xmlNewChild (root, ns, "Merge_Fields", NULL); + + string = gl_merge_type_to_text (merge->type); + xmlSetProp (node, "type", string); + g_free (string); + + xmlSetProp (node, "src", merge->src); + + for (p = merge->field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + child = xmlNewChild (node, ns, "Field", NULL); + xmlSetProp (child, "key", field_def->key); + xmlSetProp (child, "loc", field_def->loc); + } + + gl_merge_free (&merge); + + gl_debug (DEBUG_XML, "END"); +} + diff --git a/glabels2/src/xml-label.h b/glabels2/src/xml-label.h new file mode 100644 index 0000000..5ab1e5e --- /dev/null +++ b/glabels2/src/xml-label.h @@ -0,0 +1,53 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.h: GLabels label module header file + * + * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __XML_LABEL_H__ +#define __XML_LABEL_H__ + +#include "label.h" + +G_BEGIN_DECLS + + +typedef enum { + XML_LABEL_UNKNOWN_MEDIA = 1, + XML_LABEL_OK = 0, + XML_LABEL_ERROR_OPEN_PARSE = -10, + XML_LABEL_ERROR_SAVE_FILE = -20, +} glXMLLabelStatus; + + +extern glLabel *gl_xml_label_open (const gchar * filename, + glXMLLabelStatus *status); +extern glLabel *gl_xml_label_open_buffer (const gchar * buffer, + glXMLLabelStatus *status); + +extern void gl_xml_label_save (glLabel * label, + const gchar * filename, + glXMLLabelStatus *status); +extern gchar *gl_xml_label_save_buffer (glLabel * label, + glXMLLabelStatus *status); + + +G_END_DECLS + + +#endif /* __XML_LABEL_H__ */ diff --git a/glabels2/stamp-h.in b/glabels2/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/glabels2/stamp-h.in @@ -0,0 +1 @@ +timestamp |